435 lines
19 KiB
XML
435 lines
19 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="Tween" inherits="Node" category="Core" version="3.0-rc1">
|
|
<brief_description>
|
|
Node useful for animations with unknown start and end points.
|
|
</brief_description>
|
|
<description>
|
|
Node useful for animations with unknown start and end points, procedural animations, making one node follow another, and other simple behavior.
|
|
Because it is easy to get it wrong, here is a quick usage example:
|
|
[codeblock]
|
|
var tween = get_node("Tween")
|
|
tween.interpolate_property(get_node("Node2D_to_move"), "transform/origin", Vector2(0,0), Vector2(100,100), 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
|
|
tween.start()
|
|
[/codeblock]
|
|
Some of the methods of this class require a property name. You can get the property name by hovering over the property in the inspector of the editor.
|
|
Many of the methods accept [code]trans_type[/code] and [code]ease_type[/code]. The first accepts an TRANS_* constant, and refers to the way the timing of the animation is handled (you might want to see [code]http://easings.net/[/code] for some examples). The second accepts an EASE_* 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 TRANS_* constants with EASE_IN_OUT, and use the one that looks best.
|
|
</description>
|
|
<tutorials>
|
|
</tutorials>
|
|
<demos>
|
|
</demos>
|
|
<methods>
|
|
<method name="follow_method">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="method" type="String">
|
|
</argument>
|
|
<argument index="2" name="initial_val" type="Variant">
|
|
</argument>
|
|
<argument index="3" name="target" type="Object">
|
|
</argument>
|
|
<argument index="4" name="target_method" type="String">
|
|
</argument>
|
|
<argument index="5" name="duration" type="float">
|
|
</argument>
|
|
<argument index="6" name="trans_type" type="int" enum="Tween.TransitionType">
|
|
</argument>
|
|
<argument index="7" name="ease_type" type="int" enum="Tween.EaseType">
|
|
</argument>
|
|
<argument index="8" name="delay" type="float" default="0">
|
|
</argument>
|
|
<description>
|
|
Follow [code]method[/code] of [code]object[/code] and apply the returned value on [code]target_method[/code] of [code]target[/code], beginning from [code]initial_val[/code] for [code]duration[/code] seconds, [code]delay[/code] later. Methods are animated by calling them with consequitive values.
|
|
[code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
|
|
</description>
|
|
</method>
|
|
<method name="follow_property">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="property" type="NodePath">
|
|
</argument>
|
|
<argument index="2" name="initial_val" type="Variant">
|
|
</argument>
|
|
<argument index="3" name="target" type="Object">
|
|
</argument>
|
|
<argument index="4" name="target_property" type="NodePath">
|
|
</argument>
|
|
<argument index="5" name="duration" type="float">
|
|
</argument>
|
|
<argument index="6" name="trans_type" type="int" enum="Tween.TransitionType">
|
|
</argument>
|
|
<argument index="7" name="ease_type" type="int" enum="Tween.EaseType">
|
|
</argument>
|
|
<argument index="8" name="delay" type="float" default="0">
|
|
</argument>
|
|
<description>
|
|
Follow [code]property[/code] of [code]object[/code] and apply it on [code]target_property[/code] of [code]target[/code], beginning from [code]initial_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Note that [code]target:target_property[/code] would equal [code]object:property[/code] at the end of the tween.
|
|
[code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
|
|
</description>
|
|
</method>
|
|
<method name="get_runtime" qualifiers="const">
|
|
<return type="float">
|
|
</return>
|
|
<description>
|
|
Returns the time needed for all tweens to end in seconds, measured from the start. Thus, if you have two tweens, one ending 10 seconds after the start and the other - 20 seconds, it would return 20 seconds, as by that time all tweens would have finished.
|
|
</description>
|
|
</method>
|
|
<method name="interpolate_callback">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="duration" type="float">
|
|
</argument>
|
|
<argument index="2" name="callback" type="String">
|
|
</argument>
|
|
<argument index="3" name="arg1" type="Variant" default="null">
|
|
</argument>
|
|
<argument index="4" name="arg2" type="Variant" default="null">
|
|
</argument>
|
|
<argument index="5" name="arg3" type="Variant" default="null">
|
|
</argument>
|
|
<argument index="6" name="arg4" type="Variant" default="null">
|
|
</argument>
|
|
<argument index="7" name="arg5" type="Variant" default="null">
|
|
</argument>
|
|
<description>
|
|
Call [code]callback[/code] of [code]object[/code] after [code]duration[/code]. [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback.
|
|
</description>
|
|
</method>
|
|
<method name="interpolate_deferred_callback">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="duration" type="float">
|
|
</argument>
|
|
<argument index="2" name="callback" type="String">
|
|
</argument>
|
|
<argument index="3" name="arg1" type="Variant" default="null">
|
|
</argument>
|
|
<argument index="4" name="arg2" type="Variant" default="null">
|
|
</argument>
|
|
<argument index="5" name="arg3" type="Variant" default="null">
|
|
</argument>
|
|
<argument index="6" name="arg4" type="Variant" default="null">
|
|
</argument>
|
|
<argument index="7" name="arg5" type="Variant" default="null">
|
|
</argument>
|
|
<description>
|
|
Call [code]callback[/code] of [code]object[/code] after [code]duration[/code] on the main thread (similar to [method Object.call_deferred]). [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback.
|
|
</description>
|
|
</method>
|
|
<method name="interpolate_method">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="method" type="String">
|
|
</argument>
|
|
<argument index="2" name="initial_val" type="Variant">
|
|
</argument>
|
|
<argument index="3" name="final_val" type="Variant">
|
|
</argument>
|
|
<argument index="4" name="duration" type="float">
|
|
</argument>
|
|
<argument index="5" name="trans_type" type="int" enum="Tween.TransitionType">
|
|
</argument>
|
|
<argument index="6" name="ease_type" type="int" enum="Tween.EaseType">
|
|
</argument>
|
|
<argument index="7" name="delay" type="float" default="0">
|
|
</argument>
|
|
<description>
|
|
Animate [code]method[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecutive values.
|
|
[code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
|
|
</description>
|
|
</method>
|
|
<method name="interpolate_property">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="property" type="NodePath">
|
|
</argument>
|
|
<argument index="2" name="initial_val" type="Variant">
|
|
</argument>
|
|
<argument index="3" name="final_val" type="Variant">
|
|
</argument>
|
|
<argument index="4" name="duration" type="float">
|
|
</argument>
|
|
<argument index="5" name="trans_type" type="int" enum="Tween.TransitionType">
|
|
</argument>
|
|
<argument index="6" name="ease_type" type="int" enum="Tween.EaseType">
|
|
</argument>
|
|
<argument index="7" name="delay" type="float" default="0">
|
|
</argument>
|
|
<description>
|
|
Animate [code]property[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later.
|
|
[code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
|
|
</description>
|
|
</method>
|
|
<method name="is_active" qualifiers="const">
|
|
<return type="bool">
|
|
</return>
|
|
<description>
|
|
Returns true if any tweens are currently running, and false otherwise. Note that this method doesn't consider tweens that have ended.
|
|
</description>
|
|
</method>
|
|
<method name="remove">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="key" type="String" default="""">
|
|
</argument>
|
|
<description>
|
|
Stop animating and completely remove a tween, given its object and property/method pair. Passing empty String as key will remove all tweens for given object.
|
|
</description>
|
|
</method>
|
|
<method name="remove_all">
|
|
<return type="bool">
|
|
</return>
|
|
<description>
|
|
Stop animating and completely remove all tweens.
|
|
</description>
|
|
</method>
|
|
<method name="reset">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="key" type="String" default="""">
|
|
</argument>
|
|
<description>
|
|
Resets a tween to the initial value (the one given, not the one before the tween), given its object and property/method pair. Passing empty String as key will reset all tweens for given object.
|
|
</description>
|
|
</method>
|
|
<method name="reset_all">
|
|
<return type="bool">
|
|
</return>
|
|
<description>
|
|
Resets all tweens to their initial values (the ones given, not those before the tween).
|
|
</description>
|
|
</method>
|
|
<method name="resume">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="key" type="String" default="""">
|
|
</argument>
|
|
<description>
|
|
Continue animating a stopped tween, given its object and property/method pair. Passing empty String as key will resume all tweens for given object.
|
|
</description>
|
|
</method>
|
|
<method name="resume_all">
|
|
<return type="bool">
|
|
</return>
|
|
<description>
|
|
Continue animating all stopped tweens.
|
|
</description>
|
|
</method>
|
|
<method name="seek">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="time" type="float">
|
|
</argument>
|
|
<description>
|
|
Seek the animation to the given [code]time[/code] in seconds.
|
|
</description>
|
|
</method>
|
|
<method name="set_active">
|
|
<return type="void">
|
|
</return>
|
|
<argument index="0" name="active" type="bool">
|
|
</argument>
|
|
<description>
|
|
Activate/deactivate the tween. You can use this for pausing animations, though [method stop_all] and [method resume_all] might be more fit for this.
|
|
</description>
|
|
</method>
|
|
<method name="start">
|
|
<return type="bool">
|
|
</return>
|
|
<description>
|
|
Start the tween node. You can define tweens both before and after this.
|
|
</description>
|
|
</method>
|
|
<method name="stop">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="key" type="String" default="""">
|
|
</argument>
|
|
<description>
|
|
Stop animating a tween, given its object and property/method pair. Passing empty String as key will stop all tweens for given object.
|
|
</description>
|
|
</method>
|
|
<method name="stop_all">
|
|
<return type="bool">
|
|
</return>
|
|
<description>
|
|
Stop animating all tweens.
|
|
</description>
|
|
</method>
|
|
<method name="targeting_method">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="method" type="String">
|
|
</argument>
|
|
<argument index="2" name="initial" type="Object">
|
|
</argument>
|
|
<argument index="3" name="initial_method" type="String">
|
|
</argument>
|
|
<argument index="4" name="final_val" type="Variant">
|
|
</argument>
|
|
<argument index="5" name="duration" type="float">
|
|
</argument>
|
|
<argument index="6" name="trans_type" type="int" enum="Tween.TransitionType">
|
|
</argument>
|
|
<argument index="7" name="ease_type" type="int" enum="Tween.EaseType">
|
|
</argument>
|
|
<argument index="8" name="delay" type="float" default="0">
|
|
</argument>
|
|
<description>
|
|
Animate [code]method[/code] of [code]object[/code] from the value returned by [code]initial.initial_method[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecutive values.
|
|
[code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
|
|
</description>
|
|
</method>
|
|
<method name="targeting_property">
|
|
<return type="bool">
|
|
</return>
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="property" type="NodePath">
|
|
</argument>
|
|
<argument index="2" name="initial" type="Object">
|
|
</argument>
|
|
<argument index="3" name="initial_val" type="NodePath">
|
|
</argument>
|
|
<argument index="4" name="final_val" type="Variant">
|
|
</argument>
|
|
<argument index="5" name="duration" type="float">
|
|
</argument>
|
|
<argument index="6" name="trans_type" type="int" enum="Tween.TransitionType">
|
|
</argument>
|
|
<argument index="7" name="ease_type" type="int" enum="Tween.EaseType">
|
|
</argument>
|
|
<argument index="8" name="delay" type="float" default="0">
|
|
</argument>
|
|
<description>
|
|
Animate [code]property[/code] of [code]object[/code] from the current value of the [code]initial_val[/code] property of [code]initial[/code] to [code]final_val[/code] for [code]duration[/code] seconds, [code]delay[/code] seconds later.
|
|
[code]trans_type[/code] accepts TRANS_* constants, and is the way the animation is interpolated, while [code]ease_type[/code] accepts EASE_* constants, and controls the place of the interpolation (the beginning, the end, or both). You can read more about them in the class description.
|
|
</description>
|
|
</method>
|
|
<method name="tell" qualifiers="const">
|
|
<return type="float">
|
|
</return>
|
|
<description>
|
|
Returns the current time of the tween.
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
<members>
|
|
<member name="playback_process_mode" type="int" setter="set_tween_process_mode" getter="get_tween_process_mode" enum="Tween.TweenProcessMode">
|
|
</member>
|
|
<member name="playback_speed" type="float" setter="set_speed_scale" getter="get_speed_scale">
|
|
The speed multiplier of the tween. Set it to 1 for normal speed, 2 for two times nromal speed, and 0.5 for half of the normal speed. Setting it to 0 would pause the animation, but you might consider using [method set_active] or [method stop_all] and [method resume_all] for this.
|
|
</member>
|
|
<member name="repeat" type="bool" setter="set_repeat" getter="is_repeat">
|
|
If [code]true[/code], the tween will repeat.
|
|
</member>
|
|
</members>
|
|
<signals>
|
|
<signal name="tween_completed">
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="key" type="String">
|
|
</argument>
|
|
<description>
|
|
This signal is emitted when a tween ends.
|
|
</description>
|
|
</signal>
|
|
<signal name="tween_started">
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="key" type="String">
|
|
</argument>
|
|
<description>
|
|
This signal is emitted when a tween starts.
|
|
</description>
|
|
</signal>
|
|
<signal name="tween_step">
|
|
<argument index="0" name="object" type="Object">
|
|
</argument>
|
|
<argument index="1" name="key" type="String">
|
|
</argument>
|
|
<argument index="2" name="elapsed" type="float">
|
|
</argument>
|
|
<argument index="3" name="value" type="Object">
|
|
</argument>
|
|
<description>
|
|
This signal is emitted each step of the tweening.
|
|
</description>
|
|
</signal>
|
|
</signals>
|
|
<constants>
|
|
<constant name="TWEEN_PROCESS_PHYSICS" value="0" enum="TweenProcessMode">
|
|
The [code]Tween[/code] should use [code]_physics_process[/code] for timekeeping when this is enabled.
|
|
</constant>
|
|
<constant name="TWEEN_PROCESS_IDLE" value="1" enum="TweenProcessMode">
|
|
The [code]Tween[/code] should use [code]_process[/code] for timekeeping when this is enabled (default).
|
|
</constant>
|
|
<constant name="TRANS_LINEAR" value="0" enum="TransitionType">
|
|
Means that the animation is interpolated linearly.
|
|
</constant>
|
|
<constant name="TRANS_SINE" value="1" enum="TransitionType">
|
|
Means that the animation is interpolated using a sine wave.
|
|
</constant>
|
|
<constant name="TRANS_QUINT" value="2" enum="TransitionType">
|
|
Means that the animation is interpolated with a quinary (to the power of 5) function.
|
|
</constant>
|
|
<constant name="TRANS_QUART" value="3" enum="TransitionType">
|
|
Means that the animation is interpolated with a quartic (to the power of 4) function.
|
|
</constant>
|
|
<constant name="TRANS_QUAD" value="4" enum="TransitionType">
|
|
Means that the animation is interpolated with a quadratic (to the power of 2) function.
|
|
</constant>
|
|
<constant name="TRANS_EXPO" value="5" enum="TransitionType">
|
|
Means that the animation is interpolated with an exponential (some number to the power of x) function.
|
|
</constant>
|
|
<constant name="TRANS_ELASTIC" value="6" enum="TransitionType">
|
|
Means that the animation is interpolated with elasticity, wiggling around the edges.
|
|
</constant>
|
|
<constant name="TRANS_CUBIC" value="7" enum="TransitionType">
|
|
Means that the animation is interpolated with a cubic (to the power of 3) function.
|
|
</constant>
|
|
<constant name="TRANS_CIRC" value="8" enum="TransitionType">
|
|
Means that the animation is interpolated with a function using square roots.
|
|
</constant>
|
|
<constant name="TRANS_BOUNCE" value="9" enum="TransitionType">
|
|
Means that the animation is interpolated by bouncing at, but never surpassing, the end.
|
|
</constant>
|
|
<constant name="TRANS_BACK" value="10" enum="TransitionType">
|
|
Means that the animation is interpolated backing out at edges.
|
|
</constant>
|
|
<constant name="EASE_IN" value="0" enum="EaseType">
|
|
Signifies that the interpolation should be focused in the beginning.
|
|
</constant>
|
|
<constant name="EASE_OUT" value="1" enum="EaseType">
|
|
Signifies that the interpolation should be focused in the end.
|
|
</constant>
|
|
<constant name="EASE_IN_OUT" value="2" enum="EaseType">
|
|
Signifies that the interpolation should be focused in both ends.
|
|
</constant>
|
|
<constant name="EASE_OUT_IN" value="3" enum="EaseType">
|
|
Signifies that the interpolation should be focused in both ends, but they should be switched (a bit hard to explain, try it for yourself to be sure).
|
|
</constant>
|
|
</constants>
|
|
</class>
|