Inherits: :ref:`Node<class_node>` < :ref:`Object<class_object>`
Category: Core
Container and player of :ref:`Animation<class_animation>` resources.
- animation_changed ( :ref:`String<class_string>` old_name, :ref:`String<class_string>` new_name )
If the currently being played animation changes, this signal will notify of such change.
- animation_finished ( :ref:`String<class_string>` anim_name )
Notifies when an animation finished playing.
- animation_started ( :ref:`String<class_string>` anim_name )
Notifies when an animation starts playing.
- :ref:`String<class_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_current_animation>`.
- :ref:`String<class_string>` autoplay - The name of the animation to play when the scene loads. Default value:
""
. - :ref:`String<class_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<class_AnimationPlayer_play>`. Default value:
""
. - :ref:`float<class_float>` current_animation_length - The length (in seconds) of the currently being played animation.
- :ref:`float<class_float>` current_animation_position - The position (in seconds) of the currently playing animation.
- :ref:`bool<class_bool>` playback_active - If
true
, updates animations in response to process-related notifications. Default value:true
. - :ref:`float<class_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
. - :ref:`AnimationProcessMode<enum_animationplayer_animationprocessmode>` playback_process_mode - The process notification in which to update animations. Default value: enum ANIMATION_PROCESS_IDLE.
- :ref:`float<class_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
. - :ref:`NodePath<class_nodepath>` root_node - The node from which node path references will travel. Default value:
".."
.
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.
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.
- :ref:`int<class_int>` add_animation ( :ref:`String<class_string>` name, :ref:`Animation<class_animation>` animation )
Adds animation
to the player accessible with the key name
.
- void advance ( :ref:`float<class_float>` delta )
Shifts position in the animation timeline. Delta is the time in seconds to shift.
- :ref:`String<class_string>` animation_get_next ( :ref:`String<class_string>` anim_from ) const
Returns the name of the next animation in the queue.
- void animation_set_next ( :ref:`String<class_string>` anim_from, :ref:`String<class_string>` anim_to )
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.
- :ref:`String<class_string>` find_animation ( :ref:`Animation<class_animation>` animation ) const
Returns the name of animation
or empty string if not found.
- :ref:`Animation<class_animation>` get_animation ( :ref:`String<class_string>` name ) const
Returns the :ref:`Animation<class_animation>` with key name
or null
if not found.
- :ref:`PoolStringArray<class_poolstringarray>` get_animation_list ( ) const
Returns the list of stored animation names.
- :ref:`float<class_float>` get_blend_time ( :ref:`String<class_string>` anim_from, :ref:`String<class_string>` anim_to ) const
Get the blend time (in seconds) between two animations, referenced by their names.
- :ref:`bool<class_bool>` has_animation ( :ref:`String<class_string>` name ) const
Returns true
if the AnimationPlayer
stores an :ref:`Animation<class_animation>` with key name
.
- :ref:`bool<class_bool>` is_playing ( ) const
Returns true
if playing an animation.
- void 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 )
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.
- void play_backwards ( :ref:`String<class_string>` name="", :ref:`float<class_float>` custom_blend=-1 )
Play the animation with key name
in reverse.
- void queue ( :ref:`String<class_string>` name )
Queue an animation for playback once the current one is done.
- void remove_animation ( :ref:`String<class_string>` name )
Remove the animation with key name
.
- void rename_animation ( :ref:`String<class_string>` name, :ref:`String<class_string>` newname )
Rename an existing animation with key name
to newname
.
- void seek ( :ref:`float<class_float>` seconds, :ref:`bool<class_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.
- void set_blend_time ( :ref:`String<class_string>` anim_from, :ref:`String<class_string>` anim_to, :ref:`float<class_float>` sec )
Specify a blend time (in seconds) between two animations, referenced by their names.
- void stop ( :ref:`bool<class_bool>` reset=true )
Stop the currently playing animation. If reset
is true
, the anim position is reset to 0
.