Add an easing/transition type cheatsheet to the Tween documentation
Related to https://github.com/godotengine/godot-docs/pull/3403.
(cherry picked from commit 5972a9138e
)
This commit is contained in:
parent
f3cd7e3808
commit
bbd381c987
|
@ -6,7 +6,7 @@
|
|||
<description>
|
||||
Tweens are useful for animations requiring a numerical property to be interpolated over a range of values. The name [i]tween[/i] comes from [i]in-betweening[/i], an animation technique where you specify [i]keyframes[/i] and the computer interpolates the frames that appear between them.
|
||||
[Tween] is more suited than [AnimationPlayer] for animations where you don't know the final values in advance. For example, interpolating a dynamically-chosen camera zoom value is best done with a [Tween] node; it would be difficult to do the same thing with an [AnimationPlayer] node.
|
||||
Here is a brief usage example that causes a 2D node to move smoothly between two positions:
|
||||
Here is a brief usage example that makes a 2D node move smoothly between two positions:
|
||||
[codeblock]
|
||||
var tween = get_node("Tween")
|
||||
tween.interpolate_property($Node2D, "position",
|
||||
|
@ -15,7 +15,8 @@
|
|||
tween.start()
|
||||
[/codeblock]
|
||||
Many methods require a property name, such as [code]"position"[/code] above. You can find the correct property name by hovering over the property in the Inspector. You can also provide the components of a property directly by using [code]"property:component"[/code] (eg. [code]position:x[/code]), where it would only apply to that particular component.
|
||||
Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an [enum TransitionType] constant, and refers to the way the timing of the animation is handled (see [code]http://easings.net/[/code] for some examples). The second accepts an [enum EaseType] constant, and controls the where [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.
|
||||
Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an [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 the where [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.
|
||||
[b][url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/tween_cheatsheet.png]Tween easing and transition types cheatsheet[/url][/b]
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
|
Loading…
Reference in New Issue