.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the AnimationPlayer.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_AnimationPlayer: AnimationPlayer =============== **Inherits:** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Container and player of :ref:`Animation` resources. Member Functions ---------------- +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`add_animation` **(** :ref:`String` name, :ref:`Animation` animation **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`advance` **(** :ref:`float` delta **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`animation_get_next` **(** :ref:`String` anim_from **)** const | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`animation_set_next` **(** :ref:`String` anim_from, :ref:`String` anim_to **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_caches` **(** **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_queue` **(** **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`find_animation` **(** :ref:`Animation` animation **)** const | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Animation` | :ref:`get_animation` **(** :ref:`String` name **)** const | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolStringArray` | :ref:`get_animation_list` **(** **)** const | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_blend_time` **(** :ref:`String` anim_from, :ref:`String` anim_to **)** const | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_animation` **(** :ref:`String` name **)** const | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_playing` **(** **)** const | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`play` **(** :ref:`String` name="", :ref:`float` custom_blend=-1, :ref:`float` custom_speed=1.0, :ref:`bool` from_end=false **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`play_backwards` **(** :ref:`String` name="", :ref:`float` custom_blend=-1 **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`queue` **(** :ref:`String` name **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_animation` **(** :ref:`String` name **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rename_animation` **(** :ref:`String` name, :ref:`String` newname **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`seek` **(** :ref:`float` seconds, :ref:`bool` update=false **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_blend_time` **(** :ref:`String` anim_from, :ref:`String` anim_to, :ref:`float` sec **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`stop` **(** :ref:`bool` reset=true **)** | +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- .. _class_AnimationPlayer_animation_changed: - **animation_changed** **(** :ref:`String` old_name, :ref:`String` new_name **)** If the currently being played animation changes, this signal will notify of such change. .. _class_AnimationPlayer_animation_finished: - **animation_finished** **(** :ref:`String` anim_name **)** Notifies when an animation finished playing. .. _class_AnimationPlayer_animation_started: - **animation_started** **(** :ref:`String` anim_name **)** Notifies when an animation starts playing. Member Variables ---------------- .. _class_AnimationPlayer_assigned_animation: - :ref:`String` **assigned_animation** - If playing, the current animation; otherwise, the animation last played. When set, would change the animation, but would not play it unless currently playing. See also :ref:`current_animation`. .. _class_AnimationPlayer_autoplay: - :ref:`String` **autoplay** - The name of the animation to play when the scene loads. Default value: ``""``. .. _class_AnimationPlayer_current_animation: - :ref:`String` **current_animation** - The name of the current animation, "" if not playing anything. When being set, does not restart the animation. See also :ref:`play`. Default value: ``""``. .. _class_AnimationPlayer_current_animation_length: - :ref:`float` **current_animation_length** - The length (in seconds) of the currently being played animation. .. _class_AnimationPlayer_current_animation_position: - :ref:`float` **current_animation_position** - The position (in seconds) of the currently playing animation. .. _class_AnimationPlayer_playback_active: - :ref:`bool` **playback_active** - If ``true``, updates animations in response to process-related notifications. Default value: ``true``. .. _class_AnimationPlayer_playback_default_blend_time: - :ref:`float` **playback_default_blend_time** - The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision. Default value: ``0``. .. _class_AnimationPlayer_playback_process_mode: - :ref:`AnimationProcessMode` **playback_process_mode** - The process notification in which to update animations. Default value: enum ANIMATION_PROCESS_IDLE. .. _class_AnimationPlayer_playback_speed: - :ref:`float` **playback_speed** - The speed scaling ratio. For instance, 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. Default value: ``1``. .. _class_AnimationPlayer_root_node: - :ref:`NodePath` **root_node** - The node from which node path references will travel. Default value: ``".."``. Enums ----- .. _enum_AnimationPlayer_AnimationProcessMode: enum **AnimationProcessMode** - **ANIMATION_PROCESS_PHYSICS** = **0** --- Process animation during the physics process. This is especially useful when animating physics bodies. - **ANIMATION_PROCESS_IDLE** = **1** --- Process animation during the idle process. Description ----------- An animation player is used for general purpose playback of :ref:`Animation` resources. It contains a dictionary of animations (referenced by name) and custom blend times between their transitions. Additionally, animations can be played and blended in different channels. Member Function Description --------------------------- .. _class_AnimationPlayer_add_animation: - :ref:`int` **add_animation** **(** :ref:`String` name, :ref:`Animation` animation **)** Adds ``animation`` to the player accessible with the key ``name``. .. _class_AnimationPlayer_advance: - void **advance** **(** :ref:`float` delta **)** Shifts position in the animation timeline. Delta is the time in seconds to shift. .. _class_AnimationPlayer_animation_get_next: - :ref:`String` **animation_get_next** **(** :ref:`String` anim_from **)** const Returns the name of the next animation in the queue. .. _class_AnimationPlayer_animation_set_next: - void **animation_set_next** **(** :ref:`String` anim_from, :ref:`String` anim_to **)** Triggers the ``anim_to`` animation when the ``anim_from`` animation completes. .. _class_AnimationPlayer_clear_caches: - void **clear_caches** **(** **)** ``AnimationPlayer`` caches animated nodes. It may not notice if a node disappears, so clear_caches forces it to update the cache again. .. _class_AnimationPlayer_clear_queue: - void **clear_queue** **(** **)** Clears all queued, unplayed animations. .. _class_AnimationPlayer_find_animation: - :ref:`String` **find_animation** **(** :ref:`Animation` animation **)** const Returns the name of ``animation`` or empty string if not found. .. _class_AnimationPlayer_get_animation: - :ref:`Animation` **get_animation** **(** :ref:`String` name **)** const Returns the :ref:`Animation` with key ``name`` or ``null`` if not found. .. _class_AnimationPlayer_get_animation_list: - :ref:`PoolStringArray` **get_animation_list** **(** **)** const Returns the list of stored animation names. .. _class_AnimationPlayer_get_blend_time: - :ref:`float` **get_blend_time** **(** :ref:`String` anim_from, :ref:`String` anim_to **)** const Get the blend time (in seconds) between two animations, referenced by their names. .. _class_AnimationPlayer_has_animation: - :ref:`bool` **has_animation** **(** :ref:`String` name **)** const Returns ``true`` if the ``AnimationPlayer`` stores an :ref:`Animation` with key ``name``. .. _class_AnimationPlayer_is_playing: - :ref:`bool` **is_playing** **(** **)** const Returns ``true`` if playing an animation. .. _class_AnimationPlayer_play: - void **play** **(** :ref:`String` name="", :ref:`float` custom_blend=-1, :ref:`float` custom_speed=1.0, :ref:`bool` from_end=false **)** Play the animation with key ``name``. Custom speed and blend times can be set. If custom speed is negative (-1), 'from_end' being true can play the animation backwards. .. _class_AnimationPlayer_play_backwards: - void **play_backwards** **(** :ref:`String` name="", :ref:`float` custom_blend=-1 **)** Play the animation with key ``name`` in reverse. .. _class_AnimationPlayer_queue: - void **queue** **(** :ref:`String` name **)** Queue an animation for playback once the current one is done. .. _class_AnimationPlayer_remove_animation: - void **remove_animation** **(** :ref:`String` name **)** Remove the animation with key ``name``. .. _class_AnimationPlayer_rename_animation: - void **rename_animation** **(** :ref:`String` name, :ref:`String` newname **)** Rename an existing animation with key ``name`` to ``newname``. .. _class_AnimationPlayer_seek: - void **seek** **(** :ref:`float` seconds, :ref:`bool` update=false **)** Seek the animation to the ``seconds`` point in time (in seconds). If ``update`` is ``true``, the animation updates too, otherwise it updates at process time. .. _class_AnimationPlayer_set_blend_time: - void **set_blend_time** **(** :ref:`String` anim_from, :ref:`String` anim_to, :ref:`float` sec **)** Specify a blend time (in seconds) between two animations, referenced by their names. .. _class_AnimationPlayer_stop: - void **stop** **(** :ref:`bool` reset=true **)** Stop the currently playing animation. If ``reset`` is ``true``, the anim position is reset to ``0``.