diff options
author | Yuri Sizov <11782833+YuriSizov@users.noreply.github.com> | 2022-09-12 17:54:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-12 17:54:44 +0300 |
commit | 44c55ad59b01dbf360777b1a9a18a229aeb1f4f7 (patch) | |
tree | d25dda8d3c59505468c2c75f9caf62dfd6d771a2 | |
parent | dbab737798e2f3d35370c3504ab3c57e6cc0d020 (diff) | |
parent | 038cb677cbde3adcc692296b3113398cd351f9fe (diff) |
Merge pull request #65658 from KoBeWi/Two_Tweens_are_tweening_the_same_object._Who-will-win
Add more clarifications about Tween processing
-rw-r--r-- | doc/classes/Tween.xml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index c7fc78c1d3..5186972477 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -36,9 +36,18 @@ tween.tween_property(sprite, "position", Vector2(0, 0), 1) [/codeblock] In the example above, all children of a node are moved one after another to position (0, 0). + You should avoid using more than one [Tween] per object's property. If two or more tweens animate one property at the same time, the last one created will take priority and assign the final value. If you want to interrupt and restart an animation, consider assigning the [Tween] to a variable: + [codeblock] + var tween + func animate(): + if tween: + tween.kill() # Abort the previous animation. + tween = create_tween() + [/codeblock] Some [Tweener]s use transitions and eases. The first accepts a [enum TransitionType] constant, and refers to the way the timing of the animation is handled (see [url=https://easings.net/]easings.net[/url] for some examples). The second accepts an [enum EaseType] constant, and controls where the [code]trans_type[/code] is applied to the interpolation (in the beginning, the end, or both). If you don't know which transition and easing to pick, you can try different [enum TransitionType] constants with [constant EASE_IN_OUT], and use the one that looks best. [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/tween_cheatsheet.png]Tween easing and transition types cheatsheet[/url] [b]Note:[/b] All [Tween]s will automatically start by default. To prevent a [Tween] from autostarting, you can call [method stop] immediately after it is created. + [b]Note:[/b] [Tween]s are processing after all of nodes in the current frame, i.e. after [method Node._process] or [method Node._physics_process] (depending on [enum TweenProcessMode]). </description> <tutorials> </tutorials> |