class_tween.rst 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Tween.xml.
  6. .. _class_Tween:
  7. Tween
  8. =====
  9. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Smoothly animates a node's properties over time.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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.
  15. \ **Tween** is more suited than :ref:`AnimationPlayer<class_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 :ref:`AnimationPlayer<class_AnimationPlayer>` node.
  16. Here is a brief usage example that makes a 2D node move smoothly between two positions:
  17. ::
  18. var tween = get_node("Tween")
  19. tween.interpolate_property($Node2D, "position",
  20. Vector2(0, 0), Vector2(100, 100), 1,
  21. Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
  22. tween.start()
  23. 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. You can also provide the components of a property directly by using ``"property:component"`` (e.g. ``position:x``), where it would only apply to that particular component.
  24. Many of the methods accept ``trans_type`` and ``ease_type``. The first accepts an :ref:`TransitionType<enum_Tween_TransitionType>` constant, and refers to the way the timing of the animation is handled (see `easings.net <https://easings.net/>`__ for some examples). The second accepts an :ref:`EaseType<enum_Tween_EaseType>` constant, and controls where the ``trans_type`` 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 :ref:`TransitionType<enum_Tween_TransitionType>` constants with :ref:`EASE_IN_OUT<class_Tween_constant_EASE_IN_OUT>`, and use the one that looks best.
  25. \ `Tween easing and transition types cheatsheet <https://raw.githubusercontent.com/godotengine/godot-docs/3.6/img/tween_cheatsheet.png>`__\
  26. \ **Note:** Tween methods will return ``false`` if the requested operation cannot be completed.
  27. \ **Note:** For an alternative method of tweening, that doesn't require using nodes, see :ref:`SceneTreeTween<class_SceneTreeTween>`.
  28. .. rst-class:: classref-reftable-group
  29. Properties
  30. ----------
  31. .. table::
  32. :widths: auto
  33. +------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  34. | :ref:`TweenProcessMode<enum_Tween_TweenProcessMode>` | :ref:`playback_process_mode<class_Tween_property_playback_process_mode>` | ``1`` |
  35. +------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  36. | :ref:`float<class_float>` | :ref:`playback_speed<class_Tween_property_playback_speed>` | ``1.0`` |
  37. +------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  38. | :ref:`bool<class_bool>` | :ref:`repeat<class_Tween_property_repeat>` | ``false`` |
  39. +------------------------------------------------------+--------------------------------------------------------------------------+-----------+
  40. .. rst-class:: classref-reftable-group
  41. Methods
  42. -------
  43. .. table::
  44. :widths: auto
  45. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`bool<class_bool>` | :ref:`follow_method<class_Tween_method_follow_method>` **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` method, :ref:`Variant<class_Variant>` initial_val, :ref:`Object<class_Object>` target, :ref:`String<class_String>` target_method, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)** |
  47. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`bool<class_bool>` | :ref:`follow_property<class_Tween_method_follow_property>` **(** :ref:`Object<class_Object>` object, :ref:`NodePath<class_NodePath>` property, :ref:`Variant<class_Variant>` initial_val, :ref:`Object<class_Object>` target, :ref:`NodePath<class_NodePath>` target_property, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)** |
  49. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`float<class_float>` | :ref:`get_runtime<class_Tween_method_get_runtime>` **(** **)** |const| |
  51. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`bool<class_bool>` | :ref:`interpolate_callback<class_Tween_method_interpolate_callback>` **(** :ref:`Object<class_Object>` object, :ref:`float<class_float>` duration, :ref:`String<class_String>` callback, :ref:`Variant<class_Variant>` arg1=null, :ref:`Variant<class_Variant>` arg2=null, :ref:`Variant<class_Variant>` arg3=null, :ref:`Variant<class_Variant>` arg4=null, :ref:`Variant<class_Variant>` arg5=null, :ref:`Variant<class_Variant>` arg6=null, :ref:`Variant<class_Variant>` arg7=null, :ref:`Variant<class_Variant>` arg8=null **)** |
  53. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`bool<class_bool>` | :ref:`interpolate_deferred_callback<class_Tween_method_interpolate_deferred_callback>` **(** :ref:`Object<class_Object>` object, :ref:`float<class_float>` duration, :ref:`String<class_String>` callback, :ref:`Variant<class_Variant>` arg1=null, :ref:`Variant<class_Variant>` arg2=null, :ref:`Variant<class_Variant>` arg3=null, :ref:`Variant<class_Variant>` arg4=null, :ref:`Variant<class_Variant>` arg5=null, :ref:`Variant<class_Variant>` arg6=null, :ref:`Variant<class_Variant>` arg7=null, :ref:`Variant<class_Variant>` arg8=null **)** |
  55. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`bool<class_bool>` | :ref:`interpolate_method<class_Tween_method_interpolate_method>` **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` method, :ref:`Variant<class_Variant>` initial_val, :ref:`Variant<class_Variant>` final_val, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)** |
  57. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`bool<class_bool>` | :ref:`interpolate_property<class_Tween_method_interpolate_property>` **(** :ref:`Object<class_Object>` object, :ref:`NodePath<class_NodePath>` property, :ref:`Variant<class_Variant>` initial_val, :ref:`Variant<class_Variant>` final_val, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)** |
  59. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`bool<class_bool>` | :ref:`is_active<class_Tween_method_is_active>` **(** **)** |const| |
  61. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`bool<class_bool>` | :ref:`remove<class_Tween_method_remove>` **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` key="" **)** |
  63. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`bool<class_bool>` | :ref:`remove_all<class_Tween_method_remove_all>` **(** **)** |
  65. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`bool<class_bool>` | :ref:`reset<class_Tween_method_reset>` **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` key="" **)** |
  67. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`bool<class_bool>` | :ref:`reset_all<class_Tween_method_reset_all>` **(** **)** |
  69. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`bool<class_bool>` | :ref:`resume<class_Tween_method_resume>` **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` key="" **)** |
  71. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`bool<class_bool>` | :ref:`resume_all<class_Tween_method_resume_all>` **(** **)** |
  73. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`bool<class_bool>` | :ref:`seek<class_Tween_method_seek>` **(** :ref:`float<class_float>` time **)** |
  75. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | void | :ref:`set_active<class_Tween_method_set_active>` **(** :ref:`bool<class_bool>` active **)** |
  77. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`bool<class_bool>` | :ref:`start<class_Tween_method_start>` **(** **)** |
  79. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`bool<class_bool>` | :ref:`stop<class_Tween_method_stop>` **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` key="" **)** |
  81. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`bool<class_bool>` | :ref:`stop_all<class_Tween_method_stop_all>` **(** **)** |
  83. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`bool<class_bool>` | :ref:`targeting_method<class_Tween_method_targeting_method>` **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` method, :ref:`Object<class_Object>` initial, :ref:`String<class_String>` initial_method, :ref:`Variant<class_Variant>` final_val, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)** |
  85. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`bool<class_bool>` | :ref:`targeting_property<class_Tween_method_targeting_property>` **(** :ref:`Object<class_Object>` object, :ref:`NodePath<class_NodePath>` property, :ref:`Object<class_Object>` initial, :ref:`NodePath<class_NodePath>` initial_val, :ref:`Variant<class_Variant>` final_val, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)** |
  87. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`float<class_float>` | :ref:`tell<class_Tween_method_tell>` **(** **)** |const| |
  89. +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. .. rst-class:: classref-section-separator
  91. ----
  92. .. rst-class:: classref-descriptions-group
  93. Signals
  94. -------
  95. .. _class_Tween_signal_tween_all_completed:
  96. .. rst-class:: classref-signal
  97. **tween_all_completed** **(** **)**
  98. Emitted when all processes in a tween end.
  99. .. rst-class:: classref-item-separator
  100. ----
  101. .. _class_Tween_signal_tween_completed:
  102. .. rst-class:: classref-signal
  103. **tween_completed** **(** :ref:`Object<class_Object>` object, :ref:`NodePath<class_NodePath>` key **)**
  104. Emitted when a tween ends.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_Tween_signal_tween_started:
  108. .. rst-class:: classref-signal
  109. **tween_started** **(** :ref:`Object<class_Object>` object, :ref:`NodePath<class_NodePath>` key **)**
  110. Emitted when a tween starts.
  111. .. rst-class:: classref-item-separator
  112. ----
  113. .. _class_Tween_signal_tween_step:
  114. .. rst-class:: classref-signal
  115. **tween_step** **(** :ref:`Object<class_Object>` object, :ref:`NodePath<class_NodePath>` key, :ref:`float<class_float>` elapsed, :ref:`Object<class_Object>` value **)**
  116. Emitted at each step of the animation.
  117. .. rst-class:: classref-section-separator
  118. ----
  119. .. rst-class:: classref-descriptions-group
  120. Enumerations
  121. ------------
  122. .. _enum_Tween_TweenProcessMode:
  123. .. rst-class:: classref-enumeration
  124. enum **TweenProcessMode**:
  125. .. _class_Tween_constant_TWEEN_PROCESS_PHYSICS:
  126. .. rst-class:: classref-enumeration-constant
  127. :ref:`TweenProcessMode<enum_Tween_TweenProcessMode>` **TWEEN_PROCESS_PHYSICS** = ``0``
  128. The tween updates with the ``_physics_process`` callback.
  129. .. _class_Tween_constant_TWEEN_PROCESS_IDLE:
  130. .. rst-class:: classref-enumeration-constant
  131. :ref:`TweenProcessMode<enum_Tween_TweenProcessMode>` **TWEEN_PROCESS_IDLE** = ``1``
  132. The tween updates with the ``_process`` callback.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _enum_Tween_TransitionType:
  136. .. rst-class:: classref-enumeration
  137. enum **TransitionType**:
  138. .. _class_Tween_constant_TRANS_LINEAR:
  139. .. rst-class:: classref-enumeration-constant
  140. :ref:`TransitionType<enum_Tween_TransitionType>` **TRANS_LINEAR** = ``0``
  141. The animation is interpolated linearly.
  142. .. _class_Tween_constant_TRANS_SINE:
  143. .. rst-class:: classref-enumeration-constant
  144. :ref:`TransitionType<enum_Tween_TransitionType>` **TRANS_SINE** = ``1``
  145. The animation is interpolated using a sine function.
  146. .. _class_Tween_constant_TRANS_QUINT:
  147. .. rst-class:: classref-enumeration-constant
  148. :ref:`TransitionType<enum_Tween_TransitionType>` **TRANS_QUINT** = ``2``
  149. The animation is interpolated with a quintic (to the power of 5) function.
  150. .. _class_Tween_constant_TRANS_QUART:
  151. .. rst-class:: classref-enumeration-constant
  152. :ref:`TransitionType<enum_Tween_TransitionType>` **TRANS_QUART** = ``3``
  153. The animation is interpolated with a quartic (to the power of 4) function.
  154. .. _class_Tween_constant_TRANS_QUAD:
  155. .. rst-class:: classref-enumeration-constant
  156. :ref:`TransitionType<enum_Tween_TransitionType>` **TRANS_QUAD** = ``4``
  157. The animation is interpolated with a quadratic (to the power of 2) function.
  158. .. _class_Tween_constant_TRANS_EXPO:
  159. .. rst-class:: classref-enumeration-constant
  160. :ref:`TransitionType<enum_Tween_TransitionType>` **TRANS_EXPO** = ``5``
  161. The animation is interpolated with an exponential (to the power of x) function.
  162. .. _class_Tween_constant_TRANS_ELASTIC:
  163. .. rst-class:: classref-enumeration-constant
  164. :ref:`TransitionType<enum_Tween_TransitionType>` **TRANS_ELASTIC** = ``6``
  165. The animation is interpolated with elasticity, wiggling around the edges.
  166. .. _class_Tween_constant_TRANS_CUBIC:
  167. .. rst-class:: classref-enumeration-constant
  168. :ref:`TransitionType<enum_Tween_TransitionType>` **TRANS_CUBIC** = ``7``
  169. The animation is interpolated with a cubic (to the power of 3) function.
  170. .. _class_Tween_constant_TRANS_CIRC:
  171. .. rst-class:: classref-enumeration-constant
  172. :ref:`TransitionType<enum_Tween_TransitionType>` **TRANS_CIRC** = ``8``
  173. The animation is interpolated with a function using square roots.
  174. .. _class_Tween_constant_TRANS_BOUNCE:
  175. .. rst-class:: classref-enumeration-constant
  176. :ref:`TransitionType<enum_Tween_TransitionType>` **TRANS_BOUNCE** = ``9``
  177. The animation is interpolated by bouncing at the end.
  178. .. _class_Tween_constant_TRANS_BACK:
  179. .. rst-class:: classref-enumeration-constant
  180. :ref:`TransitionType<enum_Tween_TransitionType>` **TRANS_BACK** = ``10``
  181. The animation is interpolated backing out at ends.
  182. .. rst-class:: classref-item-separator
  183. ----
  184. .. _enum_Tween_EaseType:
  185. .. rst-class:: classref-enumeration
  186. enum **EaseType**:
  187. .. _class_Tween_constant_EASE_IN:
  188. .. rst-class:: classref-enumeration-constant
  189. :ref:`EaseType<enum_Tween_EaseType>` **EASE_IN** = ``0``
  190. The interpolation starts slowly and speeds up towards the end.
  191. .. _class_Tween_constant_EASE_OUT:
  192. .. rst-class:: classref-enumeration-constant
  193. :ref:`EaseType<enum_Tween_EaseType>` **EASE_OUT** = ``1``
  194. The interpolation starts quickly and slows down towards the end.
  195. .. _class_Tween_constant_EASE_IN_OUT:
  196. .. rst-class:: classref-enumeration-constant
  197. :ref:`EaseType<enum_Tween_EaseType>` **EASE_IN_OUT** = ``2``
  198. A combination of :ref:`EASE_IN<class_Tween_constant_EASE_IN>` and :ref:`EASE_OUT<class_Tween_constant_EASE_OUT>`. The interpolation is slowest at both ends.
  199. .. _class_Tween_constant_EASE_OUT_IN:
  200. .. rst-class:: classref-enumeration-constant
  201. :ref:`EaseType<enum_Tween_EaseType>` **EASE_OUT_IN** = ``3``
  202. A combination of :ref:`EASE_IN<class_Tween_constant_EASE_IN>` and :ref:`EASE_OUT<class_Tween_constant_EASE_OUT>`. The interpolation is fastest at both ends.
  203. .. rst-class:: classref-section-separator
  204. ----
  205. .. rst-class:: classref-descriptions-group
  206. Property Descriptions
  207. ---------------------
  208. .. _class_Tween_property_playback_process_mode:
  209. .. rst-class:: classref-property
  210. :ref:`TweenProcessMode<enum_Tween_TweenProcessMode>` **playback_process_mode** = ``1``
  211. .. rst-class:: classref-property-setget
  212. - void **set_tween_process_mode** **(** :ref:`TweenProcessMode<enum_Tween_TweenProcessMode>` value **)**
  213. - :ref:`TweenProcessMode<enum_Tween_TweenProcessMode>` **get_tween_process_mode** **(** **)**
  214. The tween's animation process thread. See :ref:`TweenProcessMode<enum_Tween_TweenProcessMode>`.
  215. .. rst-class:: classref-item-separator
  216. ----
  217. .. _class_Tween_property_playback_speed:
  218. .. rst-class:: classref-property
  219. :ref:`float<class_float>` **playback_speed** = ``1.0``
  220. .. rst-class:: classref-property-setget
  221. - void **set_speed_scale** **(** :ref:`float<class_float>` value **)**
  222. - :ref:`float<class_float>` **get_speed_scale** **(** **)**
  223. The tween's speed multiplier. For example, set it to ``1.0`` for normal speed, ``2.0`` for two times normal speed, or ``0.5`` for half of the normal speed. A value of ``0`` pauses the animation, but see also :ref:`set_active<class_Tween_method_set_active>` or :ref:`stop_all<class_Tween_method_stop_all>` for this.
  224. .. rst-class:: classref-item-separator
  225. ----
  226. .. _class_Tween_property_repeat:
  227. .. rst-class:: classref-property
  228. :ref:`bool<class_bool>` **repeat** = ``false``
  229. .. rst-class:: classref-property-setget
  230. - void **set_repeat** **(** :ref:`bool<class_bool>` value **)**
  231. - :ref:`bool<class_bool>` **is_repeat** **(** **)**
  232. If ``true``, the tween loops.
  233. .. rst-class:: classref-section-separator
  234. ----
  235. .. rst-class:: classref-descriptions-group
  236. Method Descriptions
  237. -------------------
  238. .. _class_Tween_method_follow_method:
  239. .. rst-class:: classref-method
  240. :ref:`bool<class_bool>` **follow_method** **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` method, :ref:`Variant<class_Variant>` initial_val, :ref:`Object<class_Object>` target, :ref:`String<class_String>` target_method, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)**
  241. Follows ``method`` of ``object`` and applies the returned value on ``target_method`` of ``target``, beginning from ``initial_val`` for ``duration`` seconds, ``delay`` later. Methods are called with consecutive values.
  242. Use :ref:`TransitionType<enum_Tween_TransitionType>` for ``trans_type`` and :ref:`EaseType<enum_Tween_EaseType>` for ``ease_type`` parameters. These values control the timing and direction of the interpolation. See the class description for more information.
  243. .. rst-class:: classref-item-separator
  244. ----
  245. .. _class_Tween_method_follow_property:
  246. .. rst-class:: classref-method
  247. :ref:`bool<class_bool>` **follow_property** **(** :ref:`Object<class_Object>` object, :ref:`NodePath<class_NodePath>` property, :ref:`Variant<class_Variant>` initial_val, :ref:`Object<class_Object>` target, :ref:`NodePath<class_NodePath>` target_property, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)**
  248. Follows ``property`` of ``object`` and applies it on ``target_property`` of ``target``, beginning from ``initial_val`` for ``duration`` seconds, ``delay`` seconds later.
  249. Use :ref:`TransitionType<enum_Tween_TransitionType>` for ``trans_type`` and :ref:`EaseType<enum_Tween_EaseType>` for ``ease_type`` parameters. These values control the timing and direction of the interpolation. See the class description for more information.
  250. .. rst-class:: classref-item-separator
  251. ----
  252. .. _class_Tween_method_get_runtime:
  253. .. rst-class:: classref-method
  254. :ref:`float<class_float>` **get_runtime** **(** **)** |const|
  255. 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.
  256. .. rst-class:: classref-item-separator
  257. ----
  258. .. _class_Tween_method_interpolate_callback:
  259. .. rst-class:: classref-method
  260. :ref:`bool<class_bool>` **interpolate_callback** **(** :ref:`Object<class_Object>` object, :ref:`float<class_float>` duration, :ref:`String<class_String>` callback, :ref:`Variant<class_Variant>` arg1=null, :ref:`Variant<class_Variant>` arg2=null, :ref:`Variant<class_Variant>` arg3=null, :ref:`Variant<class_Variant>` arg4=null, :ref:`Variant<class_Variant>` arg5=null, :ref:`Variant<class_Variant>` arg6=null, :ref:`Variant<class_Variant>` arg7=null, :ref:`Variant<class_Variant>` arg8=null **)**
  261. Calls ``callback`` of ``object`` after ``duration``. ``arg1``-``arg5`` are arguments to be passed to the callback.
  262. .. rst-class:: classref-item-separator
  263. ----
  264. .. _class_Tween_method_interpolate_deferred_callback:
  265. .. rst-class:: classref-method
  266. :ref:`bool<class_bool>` **interpolate_deferred_callback** **(** :ref:`Object<class_Object>` object, :ref:`float<class_float>` duration, :ref:`String<class_String>` callback, :ref:`Variant<class_Variant>` arg1=null, :ref:`Variant<class_Variant>` arg2=null, :ref:`Variant<class_Variant>` arg3=null, :ref:`Variant<class_Variant>` arg4=null, :ref:`Variant<class_Variant>` arg5=null, :ref:`Variant<class_Variant>` arg6=null, :ref:`Variant<class_Variant>` arg7=null, :ref:`Variant<class_Variant>` arg8=null **)**
  267. Calls ``callback`` of ``object`` after ``duration`` on the main thread (similar to :ref:`Object.call_deferred<class_Object_method_call_deferred>`). ``arg1``-``arg5`` are arguments to be passed to the callback.
  268. .. rst-class:: classref-item-separator
  269. ----
  270. .. _class_Tween_method_interpolate_method:
  271. .. rst-class:: classref-method
  272. :ref:`bool<class_bool>` **interpolate_method** **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` method, :ref:`Variant<class_Variant>` initial_val, :ref:`Variant<class_Variant>` final_val, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)**
  273. Animates ``method`` of ``object`` from ``initial_val`` to ``final_val`` for ``duration`` seconds, ``delay`` seconds later. Methods are called with consecutive values.
  274. Use :ref:`TransitionType<enum_Tween_TransitionType>` for ``trans_type`` and :ref:`EaseType<enum_Tween_EaseType>` for ``ease_type`` parameters. These values control the timing and direction of the interpolation. See the class description for more information.
  275. .. rst-class:: classref-item-separator
  276. ----
  277. .. _class_Tween_method_interpolate_property:
  278. .. rst-class:: classref-method
  279. :ref:`bool<class_bool>` **interpolate_property** **(** :ref:`Object<class_Object>` object, :ref:`NodePath<class_NodePath>` property, :ref:`Variant<class_Variant>` initial_val, :ref:`Variant<class_Variant>` final_val, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)**
  280. Animates ``property`` of ``object`` from ``initial_val`` to ``final_val`` for ``duration`` seconds, ``delay`` seconds later. Setting the initial value to ``null`` uses the current value of the property.
  281. Use :ref:`TransitionType<enum_Tween_TransitionType>` for ``trans_type`` and :ref:`EaseType<enum_Tween_EaseType>` for ``ease_type`` parameters. These values control the timing and direction of the interpolation. See the class description for more information.
  282. .. rst-class:: classref-item-separator
  283. ----
  284. .. _class_Tween_method_is_active:
  285. .. rst-class:: classref-method
  286. :ref:`bool<class_bool>` **is_active** **(** **)** |const|
  287. Returns ``true`` if any tweens are currently running.
  288. \ **Note:** This method doesn't consider tweens that have ended.
  289. .. rst-class:: classref-item-separator
  290. ----
  291. .. _class_Tween_method_remove:
  292. .. rst-class:: classref-method
  293. :ref:`bool<class_bool>` **remove** **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` key="" **)**
  294. Stops animation and removes a tween, given its object and property/method pair. By default, all tweens are removed, unless ``key`` is specified.
  295. .. rst-class:: classref-item-separator
  296. ----
  297. .. _class_Tween_method_remove_all:
  298. .. rst-class:: classref-method
  299. :ref:`bool<class_bool>` **remove_all** **(** **)**
  300. Stops animation and removes all tweens.
  301. .. rst-class:: classref-item-separator
  302. ----
  303. .. _class_Tween_method_reset:
  304. .. rst-class:: classref-method
  305. :ref:`bool<class_bool>` **reset** **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` key="" **)**
  306. 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 reset, unless ``key`` is specified.
  307. .. rst-class:: classref-item-separator
  308. ----
  309. .. _class_Tween_method_reset_all:
  310. .. rst-class:: classref-method
  311. :ref:`bool<class_bool>` **reset_all** **(** **)**
  312. Resets all tweens to their initial values (the ones given, not those before the tween).
  313. .. rst-class:: classref-item-separator
  314. ----
  315. .. _class_Tween_method_resume:
  316. .. rst-class:: classref-method
  317. :ref:`bool<class_bool>` **resume** **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` key="" **)**
  318. Continues animating a stopped tween, given its object and property/method pair. By default, all tweens are resumed, unless ``key`` is specified.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_Tween_method_resume_all:
  322. .. rst-class:: classref-method
  323. :ref:`bool<class_bool>` **resume_all** **(** **)**
  324. Continues animating all stopped tweens.
  325. .. rst-class:: classref-item-separator
  326. ----
  327. .. _class_Tween_method_seek:
  328. .. rst-class:: classref-method
  329. :ref:`bool<class_bool>` **seek** **(** :ref:`float<class_float>` time **)**
  330. Sets the interpolation to the given ``time`` in seconds.
  331. .. rst-class:: classref-item-separator
  332. ----
  333. .. _class_Tween_method_set_active:
  334. .. rst-class:: classref-method
  335. void **set_active** **(** :ref:`bool<class_bool>` active **)**
  336. Activates/deactivates the tween. See also :ref:`stop_all<class_Tween_method_stop_all>` and :ref:`resume_all<class_Tween_method_resume_all>`.
  337. .. rst-class:: classref-item-separator
  338. ----
  339. .. _class_Tween_method_start:
  340. .. rst-class:: classref-method
  341. :ref:`bool<class_bool>` **start** **(** **)**
  342. Starts the tween. You can define animations both before and after this.
  343. .. rst-class:: classref-item-separator
  344. ----
  345. .. _class_Tween_method_stop:
  346. .. rst-class:: classref-method
  347. :ref:`bool<class_bool>` **stop** **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` key="" **)**
  348. Stops a tween, given its object and property/method pair. By default, all tweens are stopped, unless ``key`` is specified.
  349. .. rst-class:: classref-item-separator
  350. ----
  351. .. _class_Tween_method_stop_all:
  352. .. rst-class:: classref-method
  353. :ref:`bool<class_bool>` **stop_all** **(** **)**
  354. Stops animating all tweens.
  355. .. rst-class:: classref-item-separator
  356. ----
  357. .. _class_Tween_method_targeting_method:
  358. .. rst-class:: classref-method
  359. :ref:`bool<class_bool>` **targeting_method** **(** :ref:`Object<class_Object>` object, :ref:`String<class_String>` method, :ref:`Object<class_Object>` initial, :ref:`String<class_String>` initial_method, :ref:`Variant<class_Variant>` final_val, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)**
  360. Animates ``method`` of ``object`` from the value returned by ``initial_method`` to ``final_val`` for ``duration`` seconds, ``delay`` seconds later. Methods are animated by calling them with consecutive values.
  361. Use :ref:`TransitionType<enum_Tween_TransitionType>` for ``trans_type`` and :ref:`EaseType<enum_Tween_EaseType>` for ``ease_type`` parameters. These values control the timing and direction of the interpolation. See the class description for more information.
  362. .. rst-class:: classref-item-separator
  363. ----
  364. .. _class_Tween_method_targeting_property:
  365. .. rst-class:: classref-method
  366. :ref:`bool<class_bool>` **targeting_property** **(** :ref:`Object<class_Object>` object, :ref:`NodePath<class_NodePath>` property, :ref:`Object<class_Object>` initial, :ref:`NodePath<class_NodePath>` initial_val, :ref:`Variant<class_Variant>` final_val, :ref:`float<class_float>` duration, :ref:`TransitionType<enum_Tween_TransitionType>` trans_type=0, :ref:`EaseType<enum_Tween_EaseType>` ease_type=2, :ref:`float<class_float>` delay=0 **)**
  367. Animates ``property`` of ``object`` from the current value of the ``initial_val`` property of ``initial`` to ``final_val`` for ``duration`` seconds, ``delay`` seconds later.
  368. Use :ref:`TransitionType<enum_Tween_TransitionType>` for ``trans_type`` and :ref:`EaseType<enum_Tween_EaseType>` for ``ease_type`` parameters. These values control the timing and direction of the interpolation. See the class description for more information.
  369. .. rst-class:: classref-item-separator
  370. ----
  371. .. _class_Tween_method_tell:
  372. .. rst-class:: classref-method
  373. :ref:`float<class_float>` **tell** **(** **)** |const|
  374. Returns the current time of the tween.
  375. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  376. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  377. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  378. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`