class_animation.rst 81 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Animation.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Animation:
  6. Animation
  7. =========
  8. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  9. Contains data used to animate everything in the engine.
  10. Description
  11. -----------
  12. An Animation resource contains data used to animate everything in the engine. Animations are divided into tracks, and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track.
  13. .. tabs::
  14. .. code-tab:: gdscript
  15. # This creates an animation that makes the node "Enemy" move to the right by
  16. # 100 pixels in 0.5 seconds.
  17. var animation = Animation.new()
  18. var track_index = animation.add_track(Animation.TYPE_VALUE)
  19. animation.track_set_path(track_index, "Enemy:position:x")
  20. animation.track_insert_key(track_index, 0.0, 0)
  21. animation.track_insert_key(track_index, 0.5, 100)
  22. .. code-tab:: csharp
  23. // This creates an animation that makes the node "Enemy" move to the right by
  24. // 100 pixels in 0.5 seconds.
  25. var animation = new Animation();
  26. int trackIndex = animation.AddTrack(Animation.TrackType.Value);
  27. animation.TrackSetPath(trackIndex, "Enemy:position:x");
  28. animation.TrackInsertKey(trackIndex, 0.0f, 0);
  29. animation.TrackInsertKey(trackIndex, 0.5f, 100);
  30. 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.
  31. Tutorials
  32. ---------
  33. - :doc:`Animation documentation index <../tutorials/animation/index>`
  34. Properties
  35. ----------
  36. +------------------------------------------+------------------------------------------------------+---------+
  37. | :ref:`float<class_float>` | :ref:`length<class_Animation_property_length>` | ``1.0`` |
  38. +------------------------------------------+------------------------------------------------------+---------+
  39. | :ref:`LoopMode<enum_Animation_LoopMode>` | :ref:`loop_mode<class_Animation_property_loop_mode>` | ``0`` |
  40. +------------------------------------------+------------------------------------------------------+---------+
  41. | :ref:`float<class_float>` | :ref:`step<class_Animation_property_step>` | ``0.1`` |
  42. +------------------------------------------+------------------------------------------------------+---------+
  43. Methods
  44. -------
  45. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :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 **)** |
  47. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :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| |
  49. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :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 **)** |
  51. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | 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 **)** |
  53. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :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| |
  55. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`float<class_float>` | :ref:`audio_track_get_key_start_offset<class_Animation_method_audio_track_get_key_start_offset>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const| |
  57. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Resource<class_Resource>` | :ref:`audio_track_get_key_stream<class_Animation_method_audio_track_get_key_stream>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const| |
  59. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`int<class_int>` | :ref:`audio_track_insert_key<class_Animation_method_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 **)** |
  61. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`audio_track_set_key_end_offset<class_Animation_method_audio_track_set_key_end_offset>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)** |
  63. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`audio_track_set_key_start_offset<class_Animation_method_audio_track_set_key_start_offset>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)** |
  65. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | void | :ref:`audio_track_set_key_stream<class_Animation_method_audio_track_set_key_stream>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`Resource<class_Resource>` stream **)** |
  67. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`int<class_int>` | :ref:`bezier_track_get_key_handle_mode<class_Animation_method_bezier_track_get_key_handle_mode>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const| |
  69. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`Vector2<class_Vector2>` | :ref:`bezier_track_get_key_in_handle<class_Animation_method_bezier_track_get_key_in_handle>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const| |
  71. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`Vector2<class_Vector2>` | :ref:`bezier_track_get_key_out_handle<class_Animation_method_bezier_track_get_key_out_handle>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const| |
  73. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`float<class_float>` | :ref:`bezier_track_get_key_value<class_Animation_method_bezier_track_get_key_value>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const| |
  75. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`int<class_int>` | :ref:`bezier_track_insert_key<class_Animation_method_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), :ref:`HandleMode<enum_Animation_HandleMode>` handle_mode=1 **)** |
  77. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`float<class_float>` | :ref:`bezier_track_interpolate<class_Animation_method_bezier_track_interpolate>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time **)** |const| |
  79. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | void | :ref:`bezier_track_set_key_handle_mode<class_Animation_method_bezier_track_set_key_handle_mode>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`HandleMode<enum_Animation_HandleMode>` key_handle_mode, :ref:`float<class_float>` balanced_value_time_ratio=1.0 **)** |
  81. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | void | :ref:`bezier_track_set_key_in_handle<class_Animation_method_bezier_track_set_key_in_handle>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`Vector2<class_Vector2>` in_handle, :ref:`float<class_float>` balanced_value_time_ratio=1.0 **)** |
  83. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | void | :ref:`bezier_track_set_key_out_handle<class_Animation_method_bezier_track_set_key_out_handle>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`Vector2<class_Vector2>` out_handle, :ref:`float<class_float>` balanced_value_time_ratio=1.0 **)** |
  85. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`bezier_track_set_key_value<class_Animation_method_bezier_track_set_key_value>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` value **)** |
  87. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`int<class_int>` | :ref:`blend_shape_track_insert_key<class_Animation_method_blend_shape_track_insert_key>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`float<class_float>` amount **)** |
  89. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | void | :ref:`clear<class_Animation_method_clear>` **(** **)** |
  91. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | void | :ref:`compress<class_Animation_method_compress>` **(** :ref:`int<class_int>` page_size=8192, :ref:`int<class_int>` fps=120, :ref:`float<class_float>` split_tolerance=4.0 **)** |
  93. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | void | :ref:`copy_track<class_Animation_method_copy_track>` **(** :ref:`int<class_int>` track_idx, :ref:`Animation<class_Animation>` to_animation **)** |
  95. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`int<class_int>` | :ref:`find_track<class_Animation_method_find_track>` **(** :ref:`NodePath<class_NodePath>` path, :ref:`TrackType<enum_Animation_TrackType>` type **)** |const| |
  97. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`int<class_int>` | :ref:`get_track_count<class_Animation_method_get_track_count>` **(** **)** |const| |
  99. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :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| |
  101. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :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| |
  103. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | :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| |
  105. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | :ref:`int<class_int>` | :ref:`position_track_insert_key<class_Animation_method_position_track_insert_key>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`Vector3<class_Vector3>` position **)** |
  107. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | void | :ref:`remove_track<class_Animation_method_remove_track>` **(** :ref:`int<class_int>` track_idx **)** |
  109. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`int<class_int>` | :ref:`rotation_track_insert_key<class_Animation_method_rotation_track_insert_key>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`Quaternion<class_Quaternion>` rotation **)** |
  111. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`int<class_int>` | :ref:`scale_track_insert_key<class_Animation_method_scale_track_insert_key>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`Vector3<class_Vector3>` scale **)** |
  113. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`int<class_int>` | :ref:`track_find_key<class_Animation_method_track_find_key>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`bool<class_bool>` exact=false **)** |const| |
  115. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`bool<class_bool>` | :ref:`track_get_interpolation_loop_wrap<class_Animation_method_track_get_interpolation_loop_wrap>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  117. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | :ref:`InterpolationType<enum_Animation_InterpolationType>` | :ref:`track_get_interpolation_type<class_Animation_method_track_get_interpolation_type>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  119. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | :ref:`int<class_int>` | :ref:`track_get_key_count<class_Animation_method_track_get_key_count>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  121. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | :ref:`float<class_float>` | :ref:`track_get_key_time<class_Animation_method_track_get_key_time>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const| |
  123. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | :ref:`float<class_float>` | :ref:`track_get_key_transition<class_Animation_method_track_get_key_transition>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const| |
  125. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | :ref:`Variant<class_Variant>` | :ref:`track_get_key_value<class_Animation_method_track_get_key_value>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const| |
  127. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | :ref:`NodePath<class_NodePath>` | :ref:`track_get_path<class_Animation_method_track_get_path>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  129. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | :ref:`TrackType<enum_Animation_TrackType>` | :ref:`track_get_type<class_Animation_method_track_get_type>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  131. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | void | :ref:`track_insert_key<class_Animation_method_track_insert_key>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`Variant<class_Variant>` key, :ref:`float<class_float>` transition=1 **)** |
  133. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | :ref:`bool<class_bool>` | :ref:`track_is_compressed<class_Animation_method_track_is_compressed>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  135. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | :ref:`bool<class_bool>` | :ref:`track_is_enabled<class_Animation_method_track_is_enabled>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  137. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | :ref:`bool<class_bool>` | :ref:`track_is_imported<class_Animation_method_track_is_imported>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  139. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | void | :ref:`track_move_down<class_Animation_method_track_move_down>` **(** :ref:`int<class_int>` track_idx **)** |
  141. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | void | :ref:`track_move_to<class_Animation_method_track_move_to>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` to_idx **)** |
  143. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | void | :ref:`track_move_up<class_Animation_method_track_move_up>` **(** :ref:`int<class_int>` track_idx **)** |
  145. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | void | :ref:`track_remove_key<class_Animation_method_track_remove_key>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |
  147. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | void | :ref:`track_remove_key_at_time<class_Animation_method_track_remove_key_at_time>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time **)** |
  149. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | void | :ref:`track_set_enabled<class_Animation_method_track_set_enabled>` **(** :ref:`int<class_int>` track_idx, :ref:`bool<class_bool>` enabled **)** |
  151. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | void | :ref:`track_set_imported<class_Animation_method_track_set_imported>` **(** :ref:`int<class_int>` track_idx, :ref:`bool<class_bool>` imported **)** |
  153. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. | void | :ref:`track_set_interpolation_loop_wrap<class_Animation_method_track_set_interpolation_loop_wrap>` **(** :ref:`int<class_int>` track_idx, :ref:`bool<class_bool>` interpolation **)** |
  155. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  156. | void | :ref:`track_set_interpolation_type<class_Animation_method_track_set_interpolation_type>` **(** :ref:`int<class_int>` track_idx, :ref:`InterpolationType<enum_Animation_InterpolationType>` interpolation **)** |
  157. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  158. | void | :ref:`track_set_key_time<class_Animation_method_track_set_key_time>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` time **)** |
  159. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  160. | void | :ref:`track_set_key_transition<class_Animation_method_track_set_key_transition>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` transition **)** |
  161. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  162. | void | :ref:`track_set_key_value<class_Animation_method_track_set_key_value>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key, :ref:`Variant<class_Variant>` value **)** |
  163. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  164. | void | :ref:`track_set_path<class_Animation_method_track_set_path>` **(** :ref:`int<class_int>` track_idx, :ref:`NodePath<class_NodePath>` path **)** |
  165. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  166. | void | :ref:`track_swap<class_Animation_method_track_swap>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` with_idx **)** |
  167. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  168. | :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| |
  169. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  170. | :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| |
  171. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  172. | :ref:`Variant<class_Variant>` | :ref:`value_track_interpolate<class_Animation_method_value_track_interpolate>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec **)** |const| |
  173. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  174. | void | :ref:`value_track_set_update_mode<class_Animation_method_value_track_set_update_mode>` **(** :ref:`int<class_int>` track_idx, :ref:`UpdateMode<enum_Animation_UpdateMode>` mode **)** |
  175. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  176. Signals
  177. -------
  178. .. _class_Animation_signal_tracks_changed:
  179. - **tracks_changed** **(** **)**
  180. Emitted when there's a change in the list of tracks, e.g. tracks are added, moved or have changed paths.
  181. Enumerations
  182. ------------
  183. .. _enum_Animation_TrackType:
  184. .. _class_Animation_constant_TYPE_VALUE:
  185. .. _class_Animation_constant_TYPE_POSITION_3D:
  186. .. _class_Animation_constant_TYPE_ROTATION_3D:
  187. .. _class_Animation_constant_TYPE_SCALE_3D:
  188. .. _class_Animation_constant_TYPE_BLEND_SHAPE:
  189. .. _class_Animation_constant_TYPE_METHOD:
  190. .. _class_Animation_constant_TYPE_BEZIER:
  191. .. _class_Animation_constant_TYPE_AUDIO:
  192. .. _class_Animation_constant_TYPE_ANIMATION:
  193. enum **TrackType**:
  194. - **TYPE_VALUE** = **0** --- Value tracks set values in node properties, but only those which can be Interpolated.
  195. - **TYPE_POSITION_3D** = **1**
  196. - **TYPE_ROTATION_3D** = **2**
  197. - **TYPE_SCALE_3D** = **3**
  198. - **TYPE_BLEND_SHAPE** = **4**
  199. - **TYPE_METHOD** = **5** --- Method tracks call functions with given arguments per key.
  200. - **TYPE_BEZIER** = **6** --- 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>`).
  201. - **TYPE_AUDIO** = **7** --- 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.
  202. - **TYPE_ANIMATION** = **8** --- Animation tracks play animations in other :ref:`AnimationPlayer<class_AnimationPlayer>` nodes.
  203. ----
  204. .. _enum_Animation_InterpolationType:
  205. .. _class_Animation_constant_INTERPOLATION_NEAREST:
  206. .. _class_Animation_constant_INTERPOLATION_LINEAR:
  207. .. _class_Animation_constant_INTERPOLATION_CUBIC:
  208. enum **InterpolationType**:
  209. - **INTERPOLATION_NEAREST** = **0** --- No interpolation (nearest value).
  210. - **INTERPOLATION_LINEAR** = **1** --- Linear interpolation.
  211. - **INTERPOLATION_CUBIC** = **2** --- Cubic interpolation.
  212. ----
  213. .. _enum_Animation_UpdateMode:
  214. .. _class_Animation_constant_UPDATE_CONTINUOUS:
  215. .. _class_Animation_constant_UPDATE_DISCRETE:
  216. .. _class_Animation_constant_UPDATE_TRIGGER:
  217. .. _class_Animation_constant_UPDATE_CAPTURE:
  218. enum **UpdateMode**:
  219. - **UPDATE_CONTINUOUS** = **0** --- Update between keyframes.
  220. - **UPDATE_DISCRETE** = **1** --- Update at the keyframes and hold the value.
  221. - **UPDATE_TRIGGER** = **2** --- Update at the keyframes.
  222. - **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.
  223. ----
  224. .. _enum_Animation_LoopMode:
  225. .. _class_Animation_constant_LOOP_NONE:
  226. .. _class_Animation_constant_LOOP_LINEAR:
  227. .. _class_Animation_constant_LOOP_PINGPONG:
  228. enum **LoopMode**:
  229. - **LOOP_NONE** = **0** --- At both ends of the animation, the animation will stop playing.
  230. - **LOOP_LINEAR** = **1** --- At both ends of the animation, the animation will be repeated without changing the playback direction.
  231. - **LOOP_PINGPONG** = **2** --- Repeats playback and reverse playback at both ends of the animation.
  232. ----
  233. .. _enum_Animation_HandleMode:
  234. .. _class_Animation_constant_HANDLE_MODE_FREE:
  235. .. _class_Animation_constant_HANDLE_MODE_BALANCED:
  236. enum **HandleMode**:
  237. - **HANDLE_MODE_FREE** = **0** --- Assigning the free handle mode to a Bezier Track's keyframe allows you to edit the keyframe's left and right handles independently from one another.
  238. - **HANDLE_MODE_BALANCED** = **1** --- Assigning the balanced handle mode to a Bezier Track's keyframe makes it so the two handles of the keyframe always stay aligned when changing either the keyframe's left or right handle.
  239. Property Descriptions
  240. ---------------------
  241. .. _class_Animation_property_length:
  242. - :ref:`float<class_float>` **length**
  243. +-----------+-------------------+
  244. | *Default* | ``1.0`` |
  245. +-----------+-------------------+
  246. | *Setter* | set_length(value) |
  247. +-----------+-------------------+
  248. | *Getter* | get_length() |
  249. +-----------+-------------------+
  250. The total length of the animation (in seconds).
  251. **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.
  252. ----
  253. .. _class_Animation_property_loop_mode:
  254. - :ref:`LoopMode<enum_Animation_LoopMode>` **loop_mode**
  255. +-----------+----------------------+
  256. | *Default* | ``0`` |
  257. +-----------+----------------------+
  258. | *Setter* | set_loop_mode(value) |
  259. +-----------+----------------------+
  260. | *Getter* | get_loop_mode() |
  261. +-----------+----------------------+
  262. 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.
  263. ----
  264. .. _class_Animation_property_step:
  265. - :ref:`float<class_float>` **step**
  266. +-----------+-----------------+
  267. | *Default* | ``0.1`` |
  268. +-----------+-----------------+
  269. | *Setter* | set_step(value) |
  270. +-----------+-----------------+
  271. | *Getter* | get_step() |
  272. +-----------+-----------------+
  273. The animation step value.
  274. Method Descriptions
  275. -------------------
  276. .. _class_Animation_method_add_track:
  277. - :ref:`int<class_int>` **add_track** **(** :ref:`TrackType<enum_Animation_TrackType>` type, :ref:`int<class_int>` at_position=-1 **)**
  278. Adds a track to the Animation.
  279. ----
  280. .. _class_Animation_method_animation_track_get_key_animation:
  281. - :ref:`StringName<class_StringName>` **animation_track_get_key_animation** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  282. Returns the animation name at the key identified by ``key_idx``. The ``track_idx`` must be the index of an Animation Track.
  283. ----
  284. .. _class_Animation_method_animation_track_insert_key:
  285. - :ref:`int<class_int>` **animation_track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`StringName<class_StringName>` animation **)**
  286. Inserts a key with value ``animation`` at the given ``time`` (in seconds). The ``track_idx`` must be the index of an Animation Track.
  287. ----
  288. .. _class_Animation_method_animation_track_set_key_animation:
  289. - void **animation_track_set_key_animation** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`StringName<class_StringName>` animation **)**
  290. Sets the key identified by ``key_idx`` to value ``animation``. The ``track_idx`` must be the index of an Animation Track.
  291. ----
  292. .. _class_Animation_method_audio_track_get_key_end_offset:
  293. - :ref:`float<class_float>` **audio_track_get_key_end_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  294. Returns the end offset of the key identified by ``key_idx``. The ``track_idx`` must be the index of an Audio Track.
  295. End offset is the number of seconds cut off at the ending of the audio stream.
  296. ----
  297. .. _class_Animation_method_audio_track_get_key_start_offset:
  298. - :ref:`float<class_float>` **audio_track_get_key_start_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  299. Returns the start offset of the key identified by ``key_idx``. The ``track_idx`` must be the index of an Audio Track.
  300. Start offset is the number of seconds cut off at the beginning of the audio stream.
  301. ----
  302. .. _class_Animation_method_audio_track_get_key_stream:
  303. - :ref:`Resource<class_Resource>` **audio_track_get_key_stream** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  304. Returns the audio stream of the key identified by ``key_idx``. The ``track_idx`` must be the index of an Audio Track.
  305. ----
  306. .. _class_Animation_method_audio_track_insert_key:
  307. - :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 **)**
  308. Inserts an Audio Track key at the given ``time`` in seconds. The ``track_idx`` must be the index of an Audio Track.
  309. ``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.
  310. ----
  311. .. _class_Animation_method_audio_track_set_key_end_offset:
  312. - void **audio_track_set_key_end_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)**
  313. 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.
  314. ----
  315. .. _class_Animation_method_audio_track_set_key_start_offset:
  316. - void **audio_track_set_key_start_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)**
  317. 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.
  318. ----
  319. .. _class_Animation_method_audio_track_set_key_stream:
  320. - void **audio_track_set_key_stream** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`Resource<class_Resource>` stream **)**
  321. Sets the stream of the key identified by ``key_idx`` to value ``stream``. The ``track_idx`` must be the index of an Audio Track.
  322. ----
  323. .. _class_Animation_method_bezier_track_get_key_handle_mode:
  324. - :ref:`int<class_int>` **bezier_track_get_key_handle_mode** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  325. Returns the handle mode of the key identified by ``index``. See :ref:`HandleMode<enum_Animation_HandleMode>` for possible values. The ``track_idx`` must be the index of a Bezier Track.
  326. ----
  327. .. _class_Animation_method_bezier_track_get_key_in_handle:
  328. - :ref:`Vector2<class_Vector2>` **bezier_track_get_key_in_handle** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  329. Returns the in handle of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
  330. ----
  331. .. _class_Animation_method_bezier_track_get_key_out_handle:
  332. - :ref:`Vector2<class_Vector2>` **bezier_track_get_key_out_handle** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  333. Returns the out handle of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
  334. ----
  335. .. _class_Animation_method_bezier_track_get_key_value:
  336. - :ref:`float<class_float>` **bezier_track_get_key_value** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  337. Returns the value of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
  338. ----
  339. .. _class_Animation_method_bezier_track_insert_key:
  340. - :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), :ref:`HandleMode<enum_Animation_HandleMode>` handle_mode=1 **)**
  341. Inserts a Bezier Track key at the given ``time`` in seconds. The ``track_idx`` must be the index of a Bezier Track.
  342. ``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.
  343. ----
  344. .. _class_Animation_method_bezier_track_interpolate:
  345. - :ref:`float<class_float>` **bezier_track_interpolate** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time **)** |const|
  346. Returns the interpolated value at the given ``time`` (in seconds). The ``track_idx`` must be the index of a Bezier Track.
  347. ----
  348. .. _class_Animation_method_bezier_track_set_key_handle_mode:
  349. - void **bezier_track_set_key_handle_mode** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`HandleMode<enum_Animation_HandleMode>` key_handle_mode, :ref:`float<class_float>` balanced_value_time_ratio=1.0 **)**
  350. Changes the handle mode of the keyframe at the given ``index``. See :ref:`HandleMode<enum_Animation_HandleMode>` for possible values. The ``track_idx`` must be the index of a Bezier Track.
  351. ----
  352. .. _class_Animation_method_bezier_track_set_key_in_handle:
  353. - 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, :ref:`float<class_float>` balanced_value_time_ratio=1.0 **)**
  354. 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.
  355. ----
  356. .. _class_Animation_method_bezier_track_set_key_out_handle:
  357. - 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, :ref:`float<class_float>` balanced_value_time_ratio=1.0 **)**
  358. 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.
  359. ----
  360. .. _class_Animation_method_bezier_track_set_key_value:
  361. - void **bezier_track_set_key_value** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` value **)**
  362. 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.
  363. ----
  364. .. _class_Animation_method_blend_shape_track_insert_key:
  365. - :ref:`int<class_int>` **blend_shape_track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`float<class_float>` amount **)**
  366. ----
  367. .. _class_Animation_method_clear:
  368. - void **clear** **(** **)**
  369. Clear the animation (clear all tracks and reset all).
  370. ----
  371. .. _class_Animation_method_compress:
  372. - void **compress** **(** :ref:`int<class_int>` page_size=8192, :ref:`int<class_int>` fps=120, :ref:`float<class_float>` split_tolerance=4.0 **)**
  373. ----
  374. .. _class_Animation_method_copy_track:
  375. - void **copy_track** **(** :ref:`int<class_int>` track_idx, :ref:`Animation<class_Animation>` to_animation **)**
  376. Adds a new track that is a copy of the given track from ``to_animation``.
  377. ----
  378. .. _class_Animation_method_find_track:
  379. - :ref:`int<class_int>` **find_track** **(** :ref:`NodePath<class_NodePath>` path, :ref:`TrackType<enum_Animation_TrackType>` type **)** |const|
  380. Returns the index of the specified track. If the track is not found, return -1.
  381. ----
  382. .. _class_Animation_method_get_track_count:
  383. - :ref:`int<class_int>` **get_track_count** **(** **)** |const|
  384. Returns the amount of tracks in the animation.
  385. ----
  386. .. _class_Animation_method_method_track_get_key_indices:
  387. - :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|
  388. Returns all the key indices of a method track, given a position and delta time.
  389. ----
  390. .. _class_Animation_method_method_track_get_name:
  391. - :ref:`StringName<class_StringName>` **method_track_get_name** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  392. Returns the method name of a method track.
  393. ----
  394. .. _class_Animation_method_method_track_get_params:
  395. - :ref:`Array<class_Array>` **method_track_get_params** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  396. Returns the arguments values to be called on a method track for a given key in a given track.
  397. ----
  398. .. _class_Animation_method_position_track_insert_key:
  399. - :ref:`int<class_int>` **position_track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`Vector3<class_Vector3>` position **)**
  400. ----
  401. .. _class_Animation_method_remove_track:
  402. - void **remove_track** **(** :ref:`int<class_int>` track_idx **)**
  403. Removes a track by specifying the track index.
  404. ----
  405. .. _class_Animation_method_rotation_track_insert_key:
  406. - :ref:`int<class_int>` **rotation_track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`Quaternion<class_Quaternion>` rotation **)**
  407. ----
  408. .. _class_Animation_method_scale_track_insert_key:
  409. - :ref:`int<class_int>` **scale_track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`Vector3<class_Vector3>` scale **)**
  410. ----
  411. .. _class_Animation_method_track_find_key:
  412. - :ref:`int<class_int>` **track_find_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`bool<class_bool>` exact=false **)** |const|
  413. Finds the key index by time in a given track. Optionally, only find it if the exact time is given.
  414. ----
  415. .. _class_Animation_method_track_get_interpolation_loop_wrap:
  416. - :ref:`bool<class_bool>` **track_get_interpolation_loop_wrap** **(** :ref:`int<class_int>` track_idx **)** |const|
  417. Returns ``true`` if the track at ``idx`` wraps the interpolation loop. New tracks wrap the interpolation loop by default.
  418. ----
  419. .. _class_Animation_method_track_get_interpolation_type:
  420. - :ref:`InterpolationType<enum_Animation_InterpolationType>` **track_get_interpolation_type** **(** :ref:`int<class_int>` track_idx **)** |const|
  421. Returns the interpolation type of a given track.
  422. ----
  423. .. _class_Animation_method_track_get_key_count:
  424. - :ref:`int<class_int>` **track_get_key_count** **(** :ref:`int<class_int>` track_idx **)** |const|
  425. Returns the amount of keys in a given track.
  426. ----
  427. .. _class_Animation_method_track_get_key_time:
  428. - :ref:`float<class_float>` **track_get_key_time** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  429. Returns the time at which the key is located.
  430. ----
  431. .. _class_Animation_method_track_get_key_transition:
  432. - :ref:`float<class_float>` **track_get_key_transition** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  433. Returns the transition curve (easing) for a specific key (see the built-in math function :ref:`@GlobalScope.ease<class_@GlobalScope_method_ease>`).
  434. ----
  435. .. _class_Animation_method_track_get_key_value:
  436. - :ref:`Variant<class_Variant>` **track_get_key_value** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  437. Returns the value of a given key in a given track.
  438. ----
  439. .. _class_Animation_method_track_get_path:
  440. - :ref:`NodePath<class_NodePath>` **track_get_path** **(** :ref:`int<class_int>` track_idx **)** |const|
  441. Gets the path of a track. For more information on the path format, see :ref:`track_set_path<class_Animation_method_track_set_path>`.
  442. ----
  443. .. _class_Animation_method_track_get_type:
  444. - :ref:`TrackType<enum_Animation_TrackType>` **track_get_type** **(** :ref:`int<class_int>` track_idx **)** |const|
  445. Gets the type of a track.
  446. ----
  447. .. _class_Animation_method_track_insert_key:
  448. - void **track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`Variant<class_Variant>` key, :ref:`float<class_float>` transition=1 **)**
  449. Insert a generic key in a given track.
  450. ----
  451. .. _class_Animation_method_track_is_compressed:
  452. - :ref:`bool<class_bool>` **track_is_compressed** **(** :ref:`int<class_int>` track_idx **)** |const|
  453. ----
  454. .. _class_Animation_method_track_is_enabled:
  455. - :ref:`bool<class_bool>` **track_is_enabled** **(** :ref:`int<class_int>` track_idx **)** |const|
  456. Returns ``true`` if the track at index ``idx`` is enabled.
  457. ----
  458. .. _class_Animation_method_track_is_imported:
  459. - :ref:`bool<class_bool>` **track_is_imported** **(** :ref:`int<class_int>` track_idx **)** |const|
  460. Returns ``true`` if the given track is imported. Else, return ``false``.
  461. ----
  462. .. _class_Animation_method_track_move_down:
  463. - void **track_move_down** **(** :ref:`int<class_int>` track_idx **)**
  464. Moves a track down.
  465. ----
  466. .. _class_Animation_method_track_move_to:
  467. - void **track_move_to** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` to_idx **)**
  468. Changes the index position of track ``idx`` to the one defined in ``to_idx``.
  469. ----
  470. .. _class_Animation_method_track_move_up:
  471. - void **track_move_up** **(** :ref:`int<class_int>` track_idx **)**
  472. Moves a track up.
  473. ----
  474. .. _class_Animation_method_track_remove_key:
  475. - void **track_remove_key** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)**
  476. Removes a key by index in a given track.
  477. ----
  478. .. _class_Animation_method_track_remove_key_at_time:
  479. - void **track_remove_key_at_time** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time **)**
  480. Removes a key at ``time`` in a given track.
  481. ----
  482. .. _class_Animation_method_track_set_enabled:
  483. - void **track_set_enabled** **(** :ref:`int<class_int>` track_idx, :ref:`bool<class_bool>` enabled **)**
  484. Enables/disables the given track. Tracks are enabled by default.
  485. ----
  486. .. _class_Animation_method_track_set_imported:
  487. - void **track_set_imported** **(** :ref:`int<class_int>` track_idx, :ref:`bool<class_bool>` imported **)**
  488. Sets the given track as imported or not.
  489. ----
  490. .. _class_Animation_method_track_set_interpolation_loop_wrap:
  491. - void **track_set_interpolation_loop_wrap** **(** :ref:`int<class_int>` track_idx, :ref:`bool<class_bool>` interpolation **)**
  492. If ``true``, the track at ``idx`` wraps the interpolation loop.
  493. ----
  494. .. _class_Animation_method_track_set_interpolation_type:
  495. - void **track_set_interpolation_type** **(** :ref:`int<class_int>` track_idx, :ref:`InterpolationType<enum_Animation_InterpolationType>` interpolation **)**
  496. Sets the interpolation type of a given track.
  497. ----
  498. .. _class_Animation_method_track_set_key_time:
  499. - void **track_set_key_time** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` time **)**
  500. Sets the time of an existing key.
  501. ----
  502. .. _class_Animation_method_track_set_key_transition:
  503. - void **track_set_key_transition** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` transition **)**
  504. Sets the transition curve (easing) for a specific key (see the built-in math function :ref:`@GlobalScope.ease<class_@GlobalScope_method_ease>`).
  505. ----
  506. .. _class_Animation_method_track_set_key_value:
  507. - void **track_set_key_value** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key, :ref:`Variant<class_Variant>` value **)**
  508. Sets the value of an existing key.
  509. ----
  510. .. _class_Animation_method_track_set_path:
  511. - void **track_set_path** **(** :ref:`int<class_int>` track_idx, :ref:`NodePath<class_NodePath>` path **)**
  512. 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 ``":"``.
  513. For example, ``"character/skeleton:ankle"`` or ``"character/mesh:transform/local"``.
  514. ----
  515. .. _class_Animation_method_track_swap:
  516. - void **track_swap** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` with_idx **)**
  517. Swaps the track ``idx``'s index position with the track ``with_idx``.
  518. ----
  519. .. _class_Animation_method_value_track_get_key_indices:
  520. - :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|
  521. Returns all the key indices of a value track, given a position and delta time.
  522. ----
  523. .. _class_Animation_method_value_track_get_update_mode:
  524. - :ref:`UpdateMode<enum_Animation_UpdateMode>` **value_track_get_update_mode** **(** :ref:`int<class_int>` track_idx **)** |const|
  525. Returns the update mode of a value track.
  526. ----
  527. .. _class_Animation_method_value_track_interpolate:
  528. - :ref:`Variant<class_Variant>` **value_track_interpolate** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec **)** |const|
  529. Returns the interpolated value at the given time (in seconds). The ``track_idx`` must be the index of a value track.
  530. ----
  531. .. _class_Animation_method_value_track_set_update_mode:
  532. - void **value_track_set_update_mode** **(** :ref:`int<class_int>` track_idx, :ref:`UpdateMode<enum_Animation_UpdateMode>` mode **)**
  533. Sets the update mode (see :ref:`UpdateMode<enum_Animation_UpdateMode>`) of a value track.
  534. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  535. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  536. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  537. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  538. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  539. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`