class_animationplayer.rst 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  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.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/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 Demo <https://godotengine.org/asset-library/asset/678>`__
  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:`float<class_float>` | :ref:`playback_default_blend_time<class_AnimationPlayer_property_playback_default_blend_time>` | ``0.0`` |
  43. +-----------------------------+------------------------------------------------------------------------------------------------+-----------+
  44. | :ref:`float<class_float>` | :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>` | ``1.0`` |
  45. +-----------------------------+------------------------------------------------------------------------------------------------+-----------+
  46. .. rst-class:: classref-reftable-group
  47. Methods
  48. -------
  49. .. table::
  50. :widths: auto
  51. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`StringName<class_StringName>` | :ref:`animation_get_next<class_AnimationPlayer_method_animation_get_next>` **(** :ref:`StringName<class_StringName>` animation_from **)** |const| |
  53. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`animation_set_next<class_AnimationPlayer_method_animation_set_next>` **(** :ref:`StringName<class_StringName>` animation_from, :ref:`StringName<class_StringName>` animation_to **)** |
  55. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`clear_queue<class_AnimationPlayer_method_clear_queue>` **(** **)** |
  57. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`float<class_float>` | :ref:`get_blend_time<class_AnimationPlayer_method_get_blend_time>` **(** :ref:`StringName<class_StringName>` animation_from, :ref:`StringName<class_StringName>` animation_to **)** |const| |
  59. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` | :ref:`get_method_call_mode<class_AnimationPlayer_method_get_method_call_mode>` **(** **)** |const| |
  61. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`float<class_float>` | :ref:`get_playing_speed<class_AnimationPlayer_method_get_playing_speed>` **(** **)** |const| |
  63. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` | :ref:`get_process_callback<class_AnimationPlayer_method_get_process_callback>` **(** **)** |const| |
  65. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_queue<class_AnimationPlayer_method_get_queue>` **(** **)** |
  67. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`NodePath<class_NodePath>` | :ref:`get_root<class_AnimationPlayer_method_get_root>` **(** **)** |const| |
  69. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimationPlayer_method_is_playing>` **(** **)** |const| |
  71. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | void | :ref:`pause<class_AnimationPlayer_method_pause>` **(** **)** |
  73. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | void | :ref:`play<class_AnimationPlayer_method_play>` **(** :ref:`StringName<class_StringName>` name="", :ref:`float<class_float>` custom_blend=-1, :ref:`float<class_float>` custom_speed=1.0, :ref:`bool<class_bool>` from_end=false **)** |
  75. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | void | :ref:`play_backwards<class_AnimationPlayer_method_play_backwards>` **(** :ref:`StringName<class_StringName>` name="", :ref:`float<class_float>` custom_blend=-1 **)** |
  77. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | void | :ref:`queue<class_AnimationPlayer_method_queue>` **(** :ref:`StringName<class_StringName>` name **)** |
  79. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | void | :ref:`seek<class_AnimationPlayer_method_seek>` **(** :ref:`float<class_float>` seconds, :ref:`bool<class_bool>` update=false, :ref:`bool<class_bool>` update_only=false **)** |
  81. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | void | :ref:`set_blend_time<class_AnimationPlayer_method_set_blend_time>` **(** :ref:`StringName<class_StringName>` animation_from, :ref:`StringName<class_StringName>` animation_to, :ref:`float<class_float>` sec **)** |
  83. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | void | :ref:`set_method_call_mode<class_AnimationPlayer_method_set_method_call_mode>` **(** :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` mode **)** |
  85. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`set_process_callback<class_AnimationPlayer_method_set_process_callback>` **(** :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` mode **)** |
  87. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | void | :ref:`set_root<class_AnimationPlayer_method_set_root>` **(** :ref:`NodePath<class_NodePath>` path **)** |
  89. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | void | :ref:`stop<class_AnimationPlayer_method_stop>` **(** :ref:`bool<class_bool>` keep_state=false **)** |
  91. +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. .. rst-class:: classref-section-separator
  93. ----
  94. .. rst-class:: classref-descriptions-group
  95. Signals
  96. -------
  97. .. _class_AnimationPlayer_signal_animation_changed:
  98. .. rst-class:: classref-signal
  99. **animation_changed** **(** :ref:`StringName<class_StringName>` old_name, :ref:`StringName<class_StringName>` new_name **)**
  100. Emitted when a queued animation plays after the previous animation finished. See also :ref:`queue<class_AnimationPlayer_method_queue>`.
  101. \ **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>`.
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _class_AnimationPlayer_signal_current_animation_changed:
  105. .. rst-class:: classref-signal
  106. **current_animation_changed** **(** :ref:`String<class_String>` name **)**
  107. Emitted when :ref:`current_animation<class_AnimationPlayer_property_current_animation>` changes.
  108. .. rst-class:: classref-section-separator
  109. ----
  110. .. rst-class:: classref-descriptions-group
  111. Enumerations
  112. ------------
  113. .. _enum_AnimationPlayer_AnimationProcessCallback:
  114. .. rst-class:: classref-enumeration
  115. enum **AnimationProcessCallback**:
  116. .. _class_AnimationPlayer_constant_ANIMATION_PROCESS_PHYSICS:
  117. .. rst-class:: classref-enumeration-constant
  118. :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_PHYSICS** = ``0``
  119. For backward compatibility. See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS>`.
  120. .. _class_AnimationPlayer_constant_ANIMATION_PROCESS_IDLE:
  121. .. rst-class:: classref-enumeration-constant
  122. :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_IDLE** = ``1``
  123. For backward compatibility. See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_IDLE<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_IDLE>`.
  124. .. _class_AnimationPlayer_constant_ANIMATION_PROCESS_MANUAL:
  125. .. rst-class:: classref-enumeration-constant
  126. :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_MANUAL** = ``2``
  127. For backward compatibility. See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_MANUAL<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_MANUAL>`.
  128. .. rst-class:: classref-item-separator
  129. ----
  130. .. _enum_AnimationPlayer_AnimationMethodCallMode:
  131. .. rst-class:: classref-enumeration
  132. enum **AnimationMethodCallMode**:
  133. .. _class_AnimationPlayer_constant_ANIMATION_METHOD_CALL_DEFERRED:
  134. .. rst-class:: classref-enumeration-constant
  135. :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **ANIMATION_METHOD_CALL_DEFERRED** = ``0``
  136. For backward compatibility. See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_METHOD_DEFERRED<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_METHOD_DEFERRED>`.
  137. .. _class_AnimationPlayer_constant_ANIMATION_METHOD_CALL_IMMEDIATE:
  138. .. rst-class:: classref-enumeration-constant
  139. :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **ANIMATION_METHOD_CALL_IMMEDIATE** = ``1``
  140. For backward compatibility. See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_METHOD_IMMEDIATE<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_METHOD_IMMEDIATE>`.
  141. .. rst-class:: classref-section-separator
  142. ----
  143. .. rst-class:: classref-descriptions-group
  144. Property Descriptions
  145. ---------------------
  146. .. _class_AnimationPlayer_property_assigned_animation:
  147. .. rst-class:: classref-property
  148. :ref:`String<class_String>` **assigned_animation**
  149. .. rst-class:: classref-property-setget
  150. - void **set_assigned_animation** **(** :ref:`String<class_String>` value **)**
  151. - :ref:`String<class_String>` **get_assigned_animation** **(** **)**
  152. 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>`.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_AnimationPlayer_property_autoplay:
  156. .. rst-class:: classref-property
  157. :ref:`String<class_String>` **autoplay** = ``""``
  158. .. rst-class:: classref-property-setget
  159. - void **set_autoplay** **(** :ref:`String<class_String>` value **)**
  160. - :ref:`String<class_String>` **get_autoplay** **(** **)**
  161. The key of the animation to play when the scene loads.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_AnimationPlayer_property_current_animation:
  165. .. rst-class:: classref-property
  166. :ref:`String<class_String>` **current_animation** = ``""``
  167. .. rst-class:: classref-property-setget
  168. - void **set_current_animation** **(** :ref:`String<class_String>` value **)**
  169. - :ref:`String<class_String>` **get_current_animation** **(** **)**
  170. 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.
  171. \ **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>`.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_AnimationPlayer_property_current_animation_length:
  175. .. rst-class:: classref-property
  176. :ref:`float<class_float>` **current_animation_length**
  177. .. rst-class:: classref-property-setget
  178. - :ref:`float<class_float>` **get_current_animation_length** **(** **)**
  179. The length (in seconds) of the currently playing animation.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_AnimationPlayer_property_current_animation_position:
  183. .. rst-class:: classref-property
  184. :ref:`float<class_float>` **current_animation_position**
  185. .. rst-class:: classref-property-setget
  186. - :ref:`float<class_float>` **get_current_animation_position** **(** **)**
  187. The position (in seconds) of the currently playing animation.
  188. .. rst-class:: classref-item-separator
  189. ----
  190. .. _class_AnimationPlayer_property_movie_quit_on_finish:
  191. .. rst-class:: classref-property
  192. :ref:`bool<class_bool>` **movie_quit_on_finish** = ``false``
  193. .. rst-class:: classref-property-setget
  194. - void **set_movie_quit_on_finish_enabled** **(** :ref:`bool<class_bool>` value **)**
  195. - :ref:`bool<class_bool>` **is_movie_quit_on_finish_enabled** **(** **)**
  196. 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.
  197. \ **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.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_AnimationPlayer_property_playback_default_blend_time:
  201. .. rst-class:: classref-property
  202. :ref:`float<class_float>` **playback_default_blend_time** = ``0.0``
  203. .. rst-class:: classref-property-setget
  204. - void **set_default_blend_time** **(** :ref:`float<class_float>` value **)**
  205. - :ref:`float<class_float>` **get_default_blend_time** **(** **)**
  206. The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision.
  207. .. rst-class:: classref-item-separator
  208. ----
  209. .. _class_AnimationPlayer_property_speed_scale:
  210. .. rst-class:: classref-property
  211. :ref:`float<class_float>` **speed_scale** = ``1.0``
  212. .. rst-class:: classref-property-setget
  213. - void **set_speed_scale** **(** :ref:`float<class_float>` value **)**
  214. - :ref:`float<class_float>` **get_speed_scale** **(** **)**
  215. 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.
  216. If set to a negative value, the animation is played in reverse. If set to ``0``, the animation will not advance.
  217. .. rst-class:: classref-section-separator
  218. ----
  219. .. rst-class:: classref-descriptions-group
  220. Method Descriptions
  221. -------------------
  222. .. _class_AnimationPlayer_method_animation_get_next:
  223. .. rst-class:: classref-method
  224. :ref:`StringName<class_StringName>` **animation_get_next** **(** :ref:`StringName<class_StringName>` animation_from **)** |const|
  225. Returns the key of the animation which is queued to play after the ``animation_from`` animation.
  226. .. rst-class:: classref-item-separator
  227. ----
  228. .. _class_AnimationPlayer_method_animation_set_next:
  229. .. rst-class:: classref-method
  230. void **animation_set_next** **(** :ref:`StringName<class_StringName>` animation_from, :ref:`StringName<class_StringName>` animation_to **)**
  231. Triggers the ``animation_to`` animation when the ``animation_from`` animation completes.
  232. .. rst-class:: classref-item-separator
  233. ----
  234. .. _class_AnimationPlayer_method_clear_queue:
  235. .. rst-class:: classref-method
  236. void **clear_queue** **(** **)**
  237. Clears all queued, unplayed animations.
  238. .. rst-class:: classref-item-separator
  239. ----
  240. .. _class_AnimationPlayer_method_get_blend_time:
  241. .. rst-class:: classref-method
  242. :ref:`float<class_float>` **get_blend_time** **(** :ref:`StringName<class_StringName>` animation_from, :ref:`StringName<class_StringName>` animation_to **)** |const|
  243. Returns the blend time (in seconds) between two animations, referenced by their keys.
  244. .. rst-class:: classref-item-separator
  245. ----
  246. .. _class_AnimationPlayer_method_get_method_call_mode:
  247. .. rst-class:: classref-method
  248. :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **get_method_call_mode** **(** **)** |const|
  249. For backward compatibility. See :ref:`AnimationCallbackModeMethod<enum_AnimationMixer_AnimationCallbackModeMethod>`.
  250. .. rst-class:: classref-item-separator
  251. ----
  252. .. _class_AnimationPlayer_method_get_playing_speed:
  253. .. rst-class:: classref-method
  254. :ref:`float<class_float>` **get_playing_speed** **(** **)** |const|
  255. 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.
  256. Returns a negative value if the current animation is playing backwards.
  257. .. rst-class:: classref-item-separator
  258. ----
  259. .. _class_AnimationPlayer_method_get_process_callback:
  260. .. rst-class:: classref-method
  261. :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **get_process_callback** **(** **)** |const|
  262. For backward compatibility. See :ref:`AnimationCallbackModeProcess<enum_AnimationMixer_AnimationCallbackModeProcess>`.
  263. .. rst-class:: classref-item-separator
  264. ----
  265. .. _class_AnimationPlayer_method_get_queue:
  266. .. rst-class:: classref-method
  267. :ref:`PackedStringArray<class_PackedStringArray>` **get_queue** **(** **)**
  268. Returns a list of the animation keys that are currently queued to play.
  269. .. rst-class:: classref-item-separator
  270. ----
  271. .. _class_AnimationPlayer_method_get_root:
  272. .. rst-class:: classref-method
  273. :ref:`NodePath<class_NodePath>` **get_root** **(** **)** |const|
  274. For backward compatibility. See :ref:`AnimationMixer.root_node<class_AnimationMixer_property_root_node>`.
  275. .. rst-class:: classref-item-separator
  276. ----
  277. .. _class_AnimationPlayer_method_is_playing:
  278. .. rst-class:: classref-method
  279. :ref:`bool<class_bool>` **is_playing** **(** **)** |const|
  280. Returns ``true`` if an animation is currently playing (even if :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>` and/or ``custom_speed`` are ``0``).
  281. .. rst-class:: classref-item-separator
  282. ----
  283. .. _class_AnimationPlayer_method_pause:
  284. .. rst-class:: classref-method
  285. void **pause** **(** **)**
  286. 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.
  287. See also :ref:`stop<class_AnimationPlayer_method_stop>`.
  288. .. rst-class:: classref-item-separator
  289. ----
  290. .. _class_AnimationPlayer_method_play:
  291. .. rst-class:: classref-method
  292. void **play** **(** :ref:`StringName<class_StringName>` name="", :ref:`float<class_float>` custom_blend=-1, :ref:`float<class_float>` custom_speed=1.0, :ref:`bool<class_bool>` from_end=false **)**
  293. Plays the animation with key ``name``. Custom blend times and speed can be set.
  294. 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>`).
  295. 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.
  296. \ **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)``.
  297. .. rst-class:: classref-item-separator
  298. ----
  299. .. _class_AnimationPlayer_method_play_backwards:
  300. .. rst-class:: classref-method
  301. void **play_backwards** **(** :ref:`StringName<class_StringName>` name="", :ref:`float<class_float>` custom_blend=-1 **)**
  302. Plays the animation with key ``name`` in reverse.
  303. 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.
  304. .. rst-class:: classref-item-separator
  305. ----
  306. .. _class_AnimationPlayer_method_queue:
  307. .. rst-class:: classref-method
  308. void **queue** **(** :ref:`StringName<class_StringName>` name **)**
  309. Queues an animation for playback once the current one is done.
  310. \ **Note:** If a looped animation is currently playing, the queued animation will never play unless the looped animation is stopped somehow.
  311. .. rst-class:: classref-item-separator
  312. ----
  313. .. _class_AnimationPlayer_method_seek:
  314. .. rst-class:: classref-method
  315. void **seek** **(** :ref:`float<class_float>` seconds, :ref:`bool<class_bool>` update=false, :ref:`bool<class_bool>` update_only=false **)**
  316. 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.
  317. If ``update_only`` is true, the method / audio / animation playback tracks will not be processed.
  318. \ **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>`.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_AnimationPlayer_method_set_blend_time:
  322. .. rst-class:: classref-method
  323. void **set_blend_time** **(** :ref:`StringName<class_StringName>` animation_from, :ref:`StringName<class_StringName>` animation_to, :ref:`float<class_float>` sec **)**
  324. Specifies a blend time (in seconds) between two animations, referenced by their keys.
  325. .. rst-class:: classref-item-separator
  326. ----
  327. .. _class_AnimationPlayer_method_set_method_call_mode:
  328. .. rst-class:: classref-method
  329. void **set_method_call_mode** **(** :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` mode **)**
  330. For backward compatibility. See :ref:`AnimationCallbackModeMethod<enum_AnimationMixer_AnimationCallbackModeMethod>`.
  331. .. rst-class:: classref-item-separator
  332. ----
  333. .. _class_AnimationPlayer_method_set_process_callback:
  334. .. rst-class:: classref-method
  335. void **set_process_callback** **(** :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` mode **)**
  336. For backward compatibility. See :ref:`AnimationCallbackModeProcess<enum_AnimationMixer_AnimationCallbackModeProcess>`.
  337. .. rst-class:: classref-item-separator
  338. ----
  339. .. _class_AnimationPlayer_method_set_root:
  340. .. rst-class:: classref-method
  341. void **set_root** **(** :ref:`NodePath<class_NodePath>` path **)**
  342. For backward compatibility. See :ref:`AnimationMixer.root_node<class_AnimationMixer_property_root_node>`.
  343. .. rst-class:: classref-item-separator
  344. ----
  345. .. _class_AnimationPlayer_method_stop:
  346. .. rst-class:: classref-method
  347. void **stop** **(** :ref:`bool<class_bool>` keep_state=false **)**
  348. 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>`.
  349. If ``keep_state`` is ``true``, the animation state is not updated visually.
  350. \ **Note:** The method / audio / animation playback tracks will not be processed by this method.
  351. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  352. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  353. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  354. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  355. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  356. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  357. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`