class_animationplayer.rst 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  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/4.3/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationPlayer.xml.
  6. .. _class_AnimationPlayer:
  7. AnimationPlayer
  8. ===============
  9. **Inherits:** :ref:`AnimationMixer<class_AnimationMixer>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A node used for animation playback.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. An animation player is used for general-purpose playback of animations. It contains a dictionary of :ref:`AnimationLibrary<class_AnimationLibrary>` resources and custom blend times between animation transitions.
  15. Some methods and properties use a single key to reference an animation directly. These keys are formatted as the key for the library, followed by a forward slash, then the key for the animation within the library, for example ``"movement/run"``. If the library's key is an empty string (known as the default library), the forward slash is omitted, being the same key used by the library.
  16. \ **AnimationPlayer** is better-suited than :ref:`Tween<class_Tween>` for more complex animations, for example ones with non-trivial timings. It can also be used over :ref:`Tween<class_Tween>` if the animation track editor is more convenient than doing it in code.
  17. Updating the target properties of animations occurs at the process frame.
  18. .. rst-class:: classref-introduction-group
  19. Tutorials
  20. ---------
  21. - :doc:`2D Sprite animation <../tutorials/2d/2d_sprite_animation>`
  22. - :doc:`Animation documentation index <../tutorials/animation/index>`
  23. - `Third Person Shooter (TPS) Demo <https://godotengine.org/asset-library/asset/2710>`__
  24. .. rst-class:: classref-reftable-group
  25. Properties
  26. ----------
  27. .. table::
  28. :widths: auto
  29. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  30. | :ref:`String<class_String>` | :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>` | |
  31. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  32. | :ref:`String<class_String>` | :ref:`autoplay<class_AnimationPlayer_property_autoplay>` | ``""`` |
  33. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  34. | :ref:`String<class_String>` | :ref:`current_animation<class_AnimationPlayer_property_current_animation>` | ``""`` |
  35. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  36. | :ref:`float<class_float>` | :ref:`current_animation_length<class_AnimationPlayer_property_current_animation_length>` | |
  37. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  38. | :ref:`float<class_float>` | :ref:`current_animation_position<class_AnimationPlayer_property_current_animation_position>` | |
  39. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  40. | :ref:`bool<class_bool>` | :ref:`movie_quit_on_finish<class_AnimationPlayer_property_movie_quit_on_finish>` | ``false`` |
  41. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  42. | :ref:`bool<class_bool>` | :ref:`playback_auto_capture<class_AnimationPlayer_property_playback_auto_capture>` | ``true`` |
  43. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  44. | :ref:`float<class_float>` | :ref:`playback_auto_capture_duration<class_AnimationPlayer_property_playback_auto_capture_duration>` | ``-1.0`` |
  45. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  46. | :ref:`EaseType<enum_Tween_EaseType>` | :ref:`playback_auto_capture_ease_type<class_AnimationPlayer_property_playback_auto_capture_ease_type>` | ``0`` |
  47. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  48. | :ref:`TransitionType<enum_Tween_TransitionType>` | :ref:`playback_auto_capture_transition_type<class_AnimationPlayer_property_playback_auto_capture_transition_type>` | ``0`` |
  49. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  50. | :ref:`float<class_float>` | :ref:`playback_default_blend_time<class_AnimationPlayer_property_playback_default_blend_time>` | ``0.0`` |
  51. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  52. | :ref:`float<class_float>` | :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>` | ``1.0`` |
  53. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
  54. .. rst-class:: classref-reftable-group
  55. Methods
  56. -------
  57. .. table::
  58. :widths: auto
  59. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`StringName<class_StringName>` | :ref:`animation_get_next<class_AnimationPlayer_method_animation_get_next>`\ (\ animation_from\: :ref:`StringName<class_StringName>`\ ) |const| |
  61. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | |void| | :ref:`animation_set_next<class_AnimationPlayer_method_animation_set_next>`\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`\ ) |
  63. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | |void| | :ref:`clear_queue<class_AnimationPlayer_method_clear_queue>`\ (\ ) |
  65. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`float<class_float>` | :ref:`get_blend_time<class_AnimationPlayer_method_get_blend_time>`\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`\ ) |const| |
  67. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` | :ref:`get_method_call_mode<class_AnimationPlayer_method_get_method_call_mode>`\ (\ ) |const| |
  69. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`float<class_float>` | :ref:`get_playing_speed<class_AnimationPlayer_method_get_playing_speed>`\ (\ ) |const| |
  71. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` | :ref:`get_process_callback<class_AnimationPlayer_method_get_process_callback>`\ (\ ) |const| |
  73. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_queue<class_AnimationPlayer_method_get_queue>`\ (\ ) |
  75. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`NodePath<class_NodePath>` | :ref:`get_root<class_AnimationPlayer_method_get_root>`\ (\ ) |const| |
  77. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimationPlayer_method_is_playing>`\ (\ ) |const| |
  79. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | |void| | :ref:`pause<class_AnimationPlayer_method_pause>`\ (\ ) |
  81. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | |void| | :ref:`play<class_AnimationPlayer_method_play>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) |
  83. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | |void| | :ref:`play_backwards<class_AnimationPlayer_method_play_backwards>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1\ ) |
  85. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | |void| | :ref:`play_with_capture<class_AnimationPlayer_method_play_with_capture>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", duration\: :ref:`float<class_float>` = -1.0, custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false, trans_type\: :ref:`TransitionType<enum_Tween_TransitionType>` = 0, ease_type\: :ref:`EaseType<enum_Tween_EaseType>` = 0\ ) |
  87. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | |void| | :ref:`queue<class_AnimationPlayer_method_queue>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
  89. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | |void| | :ref:`seek<class_AnimationPlayer_method_seek>`\ (\ seconds\: :ref:`float<class_float>`, update\: :ref:`bool<class_bool>` = false, update_only\: :ref:`bool<class_bool>` = false\ ) |
  91. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | |void| | :ref:`set_blend_time<class_AnimationPlayer_method_set_blend_time>`\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`, sec\: :ref:`float<class_float>`\ ) |
  93. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | |void| | :ref:`set_method_call_mode<class_AnimationPlayer_method_set_method_call_mode>`\ (\ mode\: :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>`\ ) |
  95. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | |void| | :ref:`set_process_callback<class_AnimationPlayer_method_set_process_callback>`\ (\ mode\: :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>`\ ) |
  97. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | |void| | :ref:`set_root<class_AnimationPlayer_method_set_root>`\ (\ path\: :ref:`NodePath<class_NodePath>`\ ) |
  99. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | |void| | :ref:`stop<class_AnimationPlayer_method_stop>`\ (\ keep_state\: :ref:`bool<class_bool>` = false\ ) |
  101. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. .. rst-class:: classref-section-separator
  103. ----
  104. .. rst-class:: classref-descriptions-group
  105. Signals
  106. -------
  107. .. _class_AnimationPlayer_signal_animation_changed:
  108. .. rst-class:: classref-signal
  109. **animation_changed**\ (\ old_name\: :ref:`StringName<class_StringName>`, new_name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationPlayer_signal_animation_changed>`
  110. Emitted when a queued animation plays after the previous animation finished. See also :ref:`queue<class_AnimationPlayer_method_queue>`.
  111. \ **Note:** The signal is not emitted when the animation is changed via :ref:`play<class_AnimationPlayer_method_play>` or by an :ref:`AnimationTree<class_AnimationTree>`.
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_AnimationPlayer_signal_current_animation_changed:
  115. .. rst-class:: classref-signal
  116. **current_animation_changed**\ (\ name\: :ref:`String<class_String>`\ ) :ref:`🔗<class_AnimationPlayer_signal_current_animation_changed>`
  117. Emitted when :ref:`current_animation<class_AnimationPlayer_property_current_animation>` changes.
  118. .. rst-class:: classref-section-separator
  119. ----
  120. .. rst-class:: classref-descriptions-group
  121. Enumerations
  122. ------------
  123. .. _enum_AnimationPlayer_AnimationProcessCallback:
  124. .. rst-class:: classref-enumeration
  125. enum **AnimationProcessCallback**: :ref:`🔗<enum_AnimationPlayer_AnimationProcessCallback>`
  126. .. _class_AnimationPlayer_constant_ANIMATION_PROCESS_PHYSICS:
  127. .. rst-class:: classref-enumeration-constant
  128. :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_PHYSICS** = ``0``
  129. **Deprecated:** See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS>`.
  130. .. _class_AnimationPlayer_constant_ANIMATION_PROCESS_IDLE:
  131. .. rst-class:: classref-enumeration-constant
  132. :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_IDLE** = ``1``
  133. **Deprecated:** See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_IDLE<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_IDLE>`.
  134. .. _class_AnimationPlayer_constant_ANIMATION_PROCESS_MANUAL:
  135. .. rst-class:: classref-enumeration-constant
  136. :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_MANUAL** = ``2``
  137. **Deprecated:** See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_MANUAL<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_MANUAL>`.
  138. .. rst-class:: classref-item-separator
  139. ----
  140. .. _enum_AnimationPlayer_AnimationMethodCallMode:
  141. .. rst-class:: classref-enumeration
  142. enum **AnimationMethodCallMode**: :ref:`🔗<enum_AnimationPlayer_AnimationMethodCallMode>`
  143. .. _class_AnimationPlayer_constant_ANIMATION_METHOD_CALL_DEFERRED:
  144. .. rst-class:: classref-enumeration-constant
  145. :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **ANIMATION_METHOD_CALL_DEFERRED** = ``0``
  146. **Deprecated:** See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_METHOD_DEFERRED<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_METHOD_DEFERRED>`.
  147. .. _class_AnimationPlayer_constant_ANIMATION_METHOD_CALL_IMMEDIATE:
  148. .. rst-class:: classref-enumeration-constant
  149. :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **ANIMATION_METHOD_CALL_IMMEDIATE** = ``1``
  150. **Deprecated:** See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_METHOD_IMMEDIATE<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_METHOD_IMMEDIATE>`.
  151. .. rst-class:: classref-section-separator
  152. ----
  153. .. rst-class:: classref-descriptions-group
  154. Property Descriptions
  155. ---------------------
  156. .. _class_AnimationPlayer_property_assigned_animation:
  157. .. rst-class:: classref-property
  158. :ref:`String<class_String>` **assigned_animation** :ref:`🔗<class_AnimationPlayer_property_assigned_animation>`
  159. .. rst-class:: classref-property-setget
  160. - |void| **set_assigned_animation**\ (\ value\: :ref:`String<class_String>`\ )
  161. - :ref:`String<class_String>` **get_assigned_animation**\ (\ )
  162. If playing, the current animation's key, otherwise, the animation last played. When set, this changes the animation, but will not play it unless already playing. See also :ref:`current_animation<class_AnimationPlayer_property_current_animation>`.
  163. .. rst-class:: classref-item-separator
  164. ----
  165. .. _class_AnimationPlayer_property_autoplay:
  166. .. rst-class:: classref-property
  167. :ref:`String<class_String>` **autoplay** = ``""`` :ref:`🔗<class_AnimationPlayer_property_autoplay>`
  168. .. rst-class:: classref-property-setget
  169. - |void| **set_autoplay**\ (\ value\: :ref:`String<class_String>`\ )
  170. - :ref:`String<class_String>` **get_autoplay**\ (\ )
  171. The key of the animation to play when the scene loads.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_AnimationPlayer_property_current_animation:
  175. .. rst-class:: classref-property
  176. :ref:`String<class_String>` **current_animation** = ``""`` :ref:`🔗<class_AnimationPlayer_property_current_animation>`
  177. .. rst-class:: classref-property-setget
  178. - |void| **set_current_animation**\ (\ value\: :ref:`String<class_String>`\ )
  179. - :ref:`String<class_String>` **get_current_animation**\ (\ )
  180. The key of the currently playing animation. If no animation is playing, the property's value is an empty string. Changing this value does not restart the animation. See :ref:`play<class_AnimationPlayer_method_play>` for more information on playing animations.
  181. \ **Note:** While this property appears in the Inspector, it's not meant to be edited, and it's not saved in the scene. This property is mainly used to get the currently playing animation, and internally for animation playback tracks. For more information, see :ref:`Animation<class_Animation>`.
  182. .. rst-class:: classref-item-separator
  183. ----
  184. .. _class_AnimationPlayer_property_current_animation_length:
  185. .. rst-class:: classref-property
  186. :ref:`float<class_float>` **current_animation_length** :ref:`🔗<class_AnimationPlayer_property_current_animation_length>`
  187. .. rst-class:: classref-property-setget
  188. - :ref:`float<class_float>` **get_current_animation_length**\ (\ )
  189. The length (in seconds) of the currently playing animation.
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_AnimationPlayer_property_current_animation_position:
  193. .. rst-class:: classref-property
  194. :ref:`float<class_float>` **current_animation_position** :ref:`🔗<class_AnimationPlayer_property_current_animation_position>`
  195. .. rst-class:: classref-property-setget
  196. - :ref:`float<class_float>` **get_current_animation_position**\ (\ )
  197. The position (in seconds) of the currently playing animation.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_AnimationPlayer_property_movie_quit_on_finish:
  201. .. rst-class:: classref-property
  202. :ref:`bool<class_bool>` **movie_quit_on_finish** = ``false`` :ref:`🔗<class_AnimationPlayer_property_movie_quit_on_finish>`
  203. .. rst-class:: classref-property-setget
  204. - |void| **set_movie_quit_on_finish_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  205. - :ref:`bool<class_bool>` **is_movie_quit_on_finish_enabled**\ (\ )
  206. If ``true`` and the engine is running in Movie Maker mode (see :ref:`MovieWriter<class_MovieWriter>`), exits the engine with :ref:`SceneTree.quit<class_SceneTree_method_quit>` as soon as an animation is done playing in this **AnimationPlayer**. A message is printed when the engine quits for this reason.
  207. \ **Note:** This obeys the same logic as the :ref:`AnimationMixer.animation_finished<class_AnimationMixer_signal_animation_finished>` signal, so it will not quit the engine if the animation is set to be looping.
  208. .. rst-class:: classref-item-separator
  209. ----
  210. .. _class_AnimationPlayer_property_playback_auto_capture:
  211. .. rst-class:: classref-property
  212. :ref:`bool<class_bool>` **playback_auto_capture** = ``true`` :ref:`🔗<class_AnimationPlayer_property_playback_auto_capture>`
  213. .. rst-class:: classref-property-setget
  214. - |void| **set_auto_capture**\ (\ value\: :ref:`bool<class_bool>`\ )
  215. - :ref:`bool<class_bool>` **is_auto_capture**\ (\ )
  216. If ``true``, performs :ref:`AnimationMixer.capture<class_AnimationMixer_method_capture>` before playback automatically. This means just :ref:`play_with_capture<class_AnimationPlayer_method_play_with_capture>` is executed with default arguments instead of :ref:`play<class_AnimationPlayer_method_play>`.
  217. \ **Note:** Capture interpolation is only performed if the animation contains a capture track. See also :ref:`Animation.UPDATE_CAPTURE<class_Animation_constant_UPDATE_CAPTURE>`.
  218. .. rst-class:: classref-item-separator
  219. ----
  220. .. _class_AnimationPlayer_property_playback_auto_capture_duration:
  221. .. rst-class:: classref-property
  222. :ref:`float<class_float>` **playback_auto_capture_duration** = ``-1.0`` :ref:`🔗<class_AnimationPlayer_property_playback_auto_capture_duration>`
  223. .. rst-class:: classref-property-setget
  224. - |void| **set_auto_capture_duration**\ (\ value\: :ref:`float<class_float>`\ )
  225. - :ref:`float<class_float>` **get_auto_capture_duration**\ (\ )
  226. See also :ref:`play_with_capture<class_AnimationPlayer_method_play_with_capture>` and :ref:`AnimationMixer.capture<class_AnimationMixer_method_capture>`.
  227. If :ref:`playback_auto_capture_duration<class_AnimationPlayer_property_playback_auto_capture_duration>` is negative value, the duration is set to the interval between the current position and the first key.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_AnimationPlayer_property_playback_auto_capture_ease_type:
  231. .. rst-class:: classref-property
  232. :ref:`EaseType<enum_Tween_EaseType>` **playback_auto_capture_ease_type** = ``0`` :ref:`🔗<class_AnimationPlayer_property_playback_auto_capture_ease_type>`
  233. .. rst-class:: classref-property-setget
  234. - |void| **set_auto_capture_ease_type**\ (\ value\: :ref:`EaseType<enum_Tween_EaseType>`\ )
  235. - :ref:`EaseType<enum_Tween_EaseType>` **get_auto_capture_ease_type**\ (\ )
  236. The ease type of the capture interpolation. See also :ref:`EaseType<enum_Tween_EaseType>`.
  237. .. rst-class:: classref-item-separator
  238. ----
  239. .. _class_AnimationPlayer_property_playback_auto_capture_transition_type:
  240. .. rst-class:: classref-property
  241. :ref:`TransitionType<enum_Tween_TransitionType>` **playback_auto_capture_transition_type** = ``0`` :ref:`🔗<class_AnimationPlayer_property_playback_auto_capture_transition_type>`
  242. .. rst-class:: classref-property-setget
  243. - |void| **set_auto_capture_transition_type**\ (\ value\: :ref:`TransitionType<enum_Tween_TransitionType>`\ )
  244. - :ref:`TransitionType<enum_Tween_TransitionType>` **get_auto_capture_transition_type**\ (\ )
  245. The transition type of the capture interpolation. See also :ref:`TransitionType<enum_Tween_TransitionType>`.
  246. .. rst-class:: classref-item-separator
  247. ----
  248. .. _class_AnimationPlayer_property_playback_default_blend_time:
  249. .. rst-class:: classref-property
  250. :ref:`float<class_float>` **playback_default_blend_time** = ``0.0`` :ref:`🔗<class_AnimationPlayer_property_playback_default_blend_time>`
  251. .. rst-class:: classref-property-setget
  252. - |void| **set_default_blend_time**\ (\ value\: :ref:`float<class_float>`\ )
  253. - :ref:`float<class_float>` **get_default_blend_time**\ (\ )
  254. The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision.
  255. .. rst-class:: classref-item-separator
  256. ----
  257. .. _class_AnimationPlayer_property_speed_scale:
  258. .. rst-class:: classref-property
  259. :ref:`float<class_float>` **speed_scale** = ``1.0`` :ref:`🔗<class_AnimationPlayer_property_speed_scale>`
  260. .. rst-class:: classref-property-setget
  261. - |void| **set_speed_scale**\ (\ value\: :ref:`float<class_float>`\ )
  262. - :ref:`float<class_float>` **get_speed_scale**\ (\ )
  263. The speed scaling ratio. For example, if this value is ``1``, then the animation plays at normal speed. If it's ``0.5``, then it plays at half speed. If it's ``2``, then it plays at double speed.
  264. If set to a negative value, the animation is played in reverse. If set to ``0``, the animation will not advance.
  265. .. rst-class:: classref-section-separator
  266. ----
  267. .. rst-class:: classref-descriptions-group
  268. Method Descriptions
  269. -------------------
  270. .. _class_AnimationPlayer_method_animation_get_next:
  271. .. rst-class:: classref-method
  272. :ref:`StringName<class_StringName>` **animation_get_next**\ (\ animation_from\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_AnimationPlayer_method_animation_get_next>`
  273. Returns the key of the animation which is queued to play after the ``animation_from`` animation.
  274. .. rst-class:: classref-item-separator
  275. ----
  276. .. _class_AnimationPlayer_method_animation_set_next:
  277. .. rst-class:: classref-method
  278. |void| **animation_set_next**\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationPlayer_method_animation_set_next>`
  279. Triggers the ``animation_to`` animation when the ``animation_from`` animation completes.
  280. .. rst-class:: classref-item-separator
  281. ----
  282. .. _class_AnimationPlayer_method_clear_queue:
  283. .. rst-class:: classref-method
  284. |void| **clear_queue**\ (\ ) :ref:`🔗<class_AnimationPlayer_method_clear_queue>`
  285. Clears all queued, unplayed animations.
  286. .. rst-class:: classref-item-separator
  287. ----
  288. .. _class_AnimationPlayer_method_get_blend_time:
  289. .. rst-class:: classref-method
  290. :ref:`float<class_float>` **get_blend_time**\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_blend_time>`
  291. Returns the blend time (in seconds) between two animations, referenced by their keys.
  292. .. rst-class:: classref-item-separator
  293. ----
  294. .. _class_AnimationPlayer_method_get_method_call_mode:
  295. .. rst-class:: classref-method
  296. :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **get_method_call_mode**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_method_call_mode>`
  297. **Deprecated:** Use :ref:`AnimationMixer.callback_mode_method<class_AnimationMixer_property_callback_mode_method>` instead.
  298. Returns the call mode used for "Call Method" tracks.
  299. .. rst-class:: classref-item-separator
  300. ----
  301. .. _class_AnimationPlayer_method_get_playing_speed:
  302. .. rst-class:: classref-method
  303. :ref:`float<class_float>` **get_playing_speed**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_playing_speed>`
  304. Returns the actual playing speed of current animation or ``0`` if not playing. This speed is the :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>` property multiplied by ``custom_speed`` argument specified when calling the :ref:`play<class_AnimationPlayer_method_play>` method.
  305. Returns a negative value if the current animation is playing backwards.
  306. .. rst-class:: classref-item-separator
  307. ----
  308. .. _class_AnimationPlayer_method_get_process_callback:
  309. .. rst-class:: classref-method
  310. :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **get_process_callback**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_process_callback>`
  311. **Deprecated:** Use :ref:`AnimationMixer.callback_mode_process<class_AnimationMixer_property_callback_mode_process>` instead.
  312. Returns the process notification in which to update animations.
  313. .. rst-class:: classref-item-separator
  314. ----
  315. .. _class_AnimationPlayer_method_get_queue:
  316. .. rst-class:: classref-method
  317. :ref:`PackedStringArray<class_PackedStringArray>` **get_queue**\ (\ ) :ref:`🔗<class_AnimationPlayer_method_get_queue>`
  318. Returns a list of the animation keys that are currently queued to play.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_AnimationPlayer_method_get_root:
  322. .. rst-class:: classref-method
  323. :ref:`NodePath<class_NodePath>` **get_root**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_root>`
  324. **Deprecated:** Use :ref:`AnimationMixer.root_node<class_AnimationMixer_property_root_node>` instead.
  325. Returns the node which node path references will travel from.
  326. .. rst-class:: classref-item-separator
  327. ----
  328. .. _class_AnimationPlayer_method_is_playing:
  329. .. rst-class:: classref-method
  330. :ref:`bool<class_bool>` **is_playing**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_is_playing>`
  331. Returns ``true`` if an animation is currently playing (even if :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>` and/or ``custom_speed`` are ``0``).
  332. .. rst-class:: classref-item-separator
  333. ----
  334. .. _class_AnimationPlayer_method_pause:
  335. .. rst-class:: classref-method
  336. |void| **pause**\ (\ ) :ref:`🔗<class_AnimationPlayer_method_pause>`
  337. Pauses the currently playing animation. The :ref:`current_animation_position<class_AnimationPlayer_property_current_animation_position>` will be kept and calling :ref:`play<class_AnimationPlayer_method_play>` or :ref:`play_backwards<class_AnimationPlayer_method_play_backwards>` without arguments or with the same animation name as :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>` will resume the animation.
  338. See also :ref:`stop<class_AnimationPlayer_method_stop>`.
  339. .. rst-class:: classref-item-separator
  340. ----
  341. .. _class_AnimationPlayer_method_play:
  342. .. rst-class:: classref-method
  343. |void| **play**\ (\ name\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AnimationPlayer_method_play>`
  344. Plays the animation with key ``name``. Custom blend times and speed can be set.
  345. The ``from_end`` option only affects when switching to a new animation track, or if the same track but at the start or end. It does not affect resuming playback that was paused in the middle of an animation. If ``custom_speed`` is negative and ``from_end`` is ``true``, the animation will play backwards (which is equivalent to calling :ref:`play_backwards<class_AnimationPlayer_method_play_backwards>`).
  346. The **AnimationPlayer** keeps track of its current or last played animation with :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>`. If this method is called with that same animation ``name``, or with no ``name`` parameter, the assigned animation will resume playing if it was paused.
  347. \ **Note:** The animation will be updated the next time the **AnimationPlayer** is processed. If other variables are updated at the same time this is called, they may be updated too early. To perform the update immediately, call ``advance(0)``.
  348. .. rst-class:: classref-item-separator
  349. ----
  350. .. _class_AnimationPlayer_method_play_backwards:
  351. .. rst-class:: classref-method
  352. |void| **play_backwards**\ (\ name\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1\ ) :ref:`🔗<class_AnimationPlayer_method_play_backwards>`
  353. Plays the animation with key ``name`` in reverse.
  354. This method is a shorthand for :ref:`play<class_AnimationPlayer_method_play>` with ``custom_speed = -1.0`` and ``from_end = true``, so see its description for more information.
  355. .. rst-class:: classref-item-separator
  356. ----
  357. .. _class_AnimationPlayer_method_play_with_capture:
  358. .. rst-class:: classref-method
  359. |void| **play_with_capture**\ (\ name\: :ref:`StringName<class_StringName>` = &"", duration\: :ref:`float<class_float>` = -1.0, custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false, trans_type\: :ref:`TransitionType<enum_Tween_TransitionType>` = 0, ease_type\: :ref:`EaseType<enum_Tween_EaseType>` = 0\ ) :ref:`🔗<class_AnimationPlayer_method_play_with_capture>`
  360. See also :ref:`AnimationMixer.capture<class_AnimationMixer_method_capture>`.
  361. You can use this method to use more detailed options for capture than those performed by :ref:`playback_auto_capture<class_AnimationPlayer_property_playback_auto_capture>`. When :ref:`playback_auto_capture<class_AnimationPlayer_property_playback_auto_capture>` is ``false``, this method is almost the same as the following:
  362. ::
  363. capture(name, duration, trans_type, ease_type)
  364. play(name, custom_blend, custom_speed, from_end)
  365. If ``name`` is blank, it specifies :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>`.
  366. If ``duration`` is a negative value, the duration is set to the interval between the current position and the first key, when ``from_end`` is ``true``, uses the interval between the current position and the last key instead.
  367. \ **Note:** The ``duration`` takes :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>` into account, but ``custom_speed`` does not, because the capture cache is interpolated with the blend result and the result may contain multiple animations.
  368. .. rst-class:: classref-item-separator
  369. ----
  370. .. _class_AnimationPlayer_method_queue:
  371. .. rst-class:: classref-method
  372. |void| **queue**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationPlayer_method_queue>`
  373. Queues an animation for playback once the current animation and all previously queued animations are done.
  374. \ **Note:** If a looped animation is currently playing, the queued animation will never play unless the looped animation is stopped somehow.
  375. .. rst-class:: classref-item-separator
  376. ----
  377. .. _class_AnimationPlayer_method_seek:
  378. .. rst-class:: classref-method
  379. |void| **seek**\ (\ seconds\: :ref:`float<class_float>`, update\: :ref:`bool<class_bool>` = false, update_only\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AnimationPlayer_method_seek>`
  380. Seeks the animation to the ``seconds`` point in time (in seconds). If ``update`` is ``true``, the animation updates too, otherwise it updates at process time. Events between the current frame and ``seconds`` are skipped.
  381. If ``update_only`` is ``true``, the method / audio / animation playback tracks will not be processed.
  382. \ **Note:** Seeking to the end of the animation doesn't emit :ref:`AnimationMixer.animation_finished<class_AnimationMixer_signal_animation_finished>`. If you want to skip animation and emit the signal, use :ref:`AnimationMixer.advance<class_AnimationMixer_method_advance>`.
  383. .. rst-class:: classref-item-separator
  384. ----
  385. .. _class_AnimationPlayer_method_set_blend_time:
  386. .. rst-class:: classref-method
  387. |void| **set_blend_time**\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`, sec\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AnimationPlayer_method_set_blend_time>`
  388. Specifies a blend time (in seconds) between two animations, referenced by their keys.
  389. .. rst-class:: classref-item-separator
  390. ----
  391. .. _class_AnimationPlayer_method_set_method_call_mode:
  392. .. rst-class:: classref-method
  393. |void| **set_method_call_mode**\ (\ mode\: :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>`\ ) :ref:`🔗<class_AnimationPlayer_method_set_method_call_mode>`
  394. **Deprecated:** Use :ref:`AnimationMixer.callback_mode_method<class_AnimationMixer_property_callback_mode_method>` instead.
  395. Sets the call mode used for "Call Method" tracks.
  396. .. rst-class:: classref-item-separator
  397. ----
  398. .. _class_AnimationPlayer_method_set_process_callback:
  399. .. rst-class:: classref-method
  400. |void| **set_process_callback**\ (\ mode\: :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>`\ ) :ref:`🔗<class_AnimationPlayer_method_set_process_callback>`
  401. **Deprecated:** Use :ref:`AnimationMixer.callback_mode_process<class_AnimationMixer_property_callback_mode_process>` instead.
  402. Sets the process notification in which to update animations.
  403. .. rst-class:: classref-item-separator
  404. ----
  405. .. _class_AnimationPlayer_method_set_root:
  406. .. rst-class:: classref-method
  407. |void| **set_root**\ (\ path\: :ref:`NodePath<class_NodePath>`\ ) :ref:`🔗<class_AnimationPlayer_method_set_root>`
  408. **Deprecated:** Use :ref:`AnimationMixer.root_node<class_AnimationMixer_property_root_node>` instead.
  409. Sets the node which node path references will travel from.
  410. .. rst-class:: classref-item-separator
  411. ----
  412. .. _class_AnimationPlayer_method_stop:
  413. .. rst-class:: classref-method
  414. |void| **stop**\ (\ keep_state\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AnimationPlayer_method_stop>`
  415. Stops the currently playing animation. The animation position is reset to ``0`` and the ``custom_speed`` is reset to ``1.0``. See also :ref:`pause<class_AnimationPlayer_method_pause>`.
  416. If ``keep_state`` is ``true``, the animation state is not updated visually.
  417. \ **Note:** The method / audio / animation playback tracks will not be processed by this method.
  418. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  419. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  420. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  421. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  422. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  423. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  424. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  425. .. |void| replace:: :abbr:`void (No return value.)`