class_animation.rst 73 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Animation.xml.
  6. .. _class_Animation:
  7. Animation
  8. =========
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. Contains data used to animate everything in the engine.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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.
  15. ::
  16. # This creates an animation that makes the node "Enemy" move to the right by
  17. # 100 pixels in 0.5 seconds.
  18. var animation = Animation.new()
  19. var track_index = animation.add_track(Animation.TYPE_VALUE)
  20. animation.track_set_path(track_index, "Enemy:position:x")
  21. animation.track_insert_key(track_index, 0.0, 0)
  22. animation.track_insert_key(track_index, 0.5, 100)
  23. 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. Animation tracks have different types, each with its own set of dedicated methods. Check :ref:`TrackType<enum_Animation_TrackType>` to see available types.
  24. .. rst-class:: classref-introduction-group
  25. Tutorials
  26. ---------
  27. - :doc:`../tutorials/animation/index`
  28. .. rst-class:: classref-reftable-group
  29. Properties
  30. ----------
  31. .. table::
  32. :widths: auto
  33. +---------------------------+------------------------------------------------+-----------+
  34. | :ref:`float<class_float>` | :ref:`length<class_Animation_property_length>` | ``1.0`` |
  35. +---------------------------+------------------------------------------------+-----------+
  36. | :ref:`bool<class_bool>` | :ref:`loop<class_Animation_property_loop>` | ``false`` |
  37. +---------------------------+------------------------------------------------+-----------+
  38. | :ref:`float<class_float>` | :ref:`step<class_Animation_property_step>` | ``0.1`` |
  39. +---------------------------+------------------------------------------------+-----------+
  40. .. rst-class:: classref-reftable-group
  41. Methods
  42. -------
  43. .. table::
  44. :widths: auto
  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:`String<class_String>` | :ref:`animation_track_get_key_animation<class_Animation_method_animation_track_get_key_animation>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const| |
  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:`String<class_String>` 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:`String<class_String>` 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:`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| |
  69. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :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| |
  71. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :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| |
  73. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :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 ) **)** |
  75. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :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| |
  77. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | 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 **)** |
  79. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | 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 **)** |
  81. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | 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 **)** |
  83. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | void | :ref:`clear<class_Animation_method_clear>` **(** **)** |
  85. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`copy_track<class_Animation_method_copy_track>` **(** :ref:`int<class_int>` track_idx, :ref:`Animation<class_Animation>` to_animation **)** |
  87. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`int<class_int>` | :ref:`find_track<class_Animation_method_find_track>` **(** :ref:`NodePath<class_NodePath>` path **)** |const| |
  89. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`int<class_int>` | :ref:`get_track_count<class_Animation_method_get_track_count>` **(** **)** |const| |
  91. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`method_track_get_key_indices<class_Animation_method_method_track_get_key_indices>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** |const| |
  93. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`String<class_String>` | :ref:`method_track_get_name<class_Animation_method_method_track_get_name>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const| |
  95. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :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| |
  97. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | void | :ref:`remove_track<class_Animation_method_remove_track>` **(** :ref:`int<class_int>` track_idx **)** |
  99. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :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| |
  101. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :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| |
  103. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | :ref:`InterpolationType<enum_Animation_InterpolationType>` | :ref:`track_get_interpolation_type<class_Animation_method_track_get_interpolation_type>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  105. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | :ref:`int<class_int>` | :ref:`track_get_key_count<class_Animation_method_track_get_key_count>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  107. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | :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| |
  109. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :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| |
  111. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :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| |
  113. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`NodePath<class_NodePath>` | :ref:`track_get_path<class_Animation_method_track_get_path>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  115. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`TrackType<enum_Animation_TrackType>` | :ref:`track_get_type<class_Animation_method_track_get_type>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  117. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | 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 **)** |
  119. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | :ref:`bool<class_bool>` | :ref:`track_is_enabled<class_Animation_method_track_is_enabled>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  121. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | :ref:`bool<class_bool>` | :ref:`track_is_imported<class_Animation_method_track_is_imported>` **(** :ref:`int<class_int>` track_idx **)** |const| |
  123. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | void | :ref:`track_move_down<class_Animation_method_track_move_down>` **(** :ref:`int<class_int>` track_idx **)** |
  125. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | void | :ref:`track_move_to<class_Animation_method_track_move_to>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` to_idx **)** |
  127. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | void | :ref:`track_move_up<class_Animation_method_track_move_up>` **(** :ref:`int<class_int>` track_idx **)** |
  129. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | void | :ref:`track_remove_key<class_Animation_method_track_remove_key>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |
  131. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | void | :ref:`track_remove_key_at_position<class_Animation_method_track_remove_key_at_position>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` position **)** |
  133. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | void | :ref:`track_set_enabled<class_Animation_method_track_set_enabled>` **(** :ref:`int<class_int>` track_idx, :ref:`bool<class_bool>` enabled **)** |
  135. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | void | :ref:`track_set_imported<class_Animation_method_track_set_imported>` **(** :ref:`int<class_int>` track_idx, :ref:`bool<class_bool>` imported **)** |
  137. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | 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 **)** |
  139. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | 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 **)** |
  141. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | 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 **)** |
  143. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | 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 **)** |
  145. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | 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 **)** |
  147. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | void | :ref:`track_set_path<class_Animation_method_track_set_path>` **(** :ref:`int<class_int>` track_idx, :ref:`NodePath<class_NodePath>` path **)** |
  149. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | void | :ref:`track_swap<class_Animation_method_track_swap>` **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` with_idx **)** |
  151. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | :ref:`int<class_int>` | :ref:`transform_track_insert_key<class_Animation_method_transform_track_insert_key>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`Vector3<class_Vector3>` location, :ref:`Quat<class_Quat>` rotation, :ref:`Vector3<class_Vector3>` scale **)** |
  153. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. | :ref:`Array<class_Array>` | :ref:`transform_track_interpolate<class_Animation_method_transform_track_interpolate>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec **)** |const| |
  155. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  156. | :ref:`PoolIntArray<class_PoolIntArray>` | :ref:`value_track_get_key_indices<class_Animation_method_value_track_get_key_indices>` **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** |const| |
  157. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  158. | :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| |
  159. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  160. | :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| |
  161. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  162. | 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 **)** |
  163. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  164. .. rst-class:: classref-section-separator
  165. ----
  166. .. rst-class:: classref-descriptions-group
  167. Signals
  168. -------
  169. .. _class_Animation_signal_tracks_changed:
  170. .. rst-class:: classref-signal
  171. **tracks_changed** **(** **)**
  172. Emitted when there's a change in the list of tracks, e.g. tracks are added, moved or have changed paths.
  173. .. rst-class:: classref-section-separator
  174. ----
  175. .. rst-class:: classref-descriptions-group
  176. Enumerations
  177. ------------
  178. .. _enum_Animation_TrackType:
  179. .. rst-class:: classref-enumeration
  180. enum **TrackType**:
  181. .. _class_Animation_constant_TYPE_VALUE:
  182. .. rst-class:: classref-enumeration-constant
  183. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_VALUE** = ``0``
  184. Value tracks set values in node properties, but only those which can be Interpolated.
  185. .. _class_Animation_constant_TYPE_TRANSFORM:
  186. .. rst-class:: classref-enumeration-constant
  187. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_TRANSFORM** = ``1``
  188. Transform tracks are used to change node local transforms or skeleton pose bones. Transitions are interpolated.
  189. .. _class_Animation_constant_TYPE_METHOD:
  190. .. rst-class:: classref-enumeration-constant
  191. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_METHOD** = ``2``
  192. Method tracks call functions with given arguments per key.
  193. .. _class_Animation_constant_TYPE_BEZIER:
  194. .. rst-class:: classref-enumeration-constant
  195. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_BEZIER** = ``3``
  196. 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>`).
  197. .. _class_Animation_constant_TYPE_AUDIO:
  198. .. rst-class:: classref-enumeration-constant
  199. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_AUDIO** = ``4``
  200. 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.
  201. .. _class_Animation_constant_TYPE_ANIMATION:
  202. .. rst-class:: classref-enumeration-constant
  203. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_ANIMATION** = ``5``
  204. Animation tracks play animations in other :ref:`AnimationPlayer<class_AnimationPlayer>` nodes.
  205. .. rst-class:: classref-item-separator
  206. ----
  207. .. _enum_Animation_InterpolationType:
  208. .. rst-class:: classref-enumeration
  209. enum **InterpolationType**:
  210. .. _class_Animation_constant_INTERPOLATION_NEAREST:
  211. .. rst-class:: classref-enumeration-constant
  212. :ref:`InterpolationType<enum_Animation_InterpolationType>` **INTERPOLATION_NEAREST** = ``0``
  213. No interpolation (nearest value).
  214. .. _class_Animation_constant_INTERPOLATION_LINEAR:
  215. .. rst-class:: classref-enumeration-constant
  216. :ref:`InterpolationType<enum_Animation_InterpolationType>` **INTERPOLATION_LINEAR** = ``1``
  217. Linear interpolation.
  218. .. _class_Animation_constant_INTERPOLATION_CUBIC:
  219. .. rst-class:: classref-enumeration-constant
  220. :ref:`InterpolationType<enum_Animation_InterpolationType>` **INTERPOLATION_CUBIC** = ``2``
  221. Cubic interpolation.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _enum_Animation_UpdateMode:
  225. .. rst-class:: classref-enumeration
  226. enum **UpdateMode**:
  227. .. _class_Animation_constant_UPDATE_CONTINUOUS:
  228. .. rst-class:: classref-enumeration-constant
  229. :ref:`UpdateMode<enum_Animation_UpdateMode>` **UPDATE_CONTINUOUS** = ``0``
  230. Update between keyframes.
  231. .. _class_Animation_constant_UPDATE_DISCRETE:
  232. .. rst-class:: classref-enumeration-constant
  233. :ref:`UpdateMode<enum_Animation_UpdateMode>` **UPDATE_DISCRETE** = ``1``
  234. Update at the keyframes and hold the value.
  235. .. _class_Animation_constant_UPDATE_TRIGGER:
  236. .. rst-class:: classref-enumeration-constant
  237. :ref:`UpdateMode<enum_Animation_UpdateMode>` **UPDATE_TRIGGER** = ``2``
  238. Update at the keyframes.
  239. .. _class_Animation_constant_UPDATE_CAPTURE:
  240. .. rst-class:: classref-enumeration-constant
  241. :ref:`UpdateMode<enum_Animation_UpdateMode>` **UPDATE_CAPTURE** = ``3``
  242. 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.
  243. .. rst-class:: classref-section-separator
  244. ----
  245. .. rst-class:: classref-descriptions-group
  246. Property Descriptions
  247. ---------------------
  248. .. _class_Animation_property_length:
  249. .. rst-class:: classref-property
  250. :ref:`float<class_float>` **length** = ``1.0``
  251. .. rst-class:: classref-property-setget
  252. - void **set_length** **(** :ref:`float<class_float>` value **)**
  253. - :ref:`float<class_float>` **get_length** **(** **)**
  254. The total length of the animation (in seconds).
  255. \ **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.
  256. .. rst-class:: classref-item-separator
  257. ----
  258. .. _class_Animation_property_loop:
  259. .. rst-class:: classref-property
  260. :ref:`bool<class_bool>` **loop** = ``false``
  261. .. rst-class:: classref-property-setget
  262. - void **set_loop** **(** :ref:`bool<class_bool>` value **)**
  263. - :ref:`bool<class_bool>` **has_loop** **(** **)**
  264. A flag indicating that the animation must loop. This is used for correct interpolation of animation cycles, and for hinting the player that it must restart the animation.
  265. .. rst-class:: classref-item-separator
  266. ----
  267. .. _class_Animation_property_step:
  268. .. rst-class:: classref-property
  269. :ref:`float<class_float>` **step** = ``0.1``
  270. .. rst-class:: classref-property-setget
  271. - void **set_step** **(** :ref:`float<class_float>` value **)**
  272. - :ref:`float<class_float>` **get_step** **(** **)**
  273. The animation step value.
  274. .. rst-class:: classref-section-separator
  275. ----
  276. .. rst-class:: classref-descriptions-group
  277. Method Descriptions
  278. -------------------
  279. .. _class_Animation_method_add_track:
  280. .. rst-class:: classref-method
  281. :ref:`int<class_int>` **add_track** **(** :ref:`TrackType<enum_Animation_TrackType>` type, :ref:`int<class_int>` at_position=-1 **)**
  282. Adds a track to the Animation.
  283. .. rst-class:: classref-item-separator
  284. ----
  285. .. _class_Animation_method_animation_track_get_key_animation:
  286. .. rst-class:: classref-method
  287. :ref:`String<class_String>` **animation_track_get_key_animation** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  288. Returns the animation name at the key identified by ``key_idx``. The ``track_idx`` must be the index of an Animation Track.
  289. .. rst-class:: classref-item-separator
  290. ----
  291. .. _class_Animation_method_animation_track_insert_key:
  292. .. rst-class:: classref-method
  293. :ref:`int<class_int>` **animation_track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`String<class_String>` animation **)**
  294. Inserts a key with value ``animation`` at the given ``time`` (in seconds). The ``track_idx`` must be the index of an Animation Track.
  295. .. rst-class:: classref-item-separator
  296. ----
  297. .. _class_Animation_method_animation_track_set_key_animation:
  298. .. rst-class:: classref-method
  299. void **animation_track_set_key_animation** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`String<class_String>` animation **)**
  300. Sets the key identified by ``key_idx`` to value ``animation``. The ``track_idx`` must be the index of an Animation Track.
  301. .. rst-class:: classref-item-separator
  302. ----
  303. .. _class_Animation_method_audio_track_get_key_end_offset:
  304. .. rst-class:: classref-method
  305. :ref:`float<class_float>` **audio_track_get_key_end_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  306. Returns the end offset of the key identified by ``key_idx``. The ``track_idx`` must be the index of an Audio Track.
  307. End offset is the number of seconds cut off at the ending of the audio stream.
  308. .. rst-class:: classref-item-separator
  309. ----
  310. .. _class_Animation_method_audio_track_get_key_start_offset:
  311. .. rst-class:: classref-method
  312. :ref:`float<class_float>` **audio_track_get_key_start_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  313. Returns the start offset of the key identified by ``key_idx``. The ``track_idx`` must be the index of an Audio Track.
  314. Start offset is the number of seconds cut off at the beginning of the audio stream.
  315. .. rst-class:: classref-item-separator
  316. ----
  317. .. _class_Animation_method_audio_track_get_key_stream:
  318. .. rst-class:: classref-method
  319. :ref:`Resource<class_Resource>` **audio_track_get_key_stream** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  320. Returns the audio stream of the key identified by ``key_idx``. The ``track_idx`` must be the index of an Audio Track.
  321. .. rst-class:: classref-item-separator
  322. ----
  323. .. _class_Animation_method_audio_track_insert_key:
  324. .. rst-class:: classref-method
  325. :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 **)**
  326. Inserts an Audio Track key at the given ``time`` in seconds. The ``track_idx`` must be the index of an Audio Track.
  327. \ ``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.
  328. .. rst-class:: classref-item-separator
  329. ----
  330. .. _class_Animation_method_audio_track_set_key_end_offset:
  331. .. rst-class:: classref-method
  332. void **audio_track_set_key_end_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)**
  333. 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.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _class_Animation_method_audio_track_set_key_start_offset:
  337. .. rst-class:: classref-method
  338. void **audio_track_set_key_start_offset** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` offset **)**
  339. 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.
  340. .. rst-class:: classref-item-separator
  341. ----
  342. .. _class_Animation_method_audio_track_set_key_stream:
  343. .. rst-class:: classref-method
  344. void **audio_track_set_key_stream** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`Resource<class_Resource>` stream **)**
  345. Sets the stream of the key identified by ``key_idx`` to value ``stream``. The ``track_idx`` must be the index of an Audio Track.
  346. .. rst-class:: classref-item-separator
  347. ----
  348. .. _class_Animation_method_bezier_track_get_key_in_handle:
  349. .. rst-class:: classref-method
  350. :ref:`Vector2<class_Vector2>` **bezier_track_get_key_in_handle** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  351. Returns the in handle of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
  352. .. rst-class:: classref-item-separator
  353. ----
  354. .. _class_Animation_method_bezier_track_get_key_out_handle:
  355. .. rst-class:: classref-method
  356. :ref:`Vector2<class_Vector2>` **bezier_track_get_key_out_handle** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  357. Returns the out handle of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
  358. .. rst-class:: classref-item-separator
  359. ----
  360. .. _class_Animation_method_bezier_track_get_key_value:
  361. .. rst-class:: classref-method
  362. :ref:`float<class_float>` **bezier_track_get_key_value** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  363. Returns the value of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
  364. .. rst-class:: classref-item-separator
  365. ----
  366. .. _class_Animation_method_bezier_track_insert_key:
  367. .. rst-class:: classref-method
  368. :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 ) **)**
  369. Inserts a Bezier Track key at the given ``time`` in seconds. The ``track_idx`` must be the index of a Bezier Track.
  370. \ ``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.
  371. .. rst-class:: classref-item-separator
  372. ----
  373. .. _class_Animation_method_bezier_track_interpolate:
  374. .. rst-class:: classref-method
  375. :ref:`float<class_float>` **bezier_track_interpolate** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time **)** |const|
  376. Returns the interpolated value at the given ``time`` (in seconds). The ``track_idx`` must be the index of a Bezier Track.
  377. .. rst-class:: classref-item-separator
  378. ----
  379. .. _class_Animation_method_bezier_track_set_key_in_handle:
  380. .. rst-class:: classref-method
  381. 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 **)**
  382. 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.
  383. .. rst-class:: classref-item-separator
  384. ----
  385. .. _class_Animation_method_bezier_track_set_key_out_handle:
  386. .. rst-class:: classref-method
  387. 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 **)**
  388. 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.
  389. .. rst-class:: classref-item-separator
  390. ----
  391. .. _class_Animation_method_bezier_track_set_key_value:
  392. .. rst-class:: classref-method
  393. void **bezier_track_set_key_value** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` value **)**
  394. 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.
  395. .. rst-class:: classref-item-separator
  396. ----
  397. .. _class_Animation_method_clear:
  398. .. rst-class:: classref-method
  399. void **clear** **(** **)**
  400. Clear the animation (clear all tracks and reset all).
  401. .. rst-class:: classref-item-separator
  402. ----
  403. .. _class_Animation_method_copy_track:
  404. .. rst-class:: classref-method
  405. void **copy_track** **(** :ref:`int<class_int>` track_idx, :ref:`Animation<class_Animation>` to_animation **)**
  406. Adds a new track that is a copy of the given track from ``to_animation``.
  407. .. rst-class:: classref-item-separator
  408. ----
  409. .. _class_Animation_method_find_track:
  410. .. rst-class:: classref-method
  411. :ref:`int<class_int>` **find_track** **(** :ref:`NodePath<class_NodePath>` path **)** |const|
  412. Returns the index of the specified track. If the track is not found, return -1.
  413. .. rst-class:: classref-item-separator
  414. ----
  415. .. _class_Animation_method_get_track_count:
  416. .. rst-class:: classref-method
  417. :ref:`int<class_int>` **get_track_count** **(** **)** |const|
  418. Returns the amount of tracks in the animation.
  419. .. rst-class:: classref-item-separator
  420. ----
  421. .. _class_Animation_method_method_track_get_key_indices:
  422. .. rst-class:: classref-method
  423. :ref:`PoolIntArray<class_PoolIntArray>` **method_track_get_key_indices** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** |const|
  424. Returns all the key indices of a method track, given a position and delta time.
  425. .. rst-class:: classref-item-separator
  426. ----
  427. .. _class_Animation_method_method_track_get_name:
  428. .. rst-class:: classref-method
  429. :ref:`String<class_String>` **method_track_get_name** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  430. Returns the method name of a method track.
  431. .. rst-class:: classref-item-separator
  432. ----
  433. .. _class_Animation_method_method_track_get_params:
  434. .. rst-class:: classref-method
  435. :ref:`Array<class_Array>` **method_track_get_params** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  436. Returns the arguments values to be called on a method track for a given key in a given track.
  437. .. rst-class:: classref-item-separator
  438. ----
  439. .. _class_Animation_method_remove_track:
  440. .. rst-class:: classref-method
  441. void **remove_track** **(** :ref:`int<class_int>` track_idx **)**
  442. Removes a track by specifying the track index.
  443. .. rst-class:: classref-item-separator
  444. ----
  445. .. _class_Animation_method_track_find_key:
  446. .. rst-class:: classref-method
  447. :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|
  448. Finds the key index by time in a given track. Optionally, only find it if the exact time is given.
  449. .. rst-class:: classref-item-separator
  450. ----
  451. .. _class_Animation_method_track_get_interpolation_loop_wrap:
  452. .. rst-class:: classref-method
  453. :ref:`bool<class_bool>` **track_get_interpolation_loop_wrap** **(** :ref:`int<class_int>` track_idx **)** |const|
  454. Returns ``true`` if the track at ``idx`` wraps the interpolation loop. New tracks wrap the interpolation loop by default.
  455. .. rst-class:: classref-item-separator
  456. ----
  457. .. _class_Animation_method_track_get_interpolation_type:
  458. .. rst-class:: classref-method
  459. :ref:`InterpolationType<enum_Animation_InterpolationType>` **track_get_interpolation_type** **(** :ref:`int<class_int>` track_idx **)** |const|
  460. Returns the interpolation type of a given track.
  461. .. rst-class:: classref-item-separator
  462. ----
  463. .. _class_Animation_method_track_get_key_count:
  464. .. rst-class:: classref-method
  465. :ref:`int<class_int>` **track_get_key_count** **(** :ref:`int<class_int>` track_idx **)** |const|
  466. Returns the amount of keys in a given track.
  467. .. rst-class:: classref-item-separator
  468. ----
  469. .. _class_Animation_method_track_get_key_time:
  470. .. rst-class:: classref-method
  471. :ref:`float<class_float>` **track_get_key_time** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  472. Returns the time at which the key is located.
  473. .. rst-class:: classref-item-separator
  474. ----
  475. .. _class_Animation_method_track_get_key_transition:
  476. .. rst-class:: classref-method
  477. :ref:`float<class_float>` **track_get_key_transition** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  478. Returns the transition curve (easing) for a specific key (see the built-in math function :ref:`@GDScript.ease<class_@GDScript_method_ease>`).
  479. .. rst-class:: classref-item-separator
  480. ----
  481. .. _class_Animation_method_track_get_key_value:
  482. .. rst-class:: classref-method
  483. :ref:`Variant<class_Variant>` **track_get_key_value** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)** |const|
  484. Returns the value of a given key in a given track.
  485. .. rst-class:: classref-item-separator
  486. ----
  487. .. _class_Animation_method_track_get_path:
  488. .. rst-class:: classref-method
  489. :ref:`NodePath<class_NodePath>` **track_get_path** **(** :ref:`int<class_int>` track_idx **)** |const|
  490. Gets the path of a track. For more information on the path format, see :ref:`track_set_path<class_Animation_method_track_set_path>`.
  491. .. rst-class:: classref-item-separator
  492. ----
  493. .. _class_Animation_method_track_get_type:
  494. .. rst-class:: classref-method
  495. :ref:`TrackType<enum_Animation_TrackType>` **track_get_type** **(** :ref:`int<class_int>` track_idx **)** |const|
  496. Gets the type of a track.
  497. .. rst-class:: classref-item-separator
  498. ----
  499. .. _class_Animation_method_track_insert_key:
  500. .. rst-class:: classref-method
  501. 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 **)**
  502. Insert a generic key in a given track.
  503. .. rst-class:: classref-item-separator
  504. ----
  505. .. _class_Animation_method_track_is_enabled:
  506. .. rst-class:: classref-method
  507. :ref:`bool<class_bool>` **track_is_enabled** **(** :ref:`int<class_int>` track_idx **)** |const|
  508. Returns ``true`` if the track at index ``idx`` is enabled.
  509. .. rst-class:: classref-item-separator
  510. ----
  511. .. _class_Animation_method_track_is_imported:
  512. .. rst-class:: classref-method
  513. :ref:`bool<class_bool>` **track_is_imported** **(** :ref:`int<class_int>` track_idx **)** |const|
  514. Returns ``true`` if the given track is imported. Else, return ``false``.
  515. .. rst-class:: classref-item-separator
  516. ----
  517. .. _class_Animation_method_track_move_down:
  518. .. rst-class:: classref-method
  519. void **track_move_down** **(** :ref:`int<class_int>` track_idx **)**
  520. Moves a track down.
  521. .. rst-class:: classref-item-separator
  522. ----
  523. .. _class_Animation_method_track_move_to:
  524. .. rst-class:: classref-method
  525. void **track_move_to** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` to_idx **)**
  526. Changes the index position of track ``idx`` to the one defined in ``to_idx``.
  527. .. rst-class:: classref-item-separator
  528. ----
  529. .. _class_Animation_method_track_move_up:
  530. .. rst-class:: classref-method
  531. void **track_move_up** **(** :ref:`int<class_int>` track_idx **)**
  532. Moves a track up.
  533. .. rst-class:: classref-item-separator
  534. ----
  535. .. _class_Animation_method_track_remove_key:
  536. .. rst-class:: classref-method
  537. void **track_remove_key** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx **)**
  538. Removes a key by index in a given track.
  539. .. rst-class:: classref-item-separator
  540. ----
  541. .. _class_Animation_method_track_remove_key_at_position:
  542. .. rst-class:: classref-method
  543. void **track_remove_key_at_position** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` position **)**
  544. Removes a key by position (seconds) in a given track.
  545. .. rst-class:: classref-item-separator
  546. ----
  547. .. _class_Animation_method_track_set_enabled:
  548. .. rst-class:: classref-method
  549. void **track_set_enabled** **(** :ref:`int<class_int>` track_idx, :ref:`bool<class_bool>` enabled **)**
  550. Enables/disables the given track. Tracks are enabled by default.
  551. .. rst-class:: classref-item-separator
  552. ----
  553. .. _class_Animation_method_track_set_imported:
  554. .. rst-class:: classref-method
  555. void **track_set_imported** **(** :ref:`int<class_int>` track_idx, :ref:`bool<class_bool>` imported **)**
  556. Sets the given track as imported or not.
  557. .. rst-class:: classref-item-separator
  558. ----
  559. .. _class_Animation_method_track_set_interpolation_loop_wrap:
  560. .. rst-class:: classref-method
  561. void **track_set_interpolation_loop_wrap** **(** :ref:`int<class_int>` track_idx, :ref:`bool<class_bool>` interpolation **)**
  562. If ``true``, the track at ``idx`` wraps the interpolation loop.
  563. .. rst-class:: classref-item-separator
  564. ----
  565. .. _class_Animation_method_track_set_interpolation_type:
  566. .. rst-class:: classref-method
  567. void **track_set_interpolation_type** **(** :ref:`int<class_int>` track_idx, :ref:`InterpolationType<enum_Animation_InterpolationType>` interpolation **)**
  568. Sets the interpolation type of a given track.
  569. .. rst-class:: classref-item-separator
  570. ----
  571. .. _class_Animation_method_track_set_key_time:
  572. .. rst-class:: classref-method
  573. void **track_set_key_time** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` time **)**
  574. Sets the time of an existing key.
  575. .. rst-class:: classref-item-separator
  576. ----
  577. .. _class_Animation_method_track_set_key_transition:
  578. .. rst-class:: classref-method
  579. void **track_set_key_transition** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` transition **)**
  580. Sets the transition curve (easing) for a specific key (see the built-in math function :ref:`@GDScript.ease<class_@GDScript_method_ease>`).
  581. .. rst-class:: classref-item-separator
  582. ----
  583. .. _class_Animation_method_track_set_key_value:
  584. .. rst-class:: classref-method
  585. void **track_set_key_value** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` key, :ref:`Variant<class_Variant>` value **)**
  586. Sets the value of an existing key.
  587. .. rst-class:: classref-item-separator
  588. ----
  589. .. _class_Animation_method_track_set_path:
  590. .. rst-class:: classref-method
  591. void **track_set_path** **(** :ref:`int<class_int>` track_idx, :ref:`NodePath<class_NodePath>` path **)**
  592. 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 ``":"``.
  593. For example, ``"character/skeleton:ankle"`` or ``"character/mesh:transform/local"``.
  594. .. rst-class:: classref-item-separator
  595. ----
  596. .. _class_Animation_method_track_swap:
  597. .. rst-class:: classref-method
  598. void **track_swap** **(** :ref:`int<class_int>` track_idx, :ref:`int<class_int>` with_idx **)**
  599. Swaps the track ``idx``'s index position with the track ``with_idx``.
  600. .. rst-class:: classref-item-separator
  601. ----
  602. .. _class_Animation_method_transform_track_insert_key:
  603. .. rst-class:: classref-method
  604. :ref:`int<class_int>` **transform_track_insert_key** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time, :ref:`Vector3<class_Vector3>` location, :ref:`Quat<class_Quat>` rotation, :ref:`Vector3<class_Vector3>` scale **)**
  605. Insert a transform key for a transform track.
  606. .. rst-class:: classref-item-separator
  607. ----
  608. .. _class_Animation_method_transform_track_interpolate:
  609. .. rst-class:: classref-method
  610. :ref:`Array<class_Array>` **transform_track_interpolate** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec **)** |const|
  611. 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>`).
  612. .. rst-class:: classref-item-separator
  613. ----
  614. .. _class_Animation_method_value_track_get_key_indices:
  615. .. rst-class:: classref-method
  616. :ref:`PoolIntArray<class_PoolIntArray>` **value_track_get_key_indices** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** |const|
  617. Returns all the key indices of a value track, given a position and delta time.
  618. .. rst-class:: classref-item-separator
  619. ----
  620. .. _class_Animation_method_value_track_get_update_mode:
  621. .. rst-class:: classref-method
  622. :ref:`UpdateMode<enum_Animation_UpdateMode>` **value_track_get_update_mode** **(** :ref:`int<class_int>` track_idx **)** |const|
  623. Returns the update mode of a value track.
  624. .. rst-class:: classref-item-separator
  625. ----
  626. .. _class_Animation_method_value_track_interpolate:
  627. .. rst-class:: classref-method
  628. :ref:`Variant<class_Variant>` **value_track_interpolate** **(** :ref:`int<class_int>` track_idx, :ref:`float<class_float>` time_sec **)** |const|
  629. Returns the interpolated value at the given time (in seconds). The ``track_idx`` must be the index of a value track.
  630. .. rst-class:: classref-item-separator
  631. ----
  632. .. _class_Animation_method_value_track_set_update_mode:
  633. .. rst-class:: classref-method
  634. void **value_track_set_update_mode** **(** :ref:`int<class_int>` track_idx, :ref:`UpdateMode<enum_Animation_UpdateMode>` mode **)**
  635. Sets the update mode (see :ref:`UpdateMode<enum_Animation_UpdateMode>`) of a value track.
  636. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  637. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  638. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  639. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`