123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/AnimationPlayer.xml.
- .. _class_AnimationPlayer:
- AnimationPlayer
- ===============
- **Inherits:** :ref:`AnimationMixer<class_AnimationMixer>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
- A node used for animation playback.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- 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.
- 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.
- \ **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.
- Updating the target properties of animations occurs at the process frame.
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - :doc:`2D Sprite animation <../tutorials/2d/2d_sprite_animation>`
- - :doc:`Animation documentation index <../tutorials/animation/index>`
- - `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`__
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +-----------------------------+------------------------------------------------------------------------------------------------+-----------+
- | :ref:`String<class_String>` | :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>` | |
- +-----------------------------+------------------------------------------------------------------------------------------------+-----------+
- | :ref:`String<class_String>` | :ref:`autoplay<class_AnimationPlayer_property_autoplay>` | ``""`` |
- +-----------------------------+------------------------------------------------------------------------------------------------+-----------+
- | :ref:`String<class_String>` | :ref:`current_animation<class_AnimationPlayer_property_current_animation>` | ``""`` |
- +-----------------------------+------------------------------------------------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`current_animation_length<class_AnimationPlayer_property_current_animation_length>` | |
- +-----------------------------+------------------------------------------------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`current_animation_position<class_AnimationPlayer_property_current_animation_position>` | |
- +-----------------------------+------------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`movie_quit_on_finish<class_AnimationPlayer_property_movie_quit_on_finish>` | ``false`` |
- +-----------------------------+------------------------------------------------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`playback_default_blend_time<class_AnimationPlayer_property_playback_default_blend_time>` | ``0.0`` |
- +-----------------------------+------------------------------------------------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>` | ``1.0`` |
- +-----------------------------+------------------------------------------------------------------------------------------------+-----------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`StringName<class_StringName>` | :ref:`animation_get_next<class_AnimationPlayer_method_animation_get_next>` **(** :ref:`StringName<class_StringName>` animation_from **)** |const| |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`animation_set_next<class_AnimationPlayer_method_animation_set_next>` **(** :ref:`StringName<class_StringName>` animation_from, :ref:`StringName<class_StringName>` animation_to **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`clear_queue<class_AnimationPlayer_method_clear_queue>` **(** **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :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| |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` | :ref:`get_method_call_mode<class_AnimationPlayer_method_get_method_call_mode>` **(** **)** |const| |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_playing_speed<class_AnimationPlayer_method_get_playing_speed>` **(** **)** |const| |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` | :ref:`get_process_callback<class_AnimationPlayer_method_get_process_callback>` **(** **)** |const| |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_queue<class_AnimationPlayer_method_get_queue>` **(** **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`NodePath<class_NodePath>` | :ref:`get_root<class_AnimationPlayer_method_get_root>` **(** **)** |const| |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimationPlayer_method_is_playing>` **(** **)** |const| |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`pause<class_AnimationPlayer_method_pause>` **(** **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | 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 **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`play_backwards<class_AnimationPlayer_method_play_backwards>` **(** :ref:`StringName<class_StringName>` name="", :ref:`float<class_float>` custom_blend=-1 **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`queue<class_AnimationPlayer_method_queue>` **(** :ref:`StringName<class_StringName>` name **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | 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 **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | 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 **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_method_call_mode<class_AnimationPlayer_method_set_method_call_mode>` **(** :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` mode **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_process_callback<class_AnimationPlayer_method_set_process_callback>` **(** :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` mode **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_root<class_AnimationPlayer_method_set_root>` **(** :ref:`NodePath<class_NodePath>` path **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`stop<class_AnimationPlayer_method_stop>` **(** :ref:`bool<class_bool>` keep_state=false **)** |
- +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Signals
- -------
- .. _class_AnimationPlayer_signal_animation_changed:
- .. rst-class:: classref-signal
- **animation_changed** **(** :ref:`StringName<class_StringName>` old_name, :ref:`StringName<class_StringName>` new_name **)**
- Emitted when a queued animation plays after the previous animation finished. See also :ref:`queue<class_AnimationPlayer_method_queue>`.
- \ **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>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_signal_current_animation_changed:
- .. rst-class:: classref-signal
- **current_animation_changed** **(** :ref:`String<class_String>` name **)**
- Emitted when :ref:`current_animation<class_AnimationPlayer_property_current_animation>` changes.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Enumerations
- ------------
- .. _enum_AnimationPlayer_AnimationProcessCallback:
- .. rst-class:: classref-enumeration
- enum **AnimationProcessCallback**:
- .. _class_AnimationPlayer_constant_ANIMATION_PROCESS_PHYSICS:
- .. rst-class:: classref-enumeration-constant
- :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_PHYSICS** = ``0``
- For backward compatibility. See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS>`.
- .. _class_AnimationPlayer_constant_ANIMATION_PROCESS_IDLE:
- .. rst-class:: classref-enumeration-constant
- :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_IDLE** = ``1``
- For backward compatibility. See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_IDLE<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_IDLE>`.
- .. _class_AnimationPlayer_constant_ANIMATION_PROCESS_MANUAL:
- .. rst-class:: classref-enumeration-constant
- :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_MANUAL** = ``2``
- For backward compatibility. See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_MANUAL<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_MANUAL>`.
- .. rst-class:: classref-item-separator
- ----
- .. _enum_AnimationPlayer_AnimationMethodCallMode:
- .. rst-class:: classref-enumeration
- enum **AnimationMethodCallMode**:
- .. _class_AnimationPlayer_constant_ANIMATION_METHOD_CALL_DEFERRED:
- .. rst-class:: classref-enumeration-constant
- :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **ANIMATION_METHOD_CALL_DEFERRED** = ``0``
- For backward compatibility. See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_METHOD_DEFERRED<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_METHOD_DEFERRED>`.
- .. _class_AnimationPlayer_constant_ANIMATION_METHOD_CALL_IMMEDIATE:
- .. rst-class:: classref-enumeration-constant
- :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **ANIMATION_METHOD_CALL_IMMEDIATE** = ``1``
- For backward compatibility. See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_METHOD_IMMEDIATE<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_METHOD_IMMEDIATE>`.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_AnimationPlayer_property_assigned_animation:
- .. rst-class:: classref-property
- :ref:`String<class_String>` **assigned_animation**
- .. rst-class:: classref-property-setget
- - void **set_assigned_animation** **(** :ref:`String<class_String>` value **)**
- - :ref:`String<class_String>` **get_assigned_animation** **(** **)**
- 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>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_property_autoplay:
- .. rst-class:: classref-property
- :ref:`String<class_String>` **autoplay** = ``""``
- .. rst-class:: classref-property-setget
- - void **set_autoplay** **(** :ref:`String<class_String>` value **)**
- - :ref:`String<class_String>` **get_autoplay** **(** **)**
- The key of the animation to play when the scene loads.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_property_current_animation:
- .. rst-class:: classref-property
- :ref:`String<class_String>` **current_animation** = ``""``
- .. rst-class:: classref-property-setget
- - void **set_current_animation** **(** :ref:`String<class_String>` value **)**
- - :ref:`String<class_String>` **get_current_animation** **(** **)**
- 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.
- \ **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>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_property_current_animation_length:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **current_animation_length**
- .. rst-class:: classref-property-setget
- - :ref:`float<class_float>` **get_current_animation_length** **(** **)**
- The length (in seconds) of the currently playing animation.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_property_current_animation_position:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **current_animation_position**
- .. rst-class:: classref-property-setget
- - :ref:`float<class_float>` **get_current_animation_position** **(** **)**
- The position (in seconds) of the currently playing animation.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_property_movie_quit_on_finish:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **movie_quit_on_finish** = ``false``
- .. rst-class:: classref-property-setget
- - void **set_movie_quit_on_finish_enabled** **(** :ref:`bool<class_bool>` value **)**
- - :ref:`bool<class_bool>` **is_movie_quit_on_finish_enabled** **(** **)**
- 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.
- \ **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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_property_playback_default_blend_time:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **playback_default_blend_time** = ``0.0``
- .. rst-class:: classref-property-setget
- - void **set_default_blend_time** **(** :ref:`float<class_float>` value **)**
- - :ref:`float<class_float>` **get_default_blend_time** **(** **)**
- The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_property_speed_scale:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **speed_scale** = ``1.0``
- .. rst-class:: classref-property-setget
- - void **set_speed_scale** **(** :ref:`float<class_float>` value **)**
- - :ref:`float<class_float>` **get_speed_scale** **(** **)**
- 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.
- If set to a negative value, the animation is played in reverse. If set to ``0``, the animation will not advance.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_AnimationPlayer_method_animation_get_next:
- .. rst-class:: classref-method
- :ref:`StringName<class_StringName>` **animation_get_next** **(** :ref:`StringName<class_StringName>` animation_from **)** |const|
- Returns the key of the animation which is queued to play after the ``animation_from`` animation.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_animation_set_next:
- .. rst-class:: classref-method
- void **animation_set_next** **(** :ref:`StringName<class_StringName>` animation_from, :ref:`StringName<class_StringName>` animation_to **)**
- Triggers the ``animation_to`` animation when the ``animation_from`` animation completes.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_clear_queue:
- .. rst-class:: classref-method
- void **clear_queue** **(** **)**
- Clears all queued, unplayed animations.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_get_blend_time:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_blend_time** **(** :ref:`StringName<class_StringName>` animation_from, :ref:`StringName<class_StringName>` animation_to **)** |const|
- Returns the blend time (in seconds) between two animations, referenced by their keys.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_get_method_call_mode:
- .. rst-class:: classref-method
- :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **get_method_call_mode** **(** **)** |const|
- For backward compatibility. See :ref:`AnimationCallbackModeMethod<enum_AnimationMixer_AnimationCallbackModeMethod>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_get_playing_speed:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_playing_speed** **(** **)** |const|
- 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.
- Returns a negative value if the current animation is playing backwards.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_get_process_callback:
- .. rst-class:: classref-method
- :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **get_process_callback** **(** **)** |const|
- For backward compatibility. See :ref:`AnimationCallbackModeProcess<enum_AnimationMixer_AnimationCallbackModeProcess>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_get_queue:
- .. rst-class:: classref-method
- :ref:`PackedStringArray<class_PackedStringArray>` **get_queue** **(** **)**
- Returns a list of the animation keys that are currently queued to play.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_get_root:
- .. rst-class:: classref-method
- :ref:`NodePath<class_NodePath>` **get_root** **(** **)** |const|
- For backward compatibility. See :ref:`AnimationMixer.root_node<class_AnimationMixer_property_root_node>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_is_playing:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **is_playing** **(** **)** |const|
- Returns ``true`` if an animation is currently playing (even if :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>` and/or ``custom_speed`` are ``0``).
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_pause:
- .. rst-class:: classref-method
- void **pause** **(** **)**
- 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.
- See also :ref:`stop<class_AnimationPlayer_method_stop>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_play:
- .. rst-class:: classref-method
- 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 **)**
- Plays the animation with key ``name``. Custom blend times and speed can be set.
- 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>`).
- 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.
- \ **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)``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_play_backwards:
- .. rst-class:: classref-method
- void **play_backwards** **(** :ref:`StringName<class_StringName>` name="", :ref:`float<class_float>` custom_blend=-1 **)**
- Plays the animation with key ``name`` in reverse.
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_queue:
- .. rst-class:: classref-method
- void **queue** **(** :ref:`StringName<class_StringName>` name **)**
- Queues an animation for playback once the current one is done.
- \ **Note:** If a looped animation is currently playing, the queued animation will never play unless the looped animation is stopped somehow.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_seek:
- .. rst-class:: classref-method
- void **seek** **(** :ref:`float<class_float>` seconds, :ref:`bool<class_bool>` update=false, :ref:`bool<class_bool>` update_only=false **)**
- 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.
- If ``update_only`` is true, the method / audio / animation playback tracks will not be processed.
- \ **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>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_set_blend_time:
- .. rst-class:: classref-method
- void **set_blend_time** **(** :ref:`StringName<class_StringName>` animation_from, :ref:`StringName<class_StringName>` animation_to, :ref:`float<class_float>` sec **)**
- Specifies a blend time (in seconds) between two animations, referenced by their keys.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_set_method_call_mode:
- .. rst-class:: classref-method
- void **set_method_call_mode** **(** :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` mode **)**
- For backward compatibility. See :ref:`AnimationCallbackModeMethod<enum_AnimationMixer_AnimationCallbackModeMethod>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_set_process_callback:
- .. rst-class:: classref-method
- void **set_process_callback** **(** :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` mode **)**
- For backward compatibility. See :ref:`AnimationCallbackModeProcess<enum_AnimationMixer_AnimationCallbackModeProcess>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_set_root:
- .. rst-class:: classref-method
- void **set_root** **(** :ref:`NodePath<class_NodePath>` path **)**
- For backward compatibility. See :ref:`AnimationMixer.root_node<class_AnimationMixer_property_root_node>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationPlayer_method_stop:
- .. rst-class:: classref-method
- void **stop** **(** :ref:`bool<class_bool>` keep_state=false **)**
- 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>`.
- If ``keep_state`` is ``true``, the animation state is not updated visually.
- \ **Note:** The method / audio / animation playback tracks will not be processed by this method.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
|