.. 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_Animation: Animation ========= **Inherits:** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Contains data used to animate everything in the engine. Member Functions ---------------- +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`add_track` **(** :ref:`int` type, :ref:`int` at_pos=null **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear` **(** **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`find_track` **(** :ref:`NodePath` path **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_length` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_step` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_track_count` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_loop` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolIntArray` | :ref:`method_track_get_key_indices` **(** :ref:`int` idx, :ref:`float` time_sec, :ref:`float` delta **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`method_track_get_name` **(** :ref:`int` idx, :ref:`int` key_idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`method_track_get_params` **(** :ref:`int` idx, :ref:`int` key_idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_track` **(** :ref:`int` idx **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_length` **(** :ref:`float` time_sec **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_loop` **(** :ref:`bool` enabled **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_step` **(** :ref:`float` size_sec **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`track_find_key` **(** :ref:`int` idx, :ref:`float` time, :ref:`bool` exact=null **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`track_get_interpolation_loop_wrap` **(** :ref:`int` idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`track_get_interpolation_type` **(** :ref:`int` idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`track_get_key_count` **(** :ref:`int` idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`track_get_key_time` **(** :ref:`int` idx, :ref:`int` key_idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`track_get_key_transition` **(** :ref:`int` idx, :ref:`int` key_idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`track_get_key_value` **(** :ref:`int` idx, :ref:`int` key_idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`NodePath` | :ref:`track_get_path` **(** :ref:`int` idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`track_get_type` **(** :ref:`int` idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`track_insert_key` **(** :ref:`int` idx, :ref:`float` time, :ref:`Variant` key, :ref:`float` transition=null **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`track_is_imported` **(** :ref:`int` idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`track_move_down` **(** :ref:`int` idx **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`track_move_up` **(** :ref:`int` idx **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`track_remove_key` **(** :ref:`int` idx, :ref:`int` key_idx **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`track_remove_key_at_pos` **(** :ref:`int` idx, :ref:`float` pos **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`track_set_imported` **(** :ref:`int` idx, :ref:`bool` imported **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`track_set_interpolation_loop_wrap` **(** :ref:`int` idx, :ref:`bool` interpolation **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`track_set_interpolation_type` **(** :ref:`int` idx, :ref:`int` interpolation **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`track_set_key_transition` **(** :ref:`int` idx, :ref:`int` key_idx, :ref:`float` transition **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`track_set_key_value` **(** :ref:`int` idx, :ref:`int` key, :ref:`Variant` value **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`track_set_path` **(** :ref:`int` idx, :ref:`NodePath` path **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`transform_track_insert_key` **(** :ref:`int` idx, :ref:`float` time, :ref:`Vector3` loc, :ref:`Quat` rot, :ref:`Vector3` scale **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`transform_track_interpolate` **(** :ref:`int` idx, :ref:`float` time_sec **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolIntArray` | :ref:`value_track_get_key_indices` **(** :ref:`int` idx, :ref:`float` time_sec, :ref:`float` delta **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`value_track_get_update_mode` **(** :ref:`int` idx **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`value_track_set_update_mode` **(** :ref:`int` idx, :ref:`int` mode **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Numeric Constants ----------------- - **TYPE_VALUE** = **0** --- Value tracks set values in node properties, but only those which can be Interpolated. - **TYPE_TRANSFORM** = **1** --- Transform tracks are used to change node local transforms or skeleton pose bones. Transitions are Interpolated. - **TYPE_METHOD** = **2** --- Method tracks call functions with given arguments per key. - **INTERPOLATION_NEAREST** = **0** --- No interpolation (nearest value). - **INTERPOLATION_LINEAR** = **1** --- Linear interpolation. - **INTERPOLATION_CUBIC** = **2** --- Cubic interpolation. - **UPDATE_CONTINUOUS** = **0** - **UPDATE_DISCRETE** = **1** - **UPDATE_TRIGGER** = **2** Description ----------- An Animation resource contains data used to animate everything in the engine. Animations are divided into tracks, and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track. Animations are just data containers, and must be added to odes such as an :ref:`AnimationPlayer` or :ref:`AnimationTreePlayer` to be played back. Member Function Description --------------------------- .. _class_Animation_add_track: - :ref:`int` **add_track** **(** :ref:`int` type, :ref:`int` at_pos=null **)** Add a track to the Animation. The track type must be specified as any of the values in the TYPE\_\* enumeration. .. _class_Animation_clear: - void **clear** **(** **)** Clear the animation (clear all tracks and reset all). .. _class_Animation_find_track: - :ref:`int` **find_track** **(** :ref:`NodePath` path **)** const Return the index of the specified track. If the track is not found, return -1. .. _class_Animation_get_length: - :ref:`float` **get_length** **(** **)** const Return the total length of the animation (in seconds). .. _class_Animation_get_step: - :ref:`float` **get_step** **(** **)** const Get the animation step value. .. _class_Animation_get_track_count: - :ref:`int` **get_track_count** **(** **)** const Return the amount of tracks in the animation. .. _class_Animation_has_loop: - :ref:`bool` **has_loop** **(** **)** const Return whether the animation has the loop flag set. .. _class_Animation_method_track_get_key_indices: - :ref:`PoolIntArray` **method_track_get_key_indices** **(** :ref:`int` idx, :ref:`float` time_sec, :ref:`float` delta **)** const Return all the key indices of a method track, given a position and delta time. .. _class_Animation_method_track_get_name: - :ref:`String` **method_track_get_name** **(** :ref:`int` idx, :ref:`int` key_idx **)** const Return the method name of a method track. .. _class_Animation_method_track_get_params: - :ref:`Array` **method_track_get_params** **(** :ref:`int` idx, :ref:`int` key_idx **)** const Return the arguments values to be called on a method track for a given key in a given track. .. _class_Animation_remove_track: - void **remove_track** **(** :ref:`int` idx **)** Remove a track by specifying the track index. .. _class_Animation_set_length: - void **set_length** **(** :ref:`float` time_sec **)** Set the total length of the animation (in seconds). Note that length is not delimited by the last key, as this one may be before or after the end to ensure correct interpolation and looping. .. _class_Animation_set_loop: - void **set_loop** **(** :ref:`bool` enabled **)** Set a flag indicating that the animation must loop. This is uses for correct interpolation of animation cycles, and for hinting the player that it must restart the animation. .. _class_Animation_set_step: - void **set_step** **(** :ref:`float` size_sec **)** Set the animation step value. .. _class_Animation_track_find_key: - :ref:`int` **track_find_key** **(** :ref:`int` idx, :ref:`float` time, :ref:`bool` exact=null **)** const Find the key index by time in a given track. Optionally, only find it if the exact time is given. .. _class_Animation_track_get_interpolation_loop_wrap: - :ref:`bool` **track_get_interpolation_loop_wrap** **(** :ref:`int` idx **)** const .. _class_Animation_track_get_interpolation_type: - :ref:`int` **track_get_interpolation_type** **(** :ref:`int` idx **)** const Return the interpolation type of a given track, from the INTERPOLATION\_\* enum. .. _class_Animation_track_get_key_count: - :ref:`int` **track_get_key_count** **(** :ref:`int` idx **)** const Return the amount of keys in a given track. .. _class_Animation_track_get_key_time: - :ref:`float` **track_get_key_time** **(** :ref:`int` idx, :ref:`int` key_idx **)** const Return the time at which the key is located. .. _class_Animation_track_get_key_transition: - :ref:`float` **track_get_key_transition** **(** :ref:`int` idx, :ref:`int` key_idx **)** const Return the transition curve (easing) for a specific key (see built-in math function "ease"). .. _class_Animation_track_get_key_value: - :ref:`Variant` **track_get_key_value** **(** :ref:`int` idx, :ref:`int` key_idx **)** const Return the value of a given key in a given track. .. _class_Animation_track_get_path: - :ref:`NodePath` **track_get_path** **(** :ref:`int` idx **)** const Get the path of a track. for more information on the path format, see :ref:`track_set_path` .. _class_Animation_track_get_type: - :ref:`int` **track_get_type** **(** :ref:`int` idx **)** const Get the type of a track. .. _class_Animation_track_insert_key: - void **track_insert_key** **(** :ref:`int` idx, :ref:`float` time, :ref:`Variant` key, :ref:`float` transition=null **)** Insert a generic key in a given track. .. _class_Animation_track_is_imported: - :ref:`bool` **track_is_imported** **(** :ref:`int` idx **)** const Return true if the given track is imported. Else, return false. .. _class_Animation_track_move_down: - void **track_move_down** **(** :ref:`int` idx **)** Move a track down. .. _class_Animation_track_move_up: - void **track_move_up** **(** :ref:`int` idx **)** Move a track up. .. _class_Animation_track_remove_key: - void **track_remove_key** **(** :ref:`int` idx, :ref:`int` key_idx **)** Remove a key by index in a given track. .. _class_Animation_track_remove_key_at_pos: - void **track_remove_key_at_pos** **(** :ref:`int` idx, :ref:`float` pos **)** Remove a key by position (seconds) in a given track. .. _class_Animation_track_set_imported: - void **track_set_imported** **(** :ref:`int` idx, :ref:`bool` imported **)** Set the given track as imported or not. .. _class_Animation_track_set_interpolation_loop_wrap: - void **track_set_interpolation_loop_wrap** **(** :ref:`int` idx, :ref:`bool` interpolation **)** .. _class_Animation_track_set_interpolation_type: - void **track_set_interpolation_type** **(** :ref:`int` idx, :ref:`int` interpolation **)** Set the interpolation type of a given track, from the INTERPOLATION\_\* enum. .. _class_Animation_track_set_key_transition: - void **track_set_key_transition** **(** :ref:`int` idx, :ref:`int` key_idx, :ref:`float` transition **)** Set the transition curve (easing) for a specific key (see built-in math function "ease"). .. _class_Animation_track_set_key_value: - void **track_set_key_value** **(** :ref:`int` idx, :ref:`int` key, :ref:`Variant` value **)** Set the value of an existing key. .. _class_Animation_track_set_path: - void **track_set_path** **(** :ref:`int` idx, :ref:`NodePath` path **)** Set the path of a track. Paths must be valid scene-tree paths to a node, and must be specified starting from the parent node of the node that will reproduce the animation. Tracks that control properties or bones must append their name after the path, separated by ":". Example: "character/skeleton:ankle" or "character/mesh:transform/local" .. _class_Animation_transform_track_insert_key: - :ref:`int` **transform_track_insert_key** **(** :ref:`int` idx, :ref:`float` time, :ref:`Vector3` loc, :ref:`Quat` rot, :ref:`Vector3` scale **)** Insert a transform key for a transform track. .. _class_Animation_transform_track_interpolate: - :ref:`Array` **transform_track_interpolate** **(** :ref:`int` idx, :ref:`float` time_sec **)** const Return the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position (:ref:`Vector3`), rotation (:ref:`Quat`) and scale (:ref:`Vector3`). .. _class_Animation_value_track_get_key_indices: - :ref:`PoolIntArray` **value_track_get_key_indices** **(** :ref:`int` idx, :ref:`float` time_sec, :ref:`float` delta **)** const Return all the key indices of a value track, given a position and delta time. .. _class_Animation_value_track_get_update_mode: - :ref:`int` **value_track_get_update_mode** **(** :ref:`int` idx **)** const .. _class_Animation_value_track_set_update_mode: - void **value_track_set_update_mode** **(** :ref:`int` idx, :ref:`int` mode **)**