Skip to content

class_animationplayer

reduz edited this page Feb 23, 2014 · 13 revisions

AnimationPlayer

####Inherits: Node ####Category: Core

Brief Description

Container and player of [Animaton] resources.

Member Functions

Signals

  • animation&#95changed ( String old_name, String new_name )
  • finished ( )

Numeric Constants

  • ANIMATION_PROCESS_FIXED = 0
  • ANIMATION_PROCESS_IDLE = 1

Description

An animation player is used for general purpose playback of 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 diferent channels.

Member Function Description

Add an animation resource to the player, which will be later referenced by the "name" arguemnt.

  • void remove&#95animation ( String name )

Remove an animation from the player (by supplying the same name used to add it).

Rename an existing animation.

Request wether an Animation name exist within the player.

Get an Animation resource by requesting a name.

Get the list of names of the animations stored in the player.

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

Get the blend time between two animations, referemced by their names.

  • void set&#95default&#95blend&#95time ( real sec )

Set the default blend time between animations.

  • real get&#95default&#95blend&#95time ( ) const

Return the default blend time between animations.

  • void stop&#95all ( )

Stop playback on all animation channels.

  • bool is&#95playing ( ) const

Return wether an animation chanel is playing (or channel 0 if none is provided).

  • void set&#95current&#95animation ( String anim )

Set the current animation (even if no playback occurs). Using set_current_animation() and set_active() are similar to claling play().

  • String get&#95current&#95animation ( ) const

Return the name of the animation being played in a channel (or channel 0 if none is provided).

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

  • void set&#95active ( bool active )

Set the player as active (playing)

  • bool is&#95active ( ) const

Return true if the player is active.

  • void set&#95speed ( real speed )

Set a speed scaling ratio in a given animation channel (or channel 0 if none is provided). Default ratio is 1 (no scaling).

  • real get&#95speed ( ) const

Get the speed scaling ratio in a given animation channel (or channel 0 if none is provided). Default ratio is 1 (no scaling).

  • void set&#95autoplay ( String name )

Set the name of the animation that will be automatically played when the scene is loaded.

  • String get&#95autoplay ( ) const

Return the name of the animation that will be automatically played when the scene is loaded.

  • void seek ( real pos_sec, bool update=false )

Seek the animation in an animation channel (or channel 0 if none is provided) to a specific position (in seconds).

  • real get&#95pos ( ) const

Return the playback position (in seconds) in an animation channel (or channel 0 if none is provided)

Find an animation name by resource.

  • void clear&#95caches ( )

The animation player creates caches for faster access to the nodes it will animate. However, if a specific node is removed, it may not notice it, so clear_caches will force the player to search for the nodes again.

  • void set&#95animation&#95process&#95mode ( int mode )

Set the mode in which the animation player processes. By default, it processes on idle time (framerate dependent), but using fixed time works well for animating static collision bodies in 2D and 3D. See enum ANIMATION_PROCESS_*.

  • int get&#95animation&#95process&#95mode ( ) const

Return the mode in which the animation player processes. See set&#95animation&#95process&#95mode.

Clone this wiki locally