Class Animation - RST
Class Animation - RST
.. _class_Animation:
Animation
=========
**Inherits:** :ref:`Resource<class_Resource>`
**<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
.. rst-class:: classref-introduction-group
Description
-----------
This resource holds data that can be used to animate anything 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.
.. tabs::
.. code-tab:: gdscript
# This creates an animation that makes the node "Enemy" move to the right by
# 100 pixels in 2.0 seconds.
var animation = Animation.new()
var track_index = animation.add_track(Animation.TYPE_VALUE)
animation.track_set_path(track_index, "Enemy:position:x")
animation.track_insert_key(track_index, 0.0, 0)
animation.track_insert_key(track_index, 2.0, 100)
animation.length = 2.0
.. code-tab:: csharp
// This creates an animation that makes the node "Enemy" move to the right by
// 100 pixels in 2.0 seconds.
var animation = new Animation();
int trackIndex = animation.AddTrack(Animation.TrackType.Value);
animation.TrackSetPath(trackIndex, "Enemy:position:x");
animation.TrackInsertKey(trackIndex, 0.0f, 0);
animation.TrackInsertKey(trackIndex, 2.0f, 100);
animation.Length = 2.0f;
Animations are just data containers, and must be added to nodes such as
an :ref:`AnimationPlayer<class_AnimationPlayer>` to be played back. Animation
tracks have different types, each with its own set of dedicated methods.
Check :ref:`TrackType<enum_Animation_TrackType>` to see available types.
.. rst-class:: classref-introduction-group
Tutorials
---------
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+------------------------------------------
+--------------------------------------------------------------------
+---------------+
| :ref:`bool<class_bool>`
| :ref:`capture_included<class_Animation_property_capture_included>` | ``false``
|
+------------------------------------------
+--------------------------------------------------------------------
+---------------+
| :ref:`float<class_float>`
| :ref:`length<class_Animation_property_length>` | ``1.0``
|
+------------------------------------------
+--------------------------------------------------------------------
+---------------+
| :ref:`LoopMode<enum_Animation_LoopMode>`
| :ref:`loop_mode<class_Animation_property_loop_mode>` | ``0``
|
+------------------------------------------
+--------------------------------------------------------------------
+---------------+
| :ref:`float<class_float>`
| :ref:`step<class_Animation_property_step>` |
``0.0333333`` |
+------------------------------------------
+--------------------------------------------------------------------
+---------------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`add_track<class_Animation_method_add_track>`\ (\
type\: :ref:`TrackType<enum_Animation_TrackType>`,
at_position\: :ref:`int<class_int>` = -1\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`StringName<class_StringName>`
| :ref:`animation_track_get_key_animation<class_Animation_method_animation_track_ge
t_key_animation>`\ (\ track_idx\: :ref:`int<class_int>`,
key_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`animation_track_insert_key<class_Animation_method_animation_track_insert_ke
y>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
animation\: :ref:`StringName<class_StringName>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`animation_track_set_key_animation<class_Animation_method_animation_track_se
t_key_animation>`\ (\ track_idx\: :ref:`int<class_int>`,
key_idx\: :ref:`int<class_int>`, animation\: :ref:`StringName<class_StringName>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`float<class_float>`
| :ref:`audio_track_get_key_end_offset<class_Animation_method_audio_track_get_key_e
nd_offset>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\
) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`float<class_float>`
| :ref:`audio_track_get_key_start_offset<class_Animation_method_audio_track_get_key
_start_offset>`\ (\ track_idx\: :ref:`int<class_int>`,
key_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`Resource<class_Resource>`
| :ref:`audio_track_get_key_stream<class_Animation_method_audio_track_get_key_strea
m>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`audio_track_insert_key<class_Animation_method_audio_track_insert_key>`\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
stream\: :ref:`Resource<class_Resource>`, start_offset\: :ref:`float<class_float>`
= 0, end_offset\: :ref:`float<class_float>` = 0\ ) |
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`bool<class_bool>`
| :ref:`audio_track_is_use_blend<class_Animation_method_audio_track_is_use_blend>`\
(\ track_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`audio_track_set_key_end_offset<class_Animation_method_audio_track_set_key_e
nd_offset>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`,
offset\: :ref:`float<class_float>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`audio_track_set_key_start_offset<class_Animation_method_audio_track_set_key
_start_offset>`\ (\ track_idx\: :ref:`int<class_int>`,
key_idx\: :ref:`int<class_int>`, offset\: :ref:`float<class_float>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`audio_track_set_key_stream<class_Animation_method_audio_track_set_key_strea
m>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`,
stream\: :ref:`Resource<class_Resource>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`audio_track_set_use_blend<class_Animation_method_audio_track_set_use_blend>
`\ (\ track_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>`
| :ref:`bezier_track_get_key_in_handle<class_Animation_method_bezier_track_get_key_
in_handle>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\
) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>`
| :ref:`bezier_track_get_key_out_handle<class_Animation_method_bezier_track_get_key
_out_handle>`\ (\ track_idx\: :ref:`int<class_int>`,
key_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`float<class_float>`
| :ref:`bezier_track_get_key_value<class_Animation_method_bezier_track_get_key_valu
e>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`bezier_track_insert_key<class_Animation_method_bezier_track_insert_key>`\
(\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
value\: :ref:`float<class_float>`, in_handle\: :ref:`Vector2<class_Vector2>` =
Vector2(0, 0), out_handle\: :ref:`Vector2<class_Vector2>` = Vector2(0, 0)\ ) |
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`float<class_float>`
| :ref:`bezier_track_interpolate<class_Animation_method_bezier_track_interpolate>`\
(\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`bezier_track_set_key_in_handle<class_Animation_method_bezier_track_set_key_
in_handle>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`,
in_handle\: :ref:`Vector2<class_Vector2>`,
balanced_value_time_ratio\: :ref:`float<class_float>` = 1.0\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`bezier_track_set_key_out_handle<class_Animation_method_bezier_track_set_key
_out_handle>`\ (\ track_idx\: :ref:`int<class_int>`,
key_idx\: :ref:`int<class_int>`, out_handle\: :ref:`Vector2<class_Vector2>`,
balanced_value_time_ratio\: :ref:`float<class_float>` = 1.0\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`bezier_track_set_key_value<class_Animation_method_bezier_track_set_key_valu
e>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, value\:
:ref:`float<class_float>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`blend_shape_track_insert_key<class_Animation_method_blend_shape_track_inser
t_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
amount\: :ref:`float<class_float>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`float<class_float>`
| :ref:`blend_shape_track_interpolate<class_Animation_method_blend_shape_track_inte
rpolate>`\ (\ track_idx\: :ref:`int<class_int>`,
time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ )
|const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`clear<class_Animation_method_clear>`\ (\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`compress<class_Animation_method_compress>`\ (\
page_size\: :ref:`int<class_int>` = 8192, fps\: :ref:`int<class_int>` = 120,
split_tolerance\: :ref:`float<class_float>` = 4.0\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`copy_track<class_Animation_method_copy_track>`\ (\
track_idx\: :ref:`int<class_int>`,
to_animation\: :ref:`Animation<class_Animation>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`find_track<class_Animation_method_find_track>`\ (\
path\: :ref:`NodePath<class_NodePath>`,
type\: :ref:`TrackType<enum_Animation_TrackType>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`get_track_count<class_Animation_method_get_track_count>`\ (\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`StringName<class_StringName>`
| :ref:`method_track_get_name<class_Animation_method_method_track_get_name>`\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`Array<class_Array>`
| :ref:`method_track_get_params<class_Animation_method_method_track_get_params>`\
(\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`position_track_insert_key<class_Animation_method_position_track_insert_key>
`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
position\: :ref:`Vector3<class_Vector3>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>`
| :ref:`position_track_interpolate<class_Animation_method_position_track_interpolat
e>`\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`,
backward\: :ref:`bool<class_bool>` = false\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`remove_track<class_Animation_method_remove_track>`\ (\
track_idx\: :ref:`int<class_int>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`rotation_track_insert_key<class_Animation_method_rotation_track_insert_key>
`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
rotation\: :ref:`Quaternion<class_Quaternion>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`Quaternion<class_Quaternion>`
| :ref:`rotation_track_interpolate<class_Animation_method_rotation_track_interpolat
e>`\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`,
backward\: :ref:`bool<class_bool>` = false\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`scale_track_insert_key<class_Animation_method_scale_track_insert_key>`\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
scale\: :ref:`Vector3<class_Vector3>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>`
| :ref:`scale_track_interpolate<class_Animation_method_scale_track_interpolate>`\
(\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`,
backward\: :ref:`bool<class_bool>` = false\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`track_find_key<class_Animation_method_track_find_key>`\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
find_mode\: :ref:`FindMode<enum_Animation_FindMode>` = 0,
limit\: :ref:`bool<class_bool>` = false, backward\: :ref:`bool<class_bool>` =
false\ ) |const| |
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`bool<class_bool>`
| :ref:`track_get_interpolation_loop_wrap<class_Animation_method_track_get_interpol
ation_loop_wrap>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`InterpolationType<enum_Animation_InterpolationType>`
| :ref:`track_get_interpolation_type<class_Animation_method_track_get_interpolation
_type>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`track_get_key_count<class_Animation_method_track_get_key_count>`\ (\
track_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`float<class_float>`
| :ref:`track_get_key_time<class_Animation_method_track_get_key_time>`\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`float<class_float>`
| :ref:`track_get_key_transition<class_Animation_method_track_get_key_transition>`\
(\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`Variant<class_Variant>`
| :ref:`track_get_key_value<class_Animation_method_track_get_key_value>`\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`NodePath<class_NodePath>`
| :ref:`track_get_path<class_Animation_method_track_get_path>`\ (\
track_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`TrackType<enum_Animation_TrackType>`
| :ref:`track_get_type<class_Animation_method_track_get_type>`\ (\
track_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`int<class_int>`
| :ref:`track_insert_key<class_Animation_method_track_insert_key>`\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
key\: :ref:`Variant<class_Variant>`, transition\: :ref:`float<class_float>` = 1\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`bool<class_bool>`
| :ref:`track_is_compressed<class_Animation_method_track_is_compressed>`\ (\
track_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`bool<class_bool>`
| :ref:`track_is_enabled<class_Animation_method_track_is_enabled>`\ (\
track_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`bool<class_bool>`
| :ref:`track_is_imported<class_Animation_method_track_is_imported>`\ (\
track_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_move_down<class_Animation_method_track_move_down>`\ (\
track_idx\: :ref:`int<class_int>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_move_to<class_Animation_method_track_move_to>`\ (\
track_idx\: :ref:`int<class_int>`, to_idx\: :ref:`int<class_int>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_move_up<class_Animation_method_track_move_up>`\ (\
track_idx\: :ref:`int<class_int>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_remove_key<class_Animation_method_track_remove_key>`\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_remove_key_at_time<class_Animation_method_track_remove_key_at_time>`\
(\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_set_enabled<class_Animation_method_track_set_enabled>`\ (\
track_idx\: :ref:`int<class_int>`, enabled\: :ref:`bool<class_bool>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_set_imported<class_Animation_method_track_set_imported>`\ (\
track_idx\: :ref:`int<class_int>`, imported\: :ref:`bool<class_bool>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_set_interpolation_loop_wrap<class_Animation_method_track_set_interpol
ation_loop_wrap>`\ (\ track_idx\: :ref:`int<class_int>`,
interpolation\: :ref:`bool<class_bool>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_set_interpolation_type<class_Animation_method_track_set_interpolation
_type>`\ (\ track_idx\: :ref:`int<class_int>`,
interpolation\: :ref:`InterpolationType<enum_Animation_InterpolationType>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_set_key_time<class_Animation_method_track_set_key_time>`\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`,
time\: :ref:`float<class_float>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_set_key_transition<class_Animation_method_track_set_key_transition>`\
(\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, transition\:
:ref:`float<class_float>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_set_key_value<class_Animation_method_track_set_key_value>`\ (\
track_idx\: :ref:`int<class_int>`, key\: :ref:`int<class_int>`,
value\: :ref:`Variant<class_Variant>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_set_path<class_Animation_method_track_set_path>`\ (\
track_idx\: :ref:`int<class_int>`, path\: :ref:`NodePath<class_NodePath>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`track_swap<class_Animation_method_track_swap>`\ (\
track_idx\: :ref:`int<class_int>`, with_idx\: :ref:`int<class_int>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`UpdateMode<enum_Animation_UpdateMode>`
| :ref:`value_track_get_update_mode<class_Animation_method_value_track_get_update_m
ode>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| :ref:`Variant<class_Variant>`
| :ref:`value_track_interpolate<class_Animation_method_value_track_interpolate>`\
(\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`,
backward\: :ref:`bool<class_bool>` = false\ ) |const|
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
| |void|
| :ref:`value_track_set_update_mode<class_Animation_method_value_track_set_update_m
ode>`\ (\ track_idx\: :ref:`int<class_int>`,
mode\: :ref:`UpdateMode<enum_Animation_UpdateMode>`\ )
|
+------------------------------------------------------------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Enumerations
------------
.. _enum_Animation_TrackType:
.. rst-class:: classref-enumeration
.. _class_Animation_constant_TYPE_VALUE:
.. rst-class:: classref-enumeration-constant
Value tracks set values in node properties, but only those which can be
interpolated. For 3D position/rotation/scale, using the
dedicated :ref:`TYPE_POSITION_3D<class_Animation_constant_TYPE_POSITION_3D>`, :ref:
`TYPE_ROTATION_3D<class_Animation_constant_TYPE_ROTATION_3D>`
and :ref:`TYPE_SCALE_3D<class_Animation_constant_TYPE_SCALE_3D>` track types
instead of :ref:`TYPE_VALUE<class_Animation_constant_TYPE_VALUE>` is recommended
for performance reasons.
.. _class_Animation_constant_TYPE_POSITION_3D:
.. rst-class:: classref-enumeration-constant
.. _class_Animation_constant_TYPE_ROTATION_3D:
.. rst-class:: classref-enumeration-constant
.. _class_Animation_constant_TYPE_SCALE_3D:
.. rst-class:: classref-enumeration-constant
.. _class_Animation_constant_TYPE_BLEND_SHAPE:
.. rst-class:: classref-enumeration-constant
.. _class_Animation_constant_TYPE_METHOD:
.. rst-class:: classref-enumeration-constant
.. _class_Animation_constant_TYPE_BEZIER:
.. rst-class:: classref-enumeration-constant
Bezier tracks are used to interpolate a value using custom curves. They can also be
used to animate sub-properties of vectors and colors (e.g. alpha value of
a :ref:`Color<class_Color>`).
.. _class_Animation_constant_TYPE_AUDIO:
.. rst-class:: classref-enumeration-constant
Audio tracks are used to play an audio stream with either type
of :ref:`AudioStreamPlayer<class_AudioStreamPlayer>`. The stream can be trimmed and
previewed in the animation.
.. _class_Animation_constant_TYPE_ANIMATION:
.. rst-class:: classref-enumeration-constant
.. rst-class:: classref-item-separator
----
.. _enum_Animation_InterpolationType:
.. rst-class:: classref-enumeration
.. _class_Animation_constant_INTERPOLATION_NEAREST:
.. rst-class:: classref-enumeration-constant
:ref:`InterpolationType<enum_Animation_InterpolationType>`
**INTERPOLATION_NEAREST** = ``0``
.. rst-class:: classref-enumeration-constant
:ref:`InterpolationType<enum_Animation_InterpolationType>` **INTERPOLATION_LINEAR**
= ``1``
Linear interpolation.
.. _class_Animation_constant_INTERPOLATION_CUBIC:
.. rst-class:: classref-enumeration-constant
:ref:`InterpolationType<enum_Animation_InterpolationType>` **INTERPOLATION_CUBIC**
= ``2``
Cubic interpolation. This looks smoother than linear interpolation, but is more
expensive to interpolate. Stick
to :ref:`INTERPOLATION_LINEAR<class_Animation_constant_INTERPOLATION_LINEAR>` for
complex 3D animations imported from external software, even if it requires using a
higher animation framerate in return.
.. _class_Animation_constant_INTERPOLATION_LINEAR_ANGLE:
.. rst-class:: classref-enumeration-constant
:ref:`InterpolationType<enum_Animation_InterpolationType>`
**INTERPOLATION_LINEAR_ANGLE** = ``3``
\ **Note:** The result value is always normalized and may not match the key value.
.. _class_Animation_constant_INTERPOLATION_CUBIC_ANGLE:
.. rst-class:: classref-enumeration-constant
:ref:`InterpolationType<enum_Animation_InterpolationType>`
**INTERPOLATION_CUBIC_ANGLE** = ``4``
\ **Note:** The result value is always normalized and may not match the key value.
.. rst-class:: classref-item-separator
----
.. _enum_Animation_UpdateMode:
.. rst-class:: classref-enumeration
.. _class_Animation_constant_UPDATE_CONTINUOUS:
.. rst-class:: classref-enumeration-constant
.. _class_Animation_constant_UPDATE_DISCRETE:
.. rst-class:: classref-enumeration-constant
.. _class_Animation_constant_UPDATE_CAPTURE:
.. rst-class:: classref-enumeration-constant
.. rst-class:: classref-item-separator
----
.. _enum_Animation_LoopMode:
.. rst-class:: classref-enumeration
.. _class_Animation_constant_LOOP_NONE:
.. rst-class:: classref-enumeration-constant
.. _class_Animation_constant_LOOP_LINEAR:
.. rst-class:: classref-enumeration-constant
At both ends of the animation, the animation will be repeated without changing the
playback direction.
.. _class_Animation_constant_LOOP_PINGPONG:
.. rst-class:: classref-enumeration-constant
.. rst-class:: classref-item-separator
----
.. _enum_Animation_LoopedFlag:
.. rst-class:: classref-enumeration
.. _class_Animation_constant_LOOPED_FLAG_NONE:
.. rst-class:: classref-enumeration-constant
This flag indicates that the animation proceeds without any looping.
.. _class_Animation_constant_LOOPED_FLAG_END:
.. rst-class:: classref-enumeration-constant
This flag indicates that the animation has reached the end of the animation and
just after loop processed.
.. _class_Animation_constant_LOOPED_FLAG_START:
.. rst-class:: classref-enumeration-constant
This flag indicates that the animation has reached the start of the animation and
just after loop processed.
.. rst-class:: classref-item-separator
----
.. _enum_Animation_FindMode:
.. rst-class:: classref-enumeration
.. _class_Animation_constant_FIND_MODE_NEAREST:
.. rst-class:: classref-enumeration-constant
.. _class_Animation_constant_FIND_MODE_APPROX:
.. rst-class:: classref-enumeration-constant
:ref:`FindMode<enum_Animation_FindMode>` **FIND_MODE_APPROX** = ``1``
.. _class_Animation_constant_FIND_MODE_EXACT:
.. rst-class:: classref-enumeration-constant
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_Animation_property_capture_included:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **capture_included** =
``false`` :ref:`🔗<class_Animation_property_capture_included>`
.. rst-class:: classref-property-setget
- :ref:`bool<class_bool>` **is_capture_included**\ (\ )
Returns ``true`` if the capture track is included. This is a cached readonly value
for performance.
.. rst-class:: classref-item-separator
----
.. _class_Animation_property_length:
.. rst-class:: classref-property
:ref:`float<class_float>` **length** =
``1.0`` :ref:`🔗<class_Animation_property_length>`
.. rst-class:: classref-property-setget
\ **Note:** Length is not delimited by the last key, as this one may be before or
after the end to ensure correct interpolation and looping.
.. rst-class:: classref-item-separator
----
.. _class_Animation_property_loop_mode:
.. rst-class:: classref-property
:ref:`LoopMode<enum_Animation_LoopMode>` **loop_mode** =
``0`` :ref:`🔗<class_Animation_property_loop_mode>`
.. rst-class:: classref-property-setget
Determines the behavior of both ends of the animation timeline during animation
playback. This is used for correct interpolation of animation cycles, and for
hinting the player that it must restart the animation.
.. rst-class:: classref-item-separator
----
.. _class_Animation_property_step:
.. rst-class:: classref-property
:ref:`float<class_float>` **step** =
``0.0333333`` :ref:`🔗<class_Animation_property_step>`
.. rst-class:: classref-property-setget
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_Animation_method_add_track:
.. rst-class:: classref-method
:ref:`int<class_int>` **add_track**\ (\
type\: :ref:`TrackType<enum_Animation_TrackType>`,
at_position\: :ref:`int<class_int>` = -
1\ ) :ref:`🔗<class_Animation_method_add_track>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_animation_track_get_key_animation:
.. rst-class:: classref-method
:ref:`StringName<class_StringName>` **animation_track_get_key_animation**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_animation_track_get_key_animation>`
Returns the animation name at the key identified by ``key_idx``. The ``track_idx``
must be the index of an Animation Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_animation_track_insert_key:
.. rst-class:: classref-method
:ref:`int<class_int>` **animation_track_insert_key**\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
animation\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_Animation_method_a
nimation_track_insert_key>`
Inserts a key with value ``animation`` at the given ``time`` (in seconds). The
``track_idx`` must be the index of an Animation Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_animation_track_set_key_animation:
.. rst-class:: classref-method
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_audio_track_get_key_end_offset:
.. rst-class:: classref-method
:ref:`float<class_float>` **audio_track_get_key_end_offset**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_audio_track_get_key_end_offset>`
Returns the end offset of the key identified by ``key_idx``. The ``track_idx`` must
be the index of an Audio Track.
End offset is the number of seconds cut off at the ending of the audio stream.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_audio_track_get_key_start_offset:
.. rst-class:: classref-method
:ref:`float<class_float>` **audio_track_get_key_start_offset**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_audio_track_get_key_start_offset>`
Returns the start offset of the key identified by ``key_idx``. The ``track_idx``
must be the index of an Audio Track.
Start offset is the number of seconds cut off at the beginning of the audio stream.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_audio_track_get_key_stream:
.. rst-class:: classref-method
:ref:`Resource<class_Resource>` **audio_track_get_key_stream**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_audio_track_get_key_stream>`
Returns the audio stream of the key identified by ``key_idx``. The ``track_idx``
must be the index of an Audio Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_audio_track_insert_key:
.. rst-class:: classref-method
:ref:`int<class_int>` **audio_track_insert_key**\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
stream\: :ref:`Resource<class_Resource>`, start_offset\: :ref:`float<class_float>`
= 0, end_offset\: :ref:`float<class_float>` =
0\ ) :ref:`🔗<class_Animation_method_audio_track_insert_key>`
Inserts an Audio Track key at the given ``time`` in seconds. The ``track_idx`` must
be the index of an Audio Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_audio_track_is_use_blend:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **audio_track_is_use_blend**\ (\
track_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_audio_track_is_use_blend>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_audio_track_set_key_end_offset:
.. rst-class:: classref-method
Sets the end offset of the key identified by ``key_idx`` to value ``offset``. The
``track_idx`` must be the index of an Audio Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_audio_track_set_key_start_offset:
.. rst-class:: classref-method
Sets the start offset of the key identified by ``key_idx`` to value ``offset``. The
``track_idx`` must be the index of an Audio Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_audio_track_set_key_stream:
.. rst-class:: classref-method
Sets the stream of the key identified by ``key_idx`` to value ``stream``. The
``track_idx`` must be the index of an Audio Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_audio_track_set_use_blend:
.. rst-class:: classref-method
Sets whether the track will be blended with other animations. If ``true``, the
audio playback volume changes depending on the blend value.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_bezier_track_get_key_in_handle:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **bezier_track_get_key_in_handle**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_bezier_track_get_key_in_handle>`
Returns the in handle of the key identified by ``key_idx``. The ``track_idx`` must
be the index of a Bezier Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_bezier_track_get_key_out_handle:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **bezier_track_get_key_out_handle**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_bezier_track_get_key_out_handle>`
Returns the out handle of the key identified by ``key_idx``. The ``track_idx`` must
be the index of a Bezier Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_bezier_track_get_key_value:
.. rst-class:: classref-method
:ref:`float<class_float>` **bezier_track_get_key_value**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_bezier_track_get_key_value>`
Returns the value of the key identified by ``key_idx``. The ``track_idx`` must be
the index of a Bezier Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_bezier_track_insert_key:
.. rst-class:: classref-method
:ref:`int<class_int>` **bezier_track_insert_key**\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
value\: :ref:`float<class_float>`, in_handle\: :ref:`Vector2<class_Vector2>` =
Vector2(0, 0), out_handle\: :ref:`Vector2<class_Vector2>` = Vector2(0,
0)\ ) :ref:`🔗<class_Animation_method_bezier_track_insert_key>`
Inserts a Bezier Track key at the given ``time`` in seconds. The ``track_idx`` must
be the index of a Bezier Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_bezier_track_interpolate:
.. rst-class:: classref-method
:ref:`float<class_float>` **bezier_track_interpolate**\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`\ ) |
const| :ref:`🔗<class_Animation_method_bezier_track_interpolate>`
Returns the interpolated value at the given ``time`` (in seconds). The
``track_idx`` must be the index of a Bezier Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_bezier_track_set_key_in_handle:
.. rst-class:: classref-method
Sets the in handle of the key identified by ``key_idx`` to value ``in_handle``. The
``track_idx`` must be the index of a Bezier Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_bezier_track_set_key_out_handle:
.. rst-class:: classref-method
|void| **bezier_track_set_key_out_handle**\ (\ track_idx\: :ref:`int<class_int>`,
key_idx\: :ref:`int<class_int>`, out_handle\: :ref:`Vector2<class_Vector2>`,
balanced_value_time_ratio\: :ref:`float<class_float>` =
1.0\ ) :ref:`🔗<class_Animation_method_bezier_track_set_key_out_handle>`
Sets the out handle of the key identified by ``key_idx`` to value ``out_handle``.
The ``track_idx`` must be the index of a Bezier Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_bezier_track_set_key_value:
.. rst-class:: classref-method
Sets the value of the key identified by ``key_idx`` to the given value. The
``track_idx`` must be the index of a Bezier Track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_blend_shape_track_insert_key:
.. rst-class:: classref-method
:ref:`int<class_int>` **blend_shape_track_insert_key**\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
amount\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Animation_method_blend_shape_tr
ack_insert_key>`
Inserts a key in a given blend shape track. Returns the key index.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_blend_shape_track_interpolate:
.. rst-class:: classref-method
:ref:`float<class_float>` **blend_shape_track_interpolate**\ (\
track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\:
:ref:`bool<class_bool>` = false\ ) |
const| :ref:`🔗<class_Animation_method_blend_shape_track_interpolate>`
Returns the interpolated blend shape value at the given time (in seconds). The
``track_idx`` must be the index of a blend shape track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_clear:
.. rst-class:: classref-method
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_compress:
.. rst-class:: classref-method
Compress the animation and all its tracks in-place. This will
make :ref:`track_is_compressed<class_Animation_method_track_is_compressed>` return
``true`` once called on this **Animation**. Compressed tracks require less memory
to be played, and are designed to be used for complex 3D animations (such as
cutscenes) imported from external 3D software. Compression is lossy, but the
difference is usually not noticeable in real world conditions.
\ **Note:** Compressed tracks have various limitations (such as not being editable
from the editor), so only use compressed animations if you actually need them.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_copy_track:
.. rst-class:: classref-method
Adds a new track to ``to_animation`` that is a copy of the given track from this
animation.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_find_track:
.. rst-class:: classref-method
Returns the index of the specified track. If the track is not found, return -1.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_get_track_count:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_track_count**\ (\ ) |
const| :ref:`🔗<class_Animation_method_get_track_count>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_method_track_get_name:
.. rst-class:: classref-method
:ref:`StringName<class_StringName>` **method_track_get_name**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_method_track_get_name>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_method_track_get_params:
.. rst-class:: classref-method
:ref:`Array<class_Array>` **method_track_get_params**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_method_track_get_params>`
Returns the arguments values to be called on a method track for a given key in a
given track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_position_track_insert_key:
.. rst-class:: classref-method
:ref:`int<class_int>` **position_track_insert_key**\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
position\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Animation_method_position
_track_insert_key>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_position_track_interpolate:
.. rst-class:: classref-method
:ref:`Vector3<class_Vector3>` **position_track_interpolate**\ (\
track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\:
:ref:`bool<class_bool>` = false\ ) |
const| :ref:`🔗<class_Animation_method_position_track_interpolate>`
Returns the interpolated position value at the given time (in seconds). The
``track_idx`` must be the index of a 3D position track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_remove_track:
.. rst-class:: classref-method
|void| **remove_track**\ (\
track_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Animation_method_remove_track>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_rotation_track_insert_key:
.. rst-class:: classref-method
:ref:`int<class_int>` **rotation_track_insert_key**\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
rotation\: :ref:`Quaternion<class_Quaternion>`\ ) :ref:`🔗<class_Animation_method_ro
tation_track_insert_key>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_rotation_track_interpolate:
.. rst-class:: classref-method
:ref:`Quaternion<class_Quaternion>` **rotation_track_interpolate**\ (\
track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\:
:ref:`bool<class_bool>` = false\ ) |
const| :ref:`🔗<class_Animation_method_rotation_track_interpolate>`
Returns the interpolated rotation value at the given time (in seconds). The
``track_idx`` must be the index of a 3D rotation track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_scale_track_insert_key:
.. rst-class:: classref-method
:ref:`int<class_int>` **scale_track_insert_key**\ (\
track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`,
scale\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Animation_method_scale_track
_insert_key>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_scale_track_interpolate:
.. rst-class:: classref-method
:ref:`Vector3<class_Vector3>` **scale_track_interpolate**\ (\
track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\:
:ref:`bool<class_bool>` = false\ ) |
const| :ref:`🔗<class_Animation_method_scale_track_interpolate>`
Returns the interpolated scale value at the given time (in seconds). The
``track_idx`` must be the index of a 3D scale track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_find_key:
.. rst-class:: classref-method
Finds the key index by time in a given track. Optionally, only find it if the
approx/exact time is given.
If ``limit`` is ``true``, it does not return keys outside the animation range.
----
.. _class_Animation_method_track_get_interpolation_loop_wrap:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **track_get_interpolation_loop_wrap**\ (\
track_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_track_get_interpolation_loop_wrap>`
Returns ``true`` if the track at ``track_idx`` wraps the interpolation loop. New
tracks wrap the interpolation loop by default.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_get_interpolation_type:
.. rst-class:: classref-method
:ref:`InterpolationType<enum_Animation_InterpolationType>`
**track_get_interpolation_type**\ (\ track_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_track_get_interpolation_type>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_get_key_count:
.. rst-class:: classref-method
:ref:`int<class_int>` **track_get_key_count**\ (\
track_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_track_get_key_count>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_get_key_time:
.. rst-class:: classref-method
:ref:`float<class_float>` **track_get_key_time**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_track_get_key_time>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_get_key_transition:
.. rst-class:: classref-method
:ref:`float<class_float>` **track_get_key_transition**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_track_get_key_transition>`
Returns the transition curve (easing) for a specific key (see the built-in math
function :ref:`@GlobalScope.ease<class_@GlobalScope_method_ease>`).
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_get_key_value:
.. rst-class:: classref-method
:ref:`Variant<class_Variant>` **track_get_key_value**\ (\
track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_track_get_key_value>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_get_path:
.. rst-class:: classref-method
:ref:`NodePath<class_NodePath>` **track_get_path**\ (\
track_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_track_get_path>`
Gets the path of a track. For more information on the path format,
see :ref:`track_set_path<class_Animation_method_track_set_path>`.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_get_type:
.. rst-class:: classref-method
:ref:`TrackType<enum_Animation_TrackType>` **track_get_type**\ (\
track_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_track_get_type>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_insert_key:
.. rst-class:: classref-method
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_is_compressed:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **track_is_compressed**\ (\
track_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_track_is_compressed>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_is_enabled:
.. rst-class:: classref-method
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_is_imported:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **track_is_imported**\ (\
track_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_track_is_imported>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_move_down:
.. rst-class:: classref-method
|void| **track_move_down**\ (\
track_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Animation_method_track_move_down
>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_move_to:
.. rst-class:: classref-method
Changes the index position of track ``track_idx`` to the one defined in ``to_idx``.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_move_up:
.. rst-class:: classref-method
|void| **track_move_up**\ (\
track_idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Animation_method_track_move_up>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_remove_key:
.. rst-class:: classref-method
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_remove_key_at_time:
.. rst-class:: classref-method
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_set_enabled:
.. rst-class:: classref-method
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_set_imported:
.. rst-class:: classref-method
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_set_interpolation_loop_wrap:
.. rst-class:: classref-method
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_set_interpolation_type:
.. rst-class:: classref-method
----
.. _class_Animation_method_track_set_key_time:
.. rst-class:: classref-method
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_set_key_transition:
.. rst-class:: classref-method
Sets the transition curve (easing) for a specific key (see the built-in math
function :ref:`@GlobalScope.ease<class_@GlobalScope_method_ease>`).
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_set_key_value:
.. rst-class:: classref-method
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_set_path:
.. rst-class:: classref-method
Sets 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 ``":"``.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_track_swap:
.. rst-class:: classref-method
Swaps the track ``track_idx``'s index position with the track ``with_idx``.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_value_track_get_update_mode:
.. rst-class:: classref-method
:ref:`UpdateMode<enum_Animation_UpdateMode>` **value_track_get_update_mode**\ (\
track_idx\: :ref:`int<class_int>`\ ) |
const| :ref:`🔗<class_Animation_method_value_track_get_update_mode>`
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_value_track_interpolate:
.. rst-class:: classref-method
:ref:`Variant<class_Variant>` **value_track_interpolate**\ (\
track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\:
:ref:`bool<class_bool>` = false\ ) |
const| :ref:`🔗<class_Animation_method_value_track_interpolate>`
Returns the interpolated value at the given time (in seconds). The ``track_idx``
must be the index of a value track.
.. rst-class:: classref-item-separator
----
.. _class_Animation_method_value_track_set_update_mode:
.. rst-class:: classref-method