class_animation.rst 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Animation.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Animation:
  5. Animation
  6. =========
  7. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Contains data used to animate everything in the engine.
  12. Properties
  13. ----------
  14. +---------------------------+------------------------------------------------+
  15. | :ref:`float<class_float>` | :ref:`length<class_Animation_property_length>` |
  16. +---------------------------+------------------------------------------------+
  17. | :ref:`bool<class_bool>` | :ref:`loop<class_Animation_property_loop>` |
  18. +---------------------------+------------------------------------------------+
  19. | :ref:`float<class_float>` | :ref:`step<class_Animation_property_step>` |
  20. +---------------------------+------------------------------------------------+
  21. Methods
  22. -------
  23. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :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 **)** |
  25. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`String<class_String>` | :ref:`animation_track_get_key_animation<class_Animation_method_animation_track_get_key_animation>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  27. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`animation_track_insert_key<class_Animation_method_animation_track_insert_key>` **(** :ref:`int<class_int>` track, :ref:`float<class_float>` time, :ref:`String<class_String>` animation **)** |
  29. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`animation_track_set_key_animation<class_Animation_method_animation_track_set_key_animation>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`String<class_String>` animation **)** |
  31. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`float<class_float>` | :ref:`audio_track_get_key_end_offset<class_Animation_method_audio_track_get_key_end_offset>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  33. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`float<class_float>` | :ref:`audio_track_get_key_start_offset<class_Animation_method_audio_track_get_key_start_offset>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  35. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`Resource<class_Resource>` | :ref:`audio_track_get_key_stream<class_Animation_method_audio_track_get_key_stream>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  37. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`audio_track_insert_key<class_Animation_method_audio_track_insert_key>` **(** :ref:`int<class_int>` track, :ref:`float<class_float>` time, :ref:`Resource<class_Resource>` stream, :ref:`float<class_float>` start_offset=0, :ref:`float<class_float>` end_offset=0 **)** |
  39. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`audio_track_set_key_end_offset<class_Animation_method_audio_track_set_key_end_offset>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)** |
  41. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`audio_track_set_key_start_offset<class_Animation_method_audio_track_set_key_start_offset>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)** |
  43. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`audio_track_set_key_stream<class_Animation_method_audio_track_set_key_stream>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`Resource<class_Resource>` stream **)** |
  45. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Vector2<class_Vector2>` | :ref:`bezier_track_get_key_in_handle<class_Animation_method_bezier_track_get_key_in_handle>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  47. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Vector2<class_Vector2>` | :ref:`bezier_track_get_key_out_handle<class_Animation_method_bezier_track_get_key_out_handle>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  49. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`float<class_float>` | :ref:`bezier_track_get_key_value<class_Animation_method_bezier_track_get_key_value>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  51. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`int<class_int>` | :ref:`bezier_track_insert_key<class_Animation_method_bezier_track_insert_key>` **(** :ref:`int<class_int>` track, :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 ) **)** |
  53. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`float<class_float>` | :ref:`bezier_track_interpolate<class_Animation_method_bezier_track_interpolate>` **(** :ref:`int<class_int>` track, :ref:`float<class_float>` time **)** const |
  55. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`bezier_track_set_key_in_handle<class_Animation_method_bezier_track_set_key_in_handle>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`Vector2<class_Vector2>` in_handle **)** |
  57. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`bezier_track_set_key_out_handle<class_Animation_method_bezier_track_set_key_out_handle>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`Vector2<class_Vector2>` out_handle **)** |
  59. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`bezier_track_set_key_value<class_Animation_method_bezier_track_set_key_value>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` value **)** |
  61. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`clear<class_Animation_method_clear>` **(** **)** |
  63. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`copy_track<class_Animation_method_copy_track>` **(** :ref:`int<class_int>` track, :ref:`Animation<class_Animation>` to_animation **)** |
  65. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`int<class_int>` | :ref:`find_track<class_Animation_method_find_track>` **(** :ref:`NodePath<class_NodePath>` path **)** const |
  67. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`int<class_int>` | :ref:`get_track_count<class_Animation_method_get_track_count>` **(** **)** const |
  69. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`method_track_get_key_indices<class_Animation_method_method_track_get_key_indices>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const |
  71. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`String<class_String>` | :ref:`method_track_get_name<class_Animation_method_method_track_get_name>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  73. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`Array<class_Array>` | :ref:`method_track_get_params<class_Animation_method_method_track_get_params>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  75. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | void | :ref:`remove_track<class_Animation_method_remove_track>` **(** :ref:`int<class_int>` idx **)** |
  77. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`int<class_int>` | :ref:`track_find_key<class_Animation_method_track_find_key>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, :ref:`bool<class_bool>` exact=false **)** const |
  79. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`bool<class_bool>` | :ref:`track_get_interpolation_loop_wrap<class_Animation_method_track_get_interpolation_loop_wrap>` **(** :ref:`int<class_int>` idx **)** const |
  81. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`InterpolationType<enum_Animation_InterpolationType>` | :ref:`track_get_interpolation_type<class_Animation_method_track_get_interpolation_type>` **(** :ref:`int<class_int>` idx **)** const |
  83. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`int<class_int>` | :ref:`track_get_key_count<class_Animation_method_track_get_key_count>` **(** :ref:`int<class_int>` idx **)** const |
  85. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`float<class_float>` | :ref:`track_get_key_time<class_Animation_method_track_get_key_time>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  87. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`float<class_float>` | :ref:`track_get_key_transition<class_Animation_method_track_get_key_transition>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  89. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`Variant<class_Variant>` | :ref:`track_get_key_value<class_Animation_method_track_get_key_value>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
  91. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`NodePath<class_NodePath>` | :ref:`track_get_path<class_Animation_method_track_get_path>` **(** :ref:`int<class_int>` idx **)** const |
  93. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`TrackType<enum_Animation_TrackType>` | :ref:`track_get_type<class_Animation_method_track_get_type>` **(** :ref:`int<class_int>` idx **)** const |
  95. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | void | :ref:`track_insert_key<class_Animation_method_track_insert_key>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, :ref:`Variant<class_Variant>` key, :ref:`float<class_float>` transition=1 **)** |
  97. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`bool<class_bool>` | :ref:`track_is_enabled<class_Animation_method_track_is_enabled>` **(** :ref:`int<class_int>` idx **)** const |
  99. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :ref:`bool<class_bool>` | :ref:`track_is_imported<class_Animation_method_track_is_imported>` **(** :ref:`int<class_int>` idx **)** const |
  101. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | void | :ref:`track_move_down<class_Animation_method_track_move_down>` **(** :ref:`int<class_int>` idx **)** |
  103. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | void | :ref:`track_move_to<class_Animation_method_track_move_to>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` to_idx **)** |
  105. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | void | :ref:`track_move_up<class_Animation_method_track_move_up>` **(** :ref:`int<class_int>` idx **)** |
  107. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | void | :ref:`track_remove_key<class_Animation_method_track_remove_key>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** |
  109. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | void | :ref:`track_remove_key_at_position<class_Animation_method_track_remove_key_at_position>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` position **)** |
  111. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | void | :ref:`track_set_enabled<class_Animation_method_track_set_enabled>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enabled **)** |
  113. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | void | :ref:`track_set_imported<class_Animation_method_track_set_imported>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` imported **)** |
  115. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | void | :ref:`track_set_interpolation_loop_wrap<class_Animation_method_track_set_interpolation_loop_wrap>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` interpolation **)** |
  117. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | void | :ref:`track_set_interpolation_type<class_Animation_method_track_set_interpolation_type>` **(** :ref:`int<class_int>` idx, :ref:`InterpolationType<enum_Animation_InterpolationType>` interpolation **)** |
  119. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | void | :ref:`track_set_key_time<class_Animation_method_track_set_key_time>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` time **)** |
  121. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | void | :ref:`track_set_key_transition<class_Animation_method_track_set_key_transition>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` transition **)** |
  123. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | void | :ref:`track_set_key_value<class_Animation_method_track_set_key_value>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key, :ref:`Variant<class_Variant>` value **)** |
  125. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | void | :ref:`track_set_path<class_Animation_method_track_set_path>` **(** :ref:`int<class_int>` idx, :ref:`NodePath<class_NodePath>` path **)** |
  127. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | void | :ref:`track_swap<class_Animation_method_track_swap>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` with_idx **)** |
  129. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | :ref:`int<class_int>` | :ref:`transform_track_insert_key<class_Animation_method_transform_track_insert_key>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, :ref:`Vector3<class_Vector3>` location, :ref:`Quat<class_Quat>` rotation, :ref:`Vector3<class_Vector3>` scale **)** |
  131. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | :ref:`Array<class_Array>` | :ref:`transform_track_interpolate<class_Animation_method_transform_track_interpolate>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec **)** const |
  133. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`value_track_get_key_indices<class_Animation_method_value_track_get_key_indices>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const |
  135. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | :ref:`UpdateMode<enum_Animation_UpdateMode>` | :ref:`value_track_get_update_mode<class_Animation_method_value_track_get_update_mode>` **(** :ref:`int<class_int>` idx **)** const |
  137. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | void | :ref:`value_track_set_update_mode<class_Animation_method_value_track_set_update_mode>` **(** :ref:`int<class_int>` idx, :ref:`UpdateMode<enum_Animation_UpdateMode>` mode **)** |
  139. +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. Signals
  141. -------
  142. .. _class_Animation_signal_tracks_changed:
  143. - **tracks_changed** **(** **)**
  144. Enumerations
  145. ------------
  146. .. _enum_Animation_TrackType:
  147. .. _class_Animation_constant_TYPE_VALUE:
  148. .. _class_Animation_constant_TYPE_TRANSFORM:
  149. .. _class_Animation_constant_TYPE_METHOD:
  150. .. _class_Animation_constant_TYPE_BEZIER:
  151. .. _class_Animation_constant_TYPE_AUDIO:
  152. .. _class_Animation_constant_TYPE_ANIMATION:
  153. enum **TrackType**:
  154. - **TYPE_VALUE** = **0** --- Value tracks set values in node properties, but only those which can be Interpolated.
  155. - **TYPE_TRANSFORM** = **1** --- Transform tracks are used to change node local transforms or skeleton pose bones. Transitions are interpolated.
  156. - **TYPE_METHOD** = **2** --- Method tracks call functions with given arguments per key.
  157. - **TYPE_BEZIER** = **3**
  158. - **TYPE_AUDIO** = **4**
  159. - **TYPE_ANIMATION** = **5**
  160. .. _enum_Animation_InterpolationType:
  161. .. _class_Animation_constant_INTERPOLATION_NEAREST:
  162. .. _class_Animation_constant_INTERPOLATION_LINEAR:
  163. .. _class_Animation_constant_INTERPOLATION_CUBIC:
  164. enum **InterpolationType**:
  165. - **INTERPOLATION_NEAREST** = **0** --- No interpolation (nearest value).
  166. - **INTERPOLATION_LINEAR** = **1** --- Linear interpolation.
  167. - **INTERPOLATION_CUBIC** = **2** --- Cubic interpolation.
  168. .. _enum_Animation_UpdateMode:
  169. .. _class_Animation_constant_UPDATE_CONTINUOUS:
  170. .. _class_Animation_constant_UPDATE_DISCRETE:
  171. .. _class_Animation_constant_UPDATE_TRIGGER:
  172. .. _class_Animation_constant_UPDATE_CAPTURE:
  173. enum **UpdateMode**:
  174. - **UPDATE_CONTINUOUS** = **0** --- Update between keyframes.
  175. - **UPDATE_DISCRETE** = **1** --- Update at the keyframes and hold the value.
  176. - **UPDATE_TRIGGER** = **2** --- Update at the keyframes.
  177. - **UPDATE_CAPTURE** = **3**
  178. Description
  179. -----------
  180. 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.
  181. ::
  182. # This creates an animation that makes the node "Enemy" move to the right by
  183. # 100 pixels in 1 second.
  184. var animation = Animation.new()
  185. var track_index = animation.add_track(Animation.TYPE_VALUE)
  186. animation.track_set_path(track_index, "Enemy:position.x")
  187. animation.track_insert_key(track_index, 0.0, 0)
  188. animation.track_insert_key(track_index, 0.5, 100)
  189. 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.
  190. Tutorials
  191. ---------
  192. - :doc:`../tutorials/animation/index`
  193. Property Descriptions
  194. ---------------------
  195. .. _class_Animation_property_length:
  196. - :ref:`float<class_float>` **length**
  197. +----------+-------------------+
  198. | *Setter* | set_length(value) |
  199. +----------+-------------------+
  200. | *Getter* | get_length() |
  201. +----------+-------------------+
  202. The total length of the animation (in seconds).
  203. **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.
  204. .. _class_Animation_property_loop:
  205. - :ref:`bool<class_bool>` **loop**
  206. +----------+-----------------+
  207. | *Setter* | set_loop(value) |
  208. +----------+-----------------+
  209. | *Getter* | has_loop() |
  210. +----------+-----------------+
  211. A flag indicating that the animation must loop. This is uses for correct interpolation of animation cycles, and for hinting the player that it must restart the animation.
  212. .. _class_Animation_property_step:
  213. - :ref:`float<class_float>` **step**
  214. +----------+-----------------+
  215. | *Setter* | set_step(value) |
  216. +----------+-----------------+
  217. | *Getter* | get_step() |
  218. +----------+-----------------+
  219. The animation step value.
  220. Method Descriptions
  221. -------------------
  222. .. _class_Animation_method_add_track:
  223. - :ref:`int<class_int>` **add_track** **(** :ref:`TrackType<enum_Animation_TrackType>` type, :ref:`int<class_int>` at_position=-1 **)**
  224. Adds a track to the Animation.
  225. .. _class_Animation_method_animation_track_get_key_animation:
  226. - :ref:`String<class_String>` **animation_track_get_key_animation** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  227. .. _class_Animation_method_animation_track_insert_key:
  228. - :ref:`int<class_int>` **animation_track_insert_key** **(** :ref:`int<class_int>` track, :ref:`float<class_float>` time, :ref:`String<class_String>` animation **)**
  229. .. _class_Animation_method_animation_track_set_key_animation:
  230. - void **animation_track_set_key_animation** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`String<class_String>` animation **)**
  231. .. _class_Animation_method_audio_track_get_key_end_offset:
  232. - :ref:`float<class_float>` **audio_track_get_key_end_offset** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  233. .. _class_Animation_method_audio_track_get_key_start_offset:
  234. - :ref:`float<class_float>` **audio_track_get_key_start_offset** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  235. .. _class_Animation_method_audio_track_get_key_stream:
  236. - :ref:`Resource<class_Resource>` **audio_track_get_key_stream** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  237. .. _class_Animation_method_audio_track_insert_key:
  238. - :ref:`int<class_int>` **audio_track_insert_key** **(** :ref:`int<class_int>` track, :ref:`float<class_float>` time, :ref:`Resource<class_Resource>` stream, :ref:`float<class_float>` start_offset=0, :ref:`float<class_float>` end_offset=0 **)**
  239. .. _class_Animation_method_audio_track_set_key_end_offset:
  240. - void **audio_track_set_key_end_offset** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)**
  241. .. _class_Animation_method_audio_track_set_key_start_offset:
  242. - void **audio_track_set_key_start_offset** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)**
  243. .. _class_Animation_method_audio_track_set_key_stream:
  244. - void **audio_track_set_key_stream** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`Resource<class_Resource>` stream **)**
  245. .. _class_Animation_method_bezier_track_get_key_in_handle:
  246. - :ref:`Vector2<class_Vector2>` **bezier_track_get_key_in_handle** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  247. .. _class_Animation_method_bezier_track_get_key_out_handle:
  248. - :ref:`Vector2<class_Vector2>` **bezier_track_get_key_out_handle** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  249. .. _class_Animation_method_bezier_track_get_key_value:
  250. - :ref:`float<class_float>` **bezier_track_get_key_value** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  251. .. _class_Animation_method_bezier_track_insert_key:
  252. - :ref:`int<class_int>` **bezier_track_insert_key** **(** :ref:`int<class_int>` track, :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 ) **)**
  253. .. _class_Animation_method_bezier_track_interpolate:
  254. - :ref:`float<class_float>` **bezier_track_interpolate** **(** :ref:`int<class_int>` track, :ref:`float<class_float>` time **)** const
  255. .. _class_Animation_method_bezier_track_set_key_in_handle:
  256. - void **bezier_track_set_key_in_handle** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`Vector2<class_Vector2>` in_handle **)**
  257. .. _class_Animation_method_bezier_track_set_key_out_handle:
  258. - void **bezier_track_set_key_out_handle** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`Vector2<class_Vector2>` out_handle **)**
  259. .. _class_Animation_method_bezier_track_set_key_value:
  260. - void **bezier_track_set_key_value** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` value **)**
  261. .. _class_Animation_method_clear:
  262. - void **clear** **(** **)**
  263. Clear the animation (clear all tracks and reset all).
  264. .. _class_Animation_method_copy_track:
  265. - void **copy_track** **(** :ref:`int<class_int>` track, :ref:`Animation<class_Animation>` to_animation **)**
  266. Adds a new track that is a copy of the given track from ``to_animation``.
  267. .. _class_Animation_method_find_track:
  268. - :ref:`int<class_int>` **find_track** **(** :ref:`NodePath<class_NodePath>` path **)** const
  269. Returns the index of the specified track. If the track is not found, return -1.
  270. .. _class_Animation_method_get_track_count:
  271. - :ref:`int<class_int>` **get_track_count** **(** **)** const
  272. Returns the amount of tracks in the animation.
  273. .. _class_Animation_method_method_track_get_key_indices:
  274. - :ref:`PoolIntArray<class_PoolIntArray>` **method_track_get_key_indices** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const
  275. Returns all the key indices of a method track, given a position and delta time.
  276. .. _class_Animation_method_method_track_get_name:
  277. - :ref:`String<class_String>` **method_track_get_name** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  278. Returns the method name of a method track.
  279. .. _class_Animation_method_method_track_get_params:
  280. - :ref:`Array<class_Array>` **method_track_get_params** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  281. Returns the arguments values to be called on a method track for a given key in a given track.
  282. .. _class_Animation_method_remove_track:
  283. - void **remove_track** **(** :ref:`int<class_int>` idx **)**
  284. Removes a track by specifying the track index.
  285. .. _class_Animation_method_track_find_key:
  286. - :ref:`int<class_int>` **track_find_key** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, :ref:`bool<class_bool>` exact=false **)** const
  287. Finds the key index by time in a given track. Optionally, only find it if the exact time is given.
  288. .. _class_Animation_method_track_get_interpolation_loop_wrap:
  289. - :ref:`bool<class_bool>` **track_get_interpolation_loop_wrap** **(** :ref:`int<class_int>` idx **)** const
  290. Returns ``true`` if the track at ``idx`` wraps the interpolation loop. Default value: ``true``.
  291. .. _class_Animation_method_track_get_interpolation_type:
  292. - :ref:`InterpolationType<enum_Animation_InterpolationType>` **track_get_interpolation_type** **(** :ref:`int<class_int>` idx **)** const
  293. Returns the interpolation type of a given track.
  294. .. _class_Animation_method_track_get_key_count:
  295. - :ref:`int<class_int>` **track_get_key_count** **(** :ref:`int<class_int>` idx **)** const
  296. Returns the amount of keys in a given track.
  297. .. _class_Animation_method_track_get_key_time:
  298. - :ref:`float<class_float>` **track_get_key_time** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  299. Returns the time at which the key is located.
  300. .. _class_Animation_method_track_get_key_transition:
  301. - :ref:`float<class_float>` **track_get_key_transition** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  302. Returns the transition curve (easing) for a specific key (see the built-in math function :ref:`@GDScript.ease<class_@GDScript_method_ease>`).
  303. .. _class_Animation_method_track_get_key_value:
  304. - :ref:`Variant<class_Variant>` **track_get_key_value** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
  305. Returns the value of a given key in a given track.
  306. .. _class_Animation_method_track_get_path:
  307. - :ref:`NodePath<class_NodePath>` **track_get_path** **(** :ref:`int<class_int>` idx **)** const
  308. Gets the path of a track. For more information on the path format, see :ref:`track_set_path<class_Animation_method_track_set_path>`.
  309. .. _class_Animation_method_track_get_type:
  310. - :ref:`TrackType<enum_Animation_TrackType>` **track_get_type** **(** :ref:`int<class_int>` idx **)** const
  311. Gets the type of a track.
  312. .. _class_Animation_method_track_insert_key:
  313. - void **track_insert_key** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, :ref:`Variant<class_Variant>` key, :ref:`float<class_float>` transition=1 **)**
  314. Insert a generic key in a given track.
  315. .. _class_Animation_method_track_is_enabled:
  316. - :ref:`bool<class_bool>` **track_is_enabled** **(** :ref:`int<class_int>` idx **)** const
  317. Returns ``true`` if the track at index ``idx`` is enabled.
  318. .. _class_Animation_method_track_is_imported:
  319. - :ref:`bool<class_bool>` **track_is_imported** **(** :ref:`int<class_int>` idx **)** const
  320. Returns ``true`` if the given track is imported. Else, return ``false``.
  321. .. _class_Animation_method_track_move_down:
  322. - void **track_move_down** **(** :ref:`int<class_int>` idx **)**
  323. Moves a track down.
  324. .. _class_Animation_method_track_move_to:
  325. - void **track_move_to** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` to_idx **)**
  326. Changes the index position of track ``idx`` to the one defined in ``to_idx``.
  327. .. _class_Animation_method_track_move_up:
  328. - void **track_move_up** **(** :ref:`int<class_int>` idx **)**
  329. Moves a track up.
  330. .. _class_Animation_method_track_remove_key:
  331. - void **track_remove_key** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)**
  332. Removes a key by index in a given track.
  333. .. _class_Animation_method_track_remove_key_at_position:
  334. - void **track_remove_key_at_position** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` position **)**
  335. Removes a key by position (seconds) in a given track.
  336. .. _class_Animation_method_track_set_enabled:
  337. - void **track_set_enabled** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enabled **)**
  338. Enables/disables the given track. Tracks are enabled by default.
  339. .. _class_Animation_method_track_set_imported:
  340. - void **track_set_imported** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` imported **)**
  341. Sets the given track as imported or not.
  342. .. _class_Animation_method_track_set_interpolation_loop_wrap:
  343. - void **track_set_interpolation_loop_wrap** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` interpolation **)**
  344. If ``true``, the track at ``idx`` wraps the interpolation loop.
  345. .. _class_Animation_method_track_set_interpolation_type:
  346. - void **track_set_interpolation_type** **(** :ref:`int<class_int>` idx, :ref:`InterpolationType<enum_Animation_InterpolationType>` interpolation **)**
  347. Sets the interpolation type of a given track.
  348. .. _class_Animation_method_track_set_key_time:
  349. - void **track_set_key_time** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` time **)**
  350. Sets the time of an existing key.
  351. .. _class_Animation_method_track_set_key_transition:
  352. - void **track_set_key_transition** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` transition **)**
  353. Sets the transition curve (easing) for a specific key (see the built-in math function :ref:`@GDScript.ease<class_@GDScript_method_ease>`).
  354. .. _class_Animation_method_track_set_key_value:
  355. - void **track_set_key_value** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key, :ref:`Variant<class_Variant>` value **)**
  356. Sets the value of an existing key.
  357. .. _class_Animation_method_track_set_path:
  358. - void **track_set_path** **(** :ref:`int<class_int>` idx, :ref:`NodePath<class_NodePath>` path **)**
  359. 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 ``":"``.
  360. For example, ``"character/skeleton:ankle"`` or ``"character/mesh:transform/local"``.
  361. .. _class_Animation_method_track_swap:
  362. - void **track_swap** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` with_idx **)**
  363. Swaps the track ``idx``'s index position with the track ``with_idx``.
  364. .. _class_Animation_method_transform_track_insert_key:
  365. - :ref:`int<class_int>` **transform_track_insert_key** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, :ref:`Vector3<class_Vector3>` location, :ref:`Quat<class_Quat>` rotation, :ref:`Vector3<class_Vector3>` scale **)**
  366. Insert a transform key for a transform track.
  367. .. _class_Animation_method_transform_track_interpolate:
  368. - :ref:`Array<class_Array>` **transform_track_interpolate** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec **)** const
  369. Returns the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position (:ref:`Vector3<class_Vector3>`), rotation (:ref:`Quat<class_Quat>`) and scale (:ref:`Vector3<class_Vector3>`).
  370. .. _class_Animation_method_value_track_get_key_indices:
  371. - :ref:`PoolIntArray<class_PoolIntArray>` **value_track_get_key_indices** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const
  372. Returns all the key indices of a value track, given a position and delta time.
  373. .. _class_Animation_method_value_track_get_update_mode:
  374. - :ref:`UpdateMode<enum_Animation_UpdateMode>` **value_track_get_update_mode** **(** :ref:`int<class_int>` idx **)** const
  375. Returns the update mode of a value track.
  376. .. _class_Animation_method_value_track_set_update_mode:
  377. - void **value_track_set_update_mode** **(** :ref:`int<class_int>` idx, :ref:`UpdateMode<enum_Animation_UpdateMode>` mode **)**
  378. Sets the update mode (``UPDATE_*``) of a value track.