From 186b82c350f2172d5f85663ac89972faf740f8be Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Sun, 28 Feb 2016 22:02:33 +0200 Subject: [PATCH] Document Tween class (cherry picked from commit 49e1cc6fa90e437bae2477c1825331915e41f4dc) --- doc/base/classes.xml | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index bfe6bfc3aed..5756dcedd8f 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -37957,62 +37957,85 @@ This method controls whether the position between two cached points is interpola + Node useful for animations with unknown start and end points. + 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/pos", Vector2(0,0), Vector2(100,100), 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 begining, the end, or both). If you don't know which transision and easing to pick, you can try different TRANS_* constants with EASE_IN_OUT, and use the one that looks best. + Returns true if any tweens are currently running, and false otherwise. Note that this method doesn't consider tweens that have ended. + 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. + Returns true if repeat has been set from editor GUI or [method set_repeat]. + Make the tween repeat after all tweens have finished. + Set 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. + Returns the speed that has been set from editor GUI or [method set_repeat]. + Set whether the Tween uses [code]_process[/code] or [code]_fixed_process[/code] (accepts TWEEN_PROCESS_IDLE and TWEEN_PROCESS_FIXED constants, respectively). + Returns the process mode that has been set from editor GUI or [method set_tween_process_mode] + Start the tween node. You can define tweens both before and after this. @@ -38023,12 +38046,14 @@ This method controls whether the position between two cached points is interpola + Resets a tween to the initial value (the one given, not the one before the tween), given its object and property/method pair. + Resets all tweens to their initial values (the ones given, not those before the tween). @@ -38039,12 +38064,14 @@ This method controls whether the position between two cached points is interpola + Stop animating a tween, given its object and property/method pair. + Stop animating all tweens. @@ -38055,12 +38082,14 @@ This method controls whether the position between two cached points is interpola + Continue animating a stopped tween, given its object and property/method pair. + Continue animating all stopped tweens. @@ -38071,12 +38100,14 @@ This method controls whether the position between two cached points is interpola + Stop animating and completely remove a tween, given its object and property/method pair. + Stop animating and completely remove all tweens. @@ -38085,18 +38116,21 @@ This method controls whether the position between two cached points is interpola + Seek the animation to the given [code]time[/code] in seconds. + Returns the current time of the tween. + 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. @@ -38119,6 +38153,9 @@ This method controls whether the position between two cached points is interpola + Animate [code]property[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]times_in_sec[/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 begining, the end, or both). You can read more about them in the class description. @@ -38141,6 +38178,9 @@ This method controls whether the position between two cached points is interpola + Animate [code]method[/code] of [code]object[/code] from [code]initial_val[/code] to [code]final_val[/code] for [code]times_in_sec[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecuitive 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 begining, the end, or both). You can read more about them in the class description. @@ -38163,6 +38203,7 @@ This method controls whether the position between two cached points is interpola + Call [code]callback[/code] of [code]object[/code] after [code]times_in_sec[/code]. [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback. @@ -38185,6 +38226,7 @@ This method controls whether the position between two cached points is interpola + Call [code]callback[/code] of [code]object[/code] after [code]times_in_sec[/code] on the main thread (similar to [methog Object.call_deferred). [code]arg1[/code]-[code]arg5[/code] are arguments to be passed to the callback. @@ -38209,6 +38251,9 @@ This method controls whether the position between two cached points is interpola + 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]times_in_sec[/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 begining, the end, or both). You can read more about them in the class description. @@ -38233,6 +38278,9 @@ This method controls whether the position between two cached points is interpola + 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]times_in_sec[/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 begining, the end, or both). You can read more about them in the class description. @@ -38257,6 +38305,9 @@ This method controls whether the position between two cached points is interpola + 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]times_in_sec[/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 begining, the end, or both). You can read more about them in the class description. @@ -38281,6 +38332,9 @@ This method controls whether the position between two cached points is interpola + 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]times_in_sec[/code] seconds, [code]delay[/code] seconds later. Methods are animated by calling them with consecuitive 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 begining, the end, or both). You can read more about them in the class description. @@ -38291,6 +38345,7 @@ This method controls whether the position between two cached points is interpola + This signal is emitted when a tween ends. @@ -38303,6 +38358,7 @@ This method controls whether the position between two cached points is interpola + This signal is emitted each step of the tweening. @@ -38311,43 +38367,61 @@ This method controls whether the position between two cached points is interpola + This signal is emitted when a tween starts. + The [Tween] should use [code]_fixed_process[/code] for timekeeping when this is enabled. + The [Tween] should use [code]_process[/code] for timekeeping when this is enabled (default). + Means that the animation is interpolated linearly. + Means that the animation is interpolated using a sine wave. + Means that the animation is interpolated with a quinary (to the power of 5) function. + Means that the animation is interpolated with a quartic (to the power of 4) function. + Means that the animation is interpolated with a quadratic (to the power of 2) function. + Means that the animation is interpolated with a exponential (some number to the power of x) function. + Means that the animation is interpolated with elasticity, wiggling around the edges. + Means that the animation is interpolated with a cubic (to the power of 3) function. + Means that the animation is interpolated with a function using square roots. + Means that the animation is interpolated by bouncing at, but never surpassing, the end. + Means that the animation is interpolated backing out at edges. + Signifies that the interpolation should be focused in the beginning. + Signifies that the interpolation should be focused in the end. + Signifies that the interpolation should be focused in both ends. + 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).