Contains data used to animate everything in the engine.
- 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
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.
Member Function Description¶
Add a track to the Animation. The track type must be specified as any of the values in the TYPE_* enumeration.
- void clear ( )
Clear the animation (clear all tracks and reset all).
Return the index of the specified track. If the track is not found, return -1.
- float get_length ( ) const
Return the total length of the animation (in seconds).
- float get_step ( ) const
Get the animation step value.
- int get_track_count ( ) const
Return the amount of tracks in the animation.
- bool has_loop ( ) const
Return whether the animation has the loop flag set.
Return all the key indices of a method track, given a position and delta time.
Return the method name of a method track.
Return the arguments values to be called on a method track for a given key in a given track.
- void remove_track ( int idx )
Remove a track by specifying the track index.
- void set_length ( 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.
- void set_loop ( 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.
- void set_step ( float size_sec )
Set the animation step value.
Find the key index by time in a given track. Optionally, only find it if the exact time is given.
Return the interpolation type of a given track, from the INTERPOLATION_* enum.
Return the amount of keys in a given track.
Return the time at which the key is located.
Return the transition curve (easing) for a specific key (see built-in math function “ease”).
Return the value of a given key in a given track.
Get the path of a track. for more information on the path format, see track_set_path
Get the type of a track.
Insert a generic key in a given track.
Return true if the given track is imported. Else, return false.
- void track_move_down ( int idx )
Move a track down.
- void track_move_up ( int idx )
Move a track up.
Remove a key by index in a given track.
Remove a key by position (seconds) in a given track.
Set the given track as imported or not.
Set the interpolation type of a given track, from the INTERPOLATION_* enum.
Set the transition curve (easing) for a specific key (see built-in math function “ease”).
Set the value of an existing key.
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”
Insert a transform key for a transform track.
Return all the key indices of a value track, given a position and delta time.