Skip to content

Latest commit

 

History

History
269 lines (158 loc) · 19.1 KB

class_animationplayer.rst

File metadata and controls

269 lines (158 loc) · 19.1 KB

AnimationPlayer

Inherits: :ref:`Node<class_node>` < :ref:`Object<class_object>`

Category: Core

Brief Description

Container and player of :ref:`Animation<class_animation>` resources.

Member Functions

:ref:`int<class_int>` :ref:`add_animation<class_AnimationPlayer_add_animation>` ( :ref:`String<class_string>` name, :ref:`Animation<class_animation>` animation )
void :ref:`advance<class_AnimationPlayer_advance>` ( :ref:`float<class_float>` delta )
:ref:`String<class_string>` :ref:`animation_get_next<class_AnimationPlayer_animation_get_next>` ( :ref:`String<class_string>` anim_from ) const
void :ref:`animation_set_next<class_AnimationPlayer_animation_set_next>` ( :ref:`String<class_string>` anim_from, :ref:`String<class_string>` anim_to )
void :ref:`clear_caches<class_AnimationPlayer_clear_caches>` ( )
void :ref:`clear_queue<class_AnimationPlayer_clear_queue>` ( )
:ref:`String<class_string>` :ref:`find_animation<class_AnimationPlayer_find_animation>` ( :ref:`Animation<class_animation>` animation ) const
:ref:`Animation<class_animation>` :ref:`get_animation<class_AnimationPlayer_get_animation>` ( :ref:`String<class_string>` name ) const
:ref:`PoolStringArray<class_poolstringarray>` :ref:`get_animation_list<class_AnimationPlayer_get_animation_list>` ( ) const
:ref:`float<class_float>` :ref:`get_blend_time<class_AnimationPlayer_get_blend_time>` ( :ref:`String<class_string>` anim_from, :ref:`String<class_string>` anim_to ) const
:ref:`bool<class_bool>` :ref:`has_animation<class_AnimationPlayer_has_animation>` ( :ref:`String<class_string>` name ) const
:ref:`bool<class_bool>` :ref:`is_playing<class_AnimationPlayer_is_playing>` ( ) const
void :ref:`play<class_AnimationPlayer_play>` ( :ref:`String<class_string>` 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_play_backwards>` ( :ref:`String<class_string>` name="", :ref:`float<class_float>` custom_blend=-1 )
void :ref:`queue<class_AnimationPlayer_queue>` ( :ref:`String<class_string>` name )
void :ref:`remove_animation<class_AnimationPlayer_remove_animation>` ( :ref:`String<class_string>` name )
void :ref:`rename_animation<class_AnimationPlayer_rename_animation>` ( :ref:`String<class_string>` name, :ref:`String<class_string>` newname )
void :ref:`seek<class_AnimationPlayer_seek>` ( :ref:`float<class_float>` seconds, :ref:`bool<class_bool>` update=false )
void :ref:`set_blend_time<class_AnimationPlayer_set_blend_time>` ( :ref:`String<class_string>` anim_from, :ref:`String<class_string>` anim_to, :ref:`float<class_float>` sec )
void :ref:`stop<class_AnimationPlayer_stop>` ( :ref:`bool<class_bool>` reset=true )

Signals

If the currently being played animation changes, this signal will notify of such change.

Notifies when an animation finished playing.

Notifies when an animation starts playing.

Member Variables

Enums

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<class_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

Adds animation to the player accessible with the key name.

Shifts position in the animation timeline. Delta is the time in seconds to shift.

Returns the name of the next animation in the queue.

Triggers the anim_to animation when the anim_from animation completes.

  • 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.

  • void clear_queue ( )

Clears all queued, unplayed animations.

Returns the name of animation or empty string if not found.

Returns the :ref:`Animation<class_animation>` with key name or null if not found.

Returns the list of stored animation names.

Get the blend time (in seconds) between two animations, referenced by their names.

Returns true if the AnimationPlayer stores an :ref:`Animation<class_animation>` with key name.

Returns true if playing an animation.

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.

Play the animation with key name in reverse.

Queue an animation for playback once the current one is done.

Remove the animation with key name.

Rename an existing animation with key name to newname.

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.

Specify a blend time (in seconds) between two animations, referenced by their names.

Stop the currently playing animation. If reset is true, the anim position is reset to 0.