diff options
author | Malcolm Anderson <malcolminyo@gmail.com> | 2024-11-02 20:52:11 -0700 |
---|---|---|
committer | Malcolm Anderson <malcolminyo@gmail.com> | 2024-11-11 16:34:45 -0800 |
commit | 0304f8fd572fadb4bc70c29cc82315d546bb4bd7 (patch) | |
tree | 8db8255788d24e576ac980d3127ef283c904d75d | |
parent | 96be44c0ec4bafcb08d78be1a584b751b424db9f (diff) | |
download | redot-engine-0304f8fd572fadb4bc70c29cc82315d546bb4bd7.tar.gz |
Update docs for `Tween.stop` to clarify behavior
Apply suggestions from code review
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>
Updated wording in comments to be more concise
-rw-r--r-- | doc/classes/Tween.xml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index ac16bebecb..00bbce59b1 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -280,6 +280,22 @@ <return type="void" /> <description> Stops the tweening and resets the [Tween] to its initial state. This will not remove any appended [Tweener]s. + [b]Note:[/b] This does [i]not[/i] reset targets of [PropertyTweener]s to their values when the [Tween] first started. + [codeblock] + var tween = create_tween() + + # Will move from 0 to 500 over 1 second. + position.x = 0.0 + tween.tween_property(self, "position:x", 500, 1.0) + + # Will be at (about) 250 when the timer finishes. + await get_tree().create_timer(0.5).timeout + + # Will now move from (about) 250 to 500 over 1 second, + # thus at half the speed as before. + tween.stop() + tween.play() + [/codeblock] [b]Note:[/b] If a Tween is stopped and not bound to any node, it will exist indefinitely until manually started or invalidated. If you lose a reference to such Tween, you can retrieve it using [method SceneTree.get_processed_tweens]. </description> </method> |