.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _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:`remove_animation` **(** :ref:`String` name **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rename_animation` **(** :ref:`String` name, :ref:`String` newname **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_animation` **(** :ref:`String` name **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Animation` | :ref:`get_animation` **(** :ref:`String` name **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`StringArray` | :ref:`get_animation_list` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`animation_set_next` **(** :ref:`String` anim_from, :ref:`String` anim_to **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`animation_get_next` **(** :ref:`String` anim_from **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_blend_time` **(** :ref:`String` anim_from, :ref:`String` anim_to, :ref:`float` sec **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_blend_time` **(** :ref:`String` anim_from, :ref:`String` anim_to **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_default_blend_time` **(** :ref:`float` sec **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_default_blend_time` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`play` **(** :ref:`String` name="", :ref:`float` custom_blend=-1, :ref:`float` custom_speed=1, :ref:`bool` from_end=false **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`play_backwards` **(** :ref:`String` name="", :ref:`float` custom_blend=-1 **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`stop` **(** :ref:`bool` reset=true **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`stop_all` **(** **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_playing` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_current_animation` **(** :ref:`String` anim **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_current_animation` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`queue` **(** :ref:`String` name **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_queue` **(** **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_active` **(** :ref:`bool` active **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_active` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_speed` **(** :ref:`float` speed **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_speed` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_autoplay` **(** :ref:`String` name **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_autoplay` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_root` **(** :ref:`NodePath` path **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`NodePath` | :ref:`get_root` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`seek` **(** :ref:`float` pos_sec, :ref:`bool` update=false **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_pos` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`find_animation` **(** :ref:`Animation` animation **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_caches` **(** **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_animation_process_mode` **(** :ref:`int` mode **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_animation_process_mode` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_current_animation_pos` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_current_animation_length` **(** **)** const | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`advance` **(** :ref:`float` delta **)** | +----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- - **animation_changed** **(** :ref:`String` old_name, :ref:`String` new_name **)** - **finished** **(** **)** Numeric Constants ----------------- - **ANIMATION_PROCESS_FIXED** = **0** --- Process animation on fixed process. This is specially useful when animating kinematic bodies. - **ANIMATION_PROCESS_IDLE** = **1** --- Process animation on 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 **)** Add an animation resource to the player, which will be later referenced by the "name" argument. .. _class_AnimationPlayer_remove_animation: - void **remove_animation** **(** :ref:`String` name **)** Remove an animation from the player (by supplying the same name used to add it). .. _class_AnimationPlayer_rename_animation: - void **rename_animation** **(** :ref:`String` name, :ref:`String` newname **)** Rename an existing animation. .. _class_AnimationPlayer_has_animation: - :ref:`bool` **has_animation** **(** :ref:`String` name **)** const Request whether an :ref:`Animation` name exist within the player. .. _class_AnimationPlayer_get_animation: - :ref:`Animation` **get_animation** **(** :ref:`String` name **)** const Get an :ref:`Animation` resource by requesting a name. .. _class_AnimationPlayer_get_animation_list: - :ref:`StringArray` **get_animation_list** **(** **)** const Get the list of names of the animations stored in the player. .. _class_AnimationPlayer_animation_set_next: - void **animation_set_next** **(** :ref:`String` anim_from, :ref:`String` anim_to **)** .. _class_AnimationPlayer_animation_get_next: - :ref:`String` **animation_get_next** **(** :ref:`String` anim_from **)** const .. _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_get_blend_time: - :ref:`float` **get_blend_time** **(** :ref:`String` anim_from, :ref:`String` anim_to **)** const Get the blend time between two animations, referenced by their names. .. _class_AnimationPlayer_set_default_blend_time: - void **set_default_blend_time** **(** :ref:`float` sec **)** Set the default blend time between animations. .. _class_AnimationPlayer_get_default_blend_time: - :ref:`float` **get_default_blend_time** **(** **)** const Return the default blend time between animations. .. _class_AnimationPlayer_play: - void **play** **(** :ref:`String` name="", :ref:`float` custom_blend=-1, :ref:`float` custom_speed=1, :ref:`bool` from_end=false **)** Play a given animation by the animation 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 a given animation by the animation name in reverse. .. _class_AnimationPlayer_stop: - void **stop** **(** :ref:`bool` reset=true **)** Stop the currently playing animation. .. _class_AnimationPlayer_stop_all: - void **stop_all** **(** **)** Stop playback of animations (deprecated). .. _class_AnimationPlayer_is_playing: - :ref:`bool` **is_playing** **(** **)** const Return whether an animation is playing. .. _class_AnimationPlayer_set_current_animation: - void **set_current_animation** **(** :ref:`String` anim **)** Set the current animation (even if no playback occurs). Using set_current_animation() and set_active() are similar to calling play(). .. _class_AnimationPlayer_get_current_animation: - :ref:`String` **get_current_animation** **(** **)** const Return the name of the animation being played. .. _class_AnimationPlayer_queue: - void **queue** **(** :ref:`String` name **)** Queue an animation for playback once the current one is done. .. _class_AnimationPlayer_clear_queue: - void **clear_queue** **(** **)** If animations are queued to play, clear them. .. _class_AnimationPlayer_set_active: - void **set_active** **(** :ref:`bool` active **)** Set the player as active (playing). If false, it will do nothing. .. _class_AnimationPlayer_is_active: - :ref:`bool` **is_active** **(** **)** const Return true if the player is active. .. _class_AnimationPlayer_set_speed: - void **set_speed** **(** :ref:`float` speed **)** Set a speed scaling ratio in a given animation channel (or channel 0 if none is provided). Default ratio is *1* (no scaling). .. _class_AnimationPlayer_get_speed: - :ref:`float` **get_speed** **(** **)** const Get the speed scaling ratio in a given animation channel (or channel 0 if none is provided). Default ratio is *1* (no scaling). .. _class_AnimationPlayer_set_autoplay: - void **set_autoplay** **(** :ref:`String` name **)** Set the name of the animation that will be automatically played when the scene is loaded. .. _class_AnimationPlayer_get_autoplay: - :ref:`String` **get_autoplay** **(** **)** const Return the name of the animation that will be automatically played when the scene is loaded. .. _class_AnimationPlayer_set_root: - void **set_root** **(** :ref:`NodePath` path **)** AnimationPlayer resolves animation track paths from this node (which is relative to itself), by default root is "..", but it can be changed. .. _class_AnimationPlayer_get_root: - :ref:`NodePath` **get_root** **(** **)** const Return path to root node (see :ref:`set_root`). .. _class_AnimationPlayer_seek: - void **seek** **(** :ref:`float` pos_sec, :ref:`bool` update=false **)** Seek the animation to a given position in time (in seconds). If 'update' is true, the animation will be updated too, otherwise it will be updated at process time. .. _class_AnimationPlayer_get_pos: - :ref:`float` **get_pos** **(** **)** const Return the playback position (in seconds) in an animation channel (or channel 0 if none is provided). .. _class_AnimationPlayer_find_animation: - :ref:`String` **find_animation** **(** :ref:`Animation` animation **)** const Find an animation name by resource. .. _class_AnimationPlayer_clear_caches: - void **clear_caches** **(** **)** 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. .. _class_AnimationPlayer_set_animation_process_mode: - void **set_animation_process_mode** **(** :ref:`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\_\*. .. _class_AnimationPlayer_get_animation_process_mode: - :ref:`int` **get_animation_process_mode** **(** **)** const Return the mode in which the animation player processes. See :ref:`set_animation_process_mode`. .. _class_AnimationPlayer_get_current_animation_pos: - :ref:`float` **get_current_animation_pos** **(** **)** const Get the position (in seconds) of the currently being played animation. .. _class_AnimationPlayer_get_current_animation_length: - :ref:`float` **get_current_animation_length** **(** **)** const Get the length (in seconds) of the currently being played animation. .. _class_AnimationPlayer_advance: - void **advance** **(** :ref:`float` delta **)** Used to skip ahead or skip back in an animation. Delta is the time in seconds to skip.