1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
|
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Tween" inherits="Node" category="Core" version="3.0.6">
<brief_description>
Smoothly animates a node's properties over time.
</brief_description>
<description>
Tweens are useful for animations requiring a numerical property to be interpolated over a range of values. The name *tween* comes from *in-betweening*, an animation technique where you specify *keyframes* and the computer interpolates the frames that appear between them.
Here is a brief usage example that causes a 2D node to move smoothly between two positions:
[codeblock]
var tween = get_node("Tween")
tween.interpolate_property($Node2D, "position",
Vector2(0, 0), Vector2(100, 100), 1,
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
tween.start()
[/codeblock]
Many methods require a property name, such as "position" above. You can find the correct property name by hovering over the property in the Inspector.
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 [enum 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>
Follows [code]method[/code] of [code]object[/code] and applies 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 called with consecutive values.
Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</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>
Follows [code]property[/code] of [code]object[/code] and applies 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.
Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</description>
</method>
<method name="get_runtime" qualifiers="const">
<return type="float">
</return>
<description>
Returns the total time needed for all tweens to end. If you have two tweens, one lasting 10 seconds 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>
Calls [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>
Calls [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>
Animates [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 called with consecutive values.
Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</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>
Animates [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.
Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</description>
</method>
<method name="is_active" qualifiers="const">
<return type="bool">
</return>
<description>
Returns [code]true[/code] if any tweens are currently running. 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>
Stops animation and removes a tween, given its object and property/method pair. By default, all tweens are removed, unless [code]key[/code] is specified.
</description>
</method>
<method name="remove_all">
<return type="bool">
</return>
<description>
Stops animation and removes 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 its initial value (the one given, not the one before the tween), given its object and property/method pair. By default, all tweens are removed, unless [code]key[/code] is specified.
</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>
Continues animating a stopped tween, given its object and property/method pair. By default, all tweens are resumed, unless [code]key[/code] is specified.
</description>
</method>
<method name="resume_all">
<return type="bool">
</return>
<description>
Continues animating all stopped tweens.
</description>
</method>
<method name="seek">
<return type="bool">
</return>
<argument index="0" name="time" type="float">
</argument>
<description>
Sets the interpolation 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>
Activates/deactivates the tween. See also [method stop_all] and [method resume_all].
</description>
</method>
<method name="start">
<return type="bool">
</return>
<description>
Starts the tween. You can define animations 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>
Stops a tween, given its object and property/method pair. By default, all tweens are stopped, unless [code]key[/code] is specified.
</description>
</method>
<method name="stop_all">
<return type="bool">
</return>
<description>
Stops 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>
Animates [code]method[/code] of [code]object[/code] from the value returned by [code]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.
Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</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>
Animates [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.
Use [enum TransitionType] for [code]trans_type[/code] and [enum EaseType] for [code]ease_type[/code] parameters. These values control the timing and direction of the interpolation. See the class description for more information
</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">
The tween's animation process thread. See [enum TweenProcessMode]. Default value: [enum TWEEN_PROCESS_IDLE].
</member>
<member name="playback_speed" type="float" setter="set_speed_scale" getter="get_speed_scale">
The tween's speed multiplier. For example, set it to [code]1.0[/code] for normal speed, [code]2.0[/code] for two times normal speed, or [code]0.5[/code] for half of the normal speed. A value of [code]0[/code] pauses the animation, but see also [method set_active] or [method stop_all] for this.
</member>
<member name="repeat" type="bool" setter="set_repeat" getter="is_repeat">
If [code]true[/code] the tween loops.
</member>
</members>
<signals>
<signal name="tween_completed">
<argument index="0" name="object" type="Object">
</argument>
<argument index="1" name="key" type="NodePath">
</argument>
<description>
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="NodePath">
</argument>
<description>
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="NodePath">
</argument>
<argument index="2" name="elapsed" type="float">
</argument>
<argument index="3" name="value" type="Object">
</argument>
<description>
Emitted at each step of the animation.
</description>
</signal>
</signals>
<constants>
<constant name="TWEEN_PROCESS_PHYSICS" value="0" enum="TweenProcessMode">
The tween updates with the [code]_physics_process[/code] callback.
</constant>
<constant name="TWEEN_PROCESS_IDLE" value="1" enum="TweenProcessMode">
The tween updates with the [code]_process[/code] callback.
</constant>
<constant name="TRANS_LINEAR" value="0" enum="TransitionType">
The animation is interpolated linearly.
</constant>
<constant name="TRANS_SINE" value="1" enum="TransitionType">
The animation is interpolated using a sine function.
</constant>
<constant name="TRANS_QUINT" value="2" enum="TransitionType">
The animation is interpolated with a quintic (to the power of 5) function.
</constant>
<constant name="TRANS_QUART" value="3" enum="TransitionType">
The animation is interpolated with a quartic (to the power of 4) function.
</constant>
<constant name="TRANS_QUAD" value="4" enum="TransitionType">
The animation is interpolated with a quadratic (to the power of 2) function.
</constant>
<constant name="TRANS_EXPO" value="5" enum="TransitionType">
The animation is interpolated with an exponential (to the power of x) function.
</constant>
<constant name="TRANS_ELASTIC" value="6" enum="TransitionType">
The animation is interpolated with elasticity, wiggling around the edges.
</constant>
<constant name="TRANS_CUBIC" value="7" enum="TransitionType">
The animation is interpolated with a cubic (to the power of 3) function.
</constant>
<constant name="TRANS_CIRC" value="8" enum="TransitionType">
The animation is interpolated with a function using square roots.
</constant>
<constant name="TRANS_BOUNCE" value="9" enum="TransitionType">
The animation is interpolated by bouncing at the end.
</constant>
<constant name="TRANS_BACK" value="10" enum="TransitionType">
The animation is interpolated backing out at ends.
</constant>
<constant name="EASE_IN" value="0" enum="EaseType">
The interpolation starts slowly and speeds up towards the end.
</constant>
<constant name="EASE_OUT" value="1" enum="EaseType">
The interpolation starts quickly and slows down towards the end.
</constant>
<constant name="EASE_IN_OUT" value="2" enum="EaseType">
A combination of EASE_IN and EASE_OUT. The interpolation is slowest at both ends.
</constant>
<constant name="EASE_OUT_IN" value="3" enum="EaseType">
A combination of EASE_IN and EASE_OUT. The interpolation is fastest at both ends.
</constant>
</constants>
</class>
|