mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
Sync classref with master branch (4.0 changes)
This commit is contained in:
@@ -28,7 +28,7 @@ An Animation resource contains data used to animate everything in the engine. An
|
||||
animation.track_insert_key(track_index, 0.0, 0)
|
||||
animation.track_insert_key(track_index, 0.5, 100)
|
||||
|
||||
Animations are just data containers, and must be added to nodes such as an :ref:`AnimationPlayer<class_AnimationPlayer>` or :ref:`AnimationTreePlayer<class_AnimationTreePlayer>` to be played back.
|
||||
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.
|
||||
|
||||
Tutorials
|
||||
---------
|
||||
@@ -52,11 +52,11 @@ Methods
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`add_track<class_Animation_method_add_track>` **(** :ref:`TrackType<enum_Animation_TrackType>` type, :ref:`int<class_int>` at_position=-1 **)** |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`String<class_String>` | :ref:`animation_track_get_key_animation<class_Animation_method_animation_track_get_key_animation>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const |
|
||||
| :ref:`StringName<class_StringName>` | :ref:`animation_track_get_key_animation<class_Animation_method_animation_track_get_key_animation>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`animation_track_insert_key<class_Animation_method_animation_track_insert_key>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`String<class_String>` animation **)** |
|
||||
| :ref:`int<class_int>` | :ref:`animation_track_insert_key<class_Animation_method_animation_track_insert_key>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`StringName<class_StringName>` animation **)** |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`animation_track_set_key_animation<class_Animation_method_animation_track_set_key_animation>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`String<class_String>` animation **)** |
|
||||
| void | :ref:`animation_track_set_key_animation<class_Animation_method_animation_track_set_key_animation>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`StringName<class_StringName>` animation **)** |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`float<class_float>` | :ref:`audio_track_get_key_end_offset<class_Animation_method_audio_track_get_key_end_offset>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
@@ -96,9 +96,9 @@ Methods
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_track_count<class_Animation_method_get_track_count>` **(** **)** const |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`method_track_get_key_indices<class_Animation_method_method_track_get_key_indices>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const |
|
||||
| :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`method_track_get_key_indices<class_Animation_method_method_track_get_key_indices>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`String<class_String>` | :ref:`method_track_get_name<class_Animation_method_method_track_get_name>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const |
|
||||
| :ref:`StringName<class_StringName>` | :ref:`method_track_get_name<class_Animation_method_method_track_get_name>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Array<class_Array>` | :ref:`method_track_get_params<class_Animation_method_method_track_get_params>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
@@ -160,7 +160,7 @@ Methods
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Array<class_Array>` | :ref:`transform_track_interpolate<class_Animation_method_transform_track_interpolate>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec **)** const |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`value_track_get_key_indices<class_Animation_method_value_track_get_key_indices>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const |
|
||||
| :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`value_track_get_key_indices<class_Animation_method_value_track_get_key_indices>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`UpdateMode<enum_Animation_UpdateMode>` | :ref:`value_track_get_update_mode<class_Animation_method_value_track_get_update_mode>` **(** :ref:`int<class_int>` track_idx **)** const |
|
||||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
@@ -174,6 +174,8 @@ Signals
|
||||
|
||||
- **tracks_changed** **(** **)**
|
||||
|
||||
Emitted when there's a change in the list of tracks, e.g. tracks are added, moved or have changed paths.
|
||||
|
||||
Enumerations
|
||||
------------
|
||||
|
||||
@@ -199,11 +201,11 @@ enum **TrackType**:
|
||||
|
||||
- **TYPE_METHOD** = **2** --- Method tracks call functions with given arguments per key.
|
||||
|
||||
- **TYPE_BEZIER** = **3**
|
||||
- **TYPE_BEZIER** = **3** --- 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>`).
|
||||
|
||||
- **TYPE_AUDIO** = **4**
|
||||
- **TYPE_AUDIO** = **4** --- 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.
|
||||
|
||||
- **TYPE_ANIMATION** = **5**
|
||||
- **TYPE_ANIMATION** = **5** --- Animation tracks play animations in other :ref:`AnimationPlayer<class_AnimationPlayer>` nodes.
|
||||
|
||||
----
|
||||
|
||||
@@ -243,7 +245,7 @@ enum **UpdateMode**:
|
||||
|
||||
- **UPDATE_TRIGGER** = **2** --- Update at the keyframes.
|
||||
|
||||
- **UPDATE_CAPTURE** = **3**
|
||||
- **UPDATE_CAPTURE** = **3** --- Same as linear interpolation, but also interpolates from the current value (i.e. dynamically at runtime) if the first key isn't at 0 seconds.
|
||||
|
||||
Property Descriptions
|
||||
---------------------
|
||||
@@ -309,19 +311,25 @@ Adds a track to the Animation.
|
||||
|
||||
.. _class_Animation_method_animation_track_get_key_animation:
|
||||
|
||||
- :ref:`String<class_String>` **animation_track_get_key_animation** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const
|
||||
- :ref:`StringName<class_StringName>` **animation_track_get_key_animation** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const
|
||||
|
||||
Returns the animation name at the key identified by ``key_idx``. The ``track_idx`` must be the index of an Animation Track.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_animation_track_insert_key:
|
||||
|
||||
- :ref:`int<class_int>` **animation_track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`String<class_String>` animation **)**
|
||||
- :ref:`int<class_int>` **animation_track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`StringName<class_StringName>` animation **)**
|
||||
|
||||
Inserts a key with value ``animation`` at the given ``time`` (in seconds). The ``track_idx`` must be the index of an Animation Track.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_animation_track_set_key_animation:
|
||||
|
||||
- void **animation_track_set_key_animation** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`String<class_String>` animation **)**
|
||||
- void **animation_track_set_key_animation** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`StringName<class_StringName>` animation **)**
|
||||
|
||||
Sets the key identified by ``key_idx`` to value ``animation``. The ``track_idx`` must be the index of an Animation Track.
|
||||
|
||||
----
|
||||
|
||||
@@ -329,90 +337,128 @@ Adds a track to the Animation.
|
||||
|
||||
- :ref:`float<class_float>` **audio_track_get_key_end_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const
|
||||
|
||||
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.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_audio_track_get_key_start_offset:
|
||||
|
||||
- :ref:`float<class_float>` **audio_track_get_key_start_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const
|
||||
|
||||
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.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_audio_track_get_key_stream:
|
||||
|
||||
- :ref:`Resource<class_Resource>` **audio_track_get_key_stream** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const
|
||||
|
||||
Returns the audio stream of the key identified by ``key_idx``. The ``track_idx`` must be the index of an Audio Track.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_audio_track_insert_key:
|
||||
|
||||
- :ref:`int<class_int>` **audio_track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`Resource<class_Resource>` stream, :ref:`float<class_float>` start_offset=0, :ref:`float<class_float>` end_offset=0 **)**
|
||||
|
||||
Inserts an Audio Track key at the given ``time`` in seconds. The ``track_idx`` must be the index of an Audio Track.
|
||||
|
||||
``stream`` is the :ref:`AudioStream<class_AudioStream>` resource to play. ``start_offset`` is the number of seconds cut off at the beginning of the audio stream, while ``end_offset`` is at the ending.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_audio_track_set_key_end_offset:
|
||||
|
||||
- void **audio_track_set_key_end_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)**
|
||||
|
||||
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.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_audio_track_set_key_start_offset:
|
||||
|
||||
- void **audio_track_set_key_start_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)**
|
||||
|
||||
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.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_audio_track_set_key_stream:
|
||||
|
||||
- void **audio_track_set_key_stream** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`Resource<class_Resource>` stream **)**
|
||||
|
||||
Sets the stream of the key identified by ``key_idx`` to value ``offset``. The ``track_idx`` must be the index of an Audio Track.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_bezier_track_get_key_in_handle:
|
||||
|
||||
- :ref:`Vector2<class_Vector2>` **bezier_track_get_key_in_handle** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const
|
||||
|
||||
Returns the in handle of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_bezier_track_get_key_out_handle:
|
||||
|
||||
- :ref:`Vector2<class_Vector2>` **bezier_track_get_key_out_handle** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const
|
||||
|
||||
Returns the out handle of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_bezier_track_get_key_value:
|
||||
|
||||
- :ref:`float<class_float>` **bezier_track_get_key_value** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const
|
||||
|
||||
Returns the value of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_bezier_track_insert_key:
|
||||
|
||||
- :ref:`int<class_int>` **bezier_track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`float<class_float>` value, :ref:`Vector2<class_Vector2>` in_handle=Vector2( 0, 0 ), :ref:`Vector2<class_Vector2>` out_handle=Vector2( 0, 0 ) **)**
|
||||
|
||||
Inserts a Bezier Track key at the given ``time`` in seconds. The ``track_idx`` must be the index of a Bezier Track.
|
||||
|
||||
``in_handle`` is the left-side weight of the added Bezier curve point, ``out_handle`` is the right-side one, while ``value`` is the actual value at this point.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_bezier_track_interpolate:
|
||||
|
||||
- :ref:`float<class_float>` **bezier_track_interpolate** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time **)** const
|
||||
|
||||
Returns the interpolated value at the given ``time`` (in seconds). The ``track_idx`` must be the index of a Bezier Track.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_bezier_track_set_key_in_handle:
|
||||
|
||||
- void **bezier_track_set_key_in_handle** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`Vector2<class_Vector2>` in_handle **)**
|
||||
|
||||
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.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_bezier_track_set_key_out_handle:
|
||||
|
||||
- void **bezier_track_set_key_out_handle** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`Vector2<class_Vector2>` 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.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_bezier_track_set_key_value:
|
||||
|
||||
- void **bezier_track_set_key_value** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` value **)**
|
||||
|
||||
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.
|
||||
|
||||
----
|
||||
|
||||
.. _class_Animation_method_clear:
|
||||
@@ -449,7 +495,7 @@ Returns the amount of tracks in the animation.
|
||||
|
||||
.. _class_Animation_method_method_track_get_key_indices:
|
||||
|
||||
- :ref:`PoolIntArray<class_PoolIntArray>` **method_track_get_key_indices** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const
|
||||
- :ref:`PackedInt32Array<class_PackedInt32Array>` **method_track_get_key_indices** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const
|
||||
|
||||
Returns all the key indices of a method track, given a position and delta time.
|
||||
|
||||
@@ -457,7 +503,7 @@ Returns all the key indices of a method track, given a position and delta time.
|
||||
|
||||
.. _class_Animation_method_method_track_get_name:
|
||||
|
||||
- :ref:`String<class_String>` **method_track_get_name** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const
|
||||
- :ref:`StringName<class_StringName>` **method_track_get_name** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** const
|
||||
|
||||
Returns the method name of a method track.
|
||||
|
||||
@@ -707,7 +753,7 @@ Returns the interpolated value of a transform track at a given time (in seconds)
|
||||
|
||||
.. _class_Animation_method_value_track_get_key_indices:
|
||||
|
||||
- :ref:`PoolIntArray<class_PoolIntArray>` **value_track_get_key_indices** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const
|
||||
- :ref:`PackedInt32Array<class_PackedInt32Array>` **value_track_get_key_indices** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const
|
||||
|
||||
Returns all the key indices of a value track, given a position and delta time.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user