class_animation.rst 95 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412
  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/4.3/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Animation.xml.
  6. .. _class_Animation:
  7. Animation
  8. =========
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Holds data that can be used to animate anything in the engine.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This resource holds data that can be used to animate anything in the engine. Animations are divided into tracks and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track.
  15. .. tabs::
  16. .. code-tab:: gdscript
  17. # This creates an animation that makes the node "Enemy" move to the right by
  18. # 100 pixels in 2.0 seconds.
  19. var animation = Animation.new()
  20. var track_index = animation.add_track(Animation.TYPE_VALUE)
  21. animation.track_set_path(track_index, "Enemy:position:x")
  22. animation.track_insert_key(track_index, 0.0, 0)
  23. animation.track_insert_key(track_index, 2.0, 100)
  24. animation.length = 2.0
  25. .. code-tab:: csharp
  26. // This creates an animation that makes the node "Enemy" move to the right by
  27. // 100 pixels in 2.0 seconds.
  28. var animation = new Animation();
  29. int trackIndex = animation.AddTrack(Animation.TrackType.Value);
  30. animation.TrackSetPath(trackIndex, "Enemy:position:x");
  31. animation.TrackInsertKey(trackIndex, 0.0f, 0);
  32. animation.TrackInsertKey(trackIndex, 2.0f, 100);
  33. animation.Length = 2.0f;
  34. Animations are just data containers, and must be added to nodes such as an :ref:`AnimationPlayer<class_AnimationPlayer>` to be played back. Animation tracks have different types, each with its own set of dedicated methods. Check :ref:`TrackType<enum_Animation_TrackType>` to see available types.
  35. \ **Note:** For 3D position/rotation/scale, using the dedicated :ref:`TYPE_POSITION_3D<class_Animation_constant_TYPE_POSITION_3D>`, :ref:`TYPE_ROTATION_3D<class_Animation_constant_TYPE_ROTATION_3D>` and :ref:`TYPE_SCALE_3D<class_Animation_constant_TYPE_SCALE_3D>` track types instead of :ref:`TYPE_VALUE<class_Animation_constant_TYPE_VALUE>` is recommended for performance reasons.
  36. .. rst-class:: classref-introduction-group
  37. Tutorials
  38. ---------
  39. - :doc:`Animation documentation index <../tutorials/animation/index>`
  40. .. rst-class:: classref-reftable-group
  41. Properties
  42. ----------
  43. .. table::
  44. :widths: auto
  45. +------------------------------------------+--------------------------------------------------------------------+---------------+
  46. | :ref:`bool<class_bool>` | :ref:`capture_included<class_Animation_property_capture_included>` | ``false`` |
  47. +------------------------------------------+--------------------------------------------------------------------+---------------+
  48. | :ref:`float<class_float>` | :ref:`length<class_Animation_property_length>` | ``1.0`` |
  49. +------------------------------------------+--------------------------------------------------------------------+---------------+
  50. | :ref:`LoopMode<enum_Animation_LoopMode>` | :ref:`loop_mode<class_Animation_property_loop_mode>` | ``0`` |
  51. +------------------------------------------+--------------------------------------------------------------------+---------------+
  52. | :ref:`float<class_float>` | :ref:`step<class_Animation_property_step>` | ``0.0333333`` |
  53. +------------------------------------------+--------------------------------------------------------------------+---------------+
  54. .. rst-class:: classref-reftable-group
  55. Methods
  56. -------
  57. .. table::
  58. :widths: auto
  59. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`int<class_int>` | :ref:`add_track<class_Animation_method_add_track>`\ (\ type\: :ref:`TrackType<enum_Animation_TrackType>`, at_position\: :ref:`int<class_int>` = -1\ ) |
  61. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`StringName<class_StringName>` | :ref:`animation_track_get_key_animation<class_Animation_method_animation_track_get_key_animation>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  63. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`int<class_int>` | :ref:`animation_track_insert_key<class_Animation_method_animation_track_insert_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, animation\: :ref:`StringName<class_StringName>`\ ) |
  65. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | |void| | :ref:`animation_track_set_key_animation<class_Animation_method_animation_track_set_key_animation>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, animation\: :ref:`StringName<class_StringName>`\ ) |
  67. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`float<class_float>` | :ref:`audio_track_get_key_end_offset<class_Animation_method_audio_track_get_key_end_offset>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  69. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`float<class_float>` | :ref:`audio_track_get_key_start_offset<class_Animation_method_audio_track_get_key_start_offset>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  71. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`Resource<class_Resource>` | :ref:`audio_track_get_key_stream<class_Animation_method_audio_track_get_key_stream>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  73. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`int<class_int>` | :ref:`audio_track_insert_key<class_Animation_method_audio_track_insert_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, stream\: :ref:`Resource<class_Resource>`, start_offset\: :ref:`float<class_float>` = 0, end_offset\: :ref:`float<class_float>` = 0\ ) |
  75. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`bool<class_bool>` | :ref:`audio_track_is_use_blend<class_Animation_method_audio_track_is_use_blend>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| |
  77. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | |void| | :ref:`audio_track_set_key_end_offset<class_Animation_method_audio_track_set_key_end_offset>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, offset\: :ref:`float<class_float>`\ ) |
  79. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | |void| | :ref:`audio_track_set_key_start_offset<class_Animation_method_audio_track_set_key_start_offset>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, offset\: :ref:`float<class_float>`\ ) |
  81. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | |void| | :ref:`audio_track_set_key_stream<class_Animation_method_audio_track_set_key_stream>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, stream\: :ref:`Resource<class_Resource>`\ ) |
  83. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | |void| | :ref:`audio_track_set_use_blend<class_Animation_method_audio_track_set_use_blend>`\ (\ track_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
  85. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`Vector2<class_Vector2>` | :ref:`bezier_track_get_key_in_handle<class_Animation_method_bezier_track_get_key_in_handle>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  87. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`Vector2<class_Vector2>` | :ref:`bezier_track_get_key_out_handle<class_Animation_method_bezier_track_get_key_out_handle>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  89. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`float<class_float>` | :ref:`bezier_track_get_key_value<class_Animation_method_bezier_track_get_key_value>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  91. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`int<class_int>` | :ref:`bezier_track_insert_key<class_Animation_method_bezier_track_insert_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, value\: :ref:`float<class_float>`, in_handle\: :ref:`Vector2<class_Vector2>` = Vector2(0, 0), out_handle\: :ref:`Vector2<class_Vector2>` = Vector2(0, 0)\ ) |
  93. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`float<class_float>` | :ref:`bezier_track_interpolate<class_Animation_method_bezier_track_interpolate>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`\ ) |const| |
  95. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | |void| | :ref:`bezier_track_set_key_in_handle<class_Animation_method_bezier_track_set_key_in_handle>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, in_handle\: :ref:`Vector2<class_Vector2>`, balanced_value_time_ratio\: :ref:`float<class_float>` = 1.0\ ) |
  97. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | |void| | :ref:`bezier_track_set_key_out_handle<class_Animation_method_bezier_track_set_key_out_handle>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, out_handle\: :ref:`Vector2<class_Vector2>`, balanced_value_time_ratio\: :ref:`float<class_float>` = 1.0\ ) |
  99. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | |void| | :ref:`bezier_track_set_key_value<class_Animation_method_bezier_track_set_key_value>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, value\: :ref:`float<class_float>`\ ) |
  101. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :ref:`int<class_int>` | :ref:`blend_shape_track_insert_key<class_Animation_method_blend_shape_track_insert_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, amount\: :ref:`float<class_float>`\ ) |
  103. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | :ref:`float<class_float>` | :ref:`blend_shape_track_interpolate<class_Animation_method_blend_shape_track_interpolate>`\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| |
  105. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | |void| | :ref:`clear<class_Animation_method_clear>`\ (\ ) |
  107. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | |void| | :ref:`compress<class_Animation_method_compress>`\ (\ page_size\: :ref:`int<class_int>` = 8192, fps\: :ref:`int<class_int>` = 120, split_tolerance\: :ref:`float<class_float>` = 4.0\ ) |
  109. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | |void| | :ref:`copy_track<class_Animation_method_copy_track>`\ (\ track_idx\: :ref:`int<class_int>`, to_animation\: :ref:`Animation<class_Animation>`\ ) |
  111. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`int<class_int>` | :ref:`find_track<class_Animation_method_find_track>`\ (\ path\: :ref:`NodePath<class_NodePath>`, type\: :ref:`TrackType<enum_Animation_TrackType>`\ ) |const| |
  113. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`int<class_int>` | :ref:`get_track_count<class_Animation_method_get_track_count>`\ (\ ) |const| |
  115. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`StringName<class_StringName>` | :ref:`method_track_get_name<class_Animation_method_method_track_get_name>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  117. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | :ref:`Array<class_Array>` | :ref:`method_track_get_params<class_Animation_method_method_track_get_params>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  119. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | :ref:`int<class_int>` | :ref:`position_track_insert_key<class_Animation_method_position_track_insert_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, position\: :ref:`Vector3<class_Vector3>`\ ) |
  121. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | :ref:`Vector3<class_Vector3>` | :ref:`position_track_interpolate<class_Animation_method_position_track_interpolate>`\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| |
  123. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | |void| | :ref:`remove_track<class_Animation_method_remove_track>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |
  125. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | :ref:`int<class_int>` | :ref:`rotation_track_insert_key<class_Animation_method_rotation_track_insert_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, rotation\: :ref:`Quaternion<class_Quaternion>`\ ) |
  127. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | :ref:`Quaternion<class_Quaternion>` | :ref:`rotation_track_interpolate<class_Animation_method_rotation_track_interpolate>`\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| |
  129. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | :ref:`int<class_int>` | :ref:`scale_track_insert_key<class_Animation_method_scale_track_insert_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, scale\: :ref:`Vector3<class_Vector3>`\ ) |
  131. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | :ref:`Vector3<class_Vector3>` | :ref:`scale_track_interpolate<class_Animation_method_scale_track_interpolate>`\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| |
  133. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | :ref:`int<class_int>` | :ref:`track_find_key<class_Animation_method_track_find_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, find_mode\: :ref:`FindMode<enum_Animation_FindMode>` = 0, limit\: :ref:`bool<class_bool>` = false, backward\: :ref:`bool<class_bool>` = false\ ) |const| |
  135. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | :ref:`bool<class_bool>` | :ref:`track_get_interpolation_loop_wrap<class_Animation_method_track_get_interpolation_loop_wrap>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| |
  137. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | :ref:`InterpolationType<enum_Animation_InterpolationType>` | :ref:`track_get_interpolation_type<class_Animation_method_track_get_interpolation_type>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| |
  139. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | :ref:`int<class_int>` | :ref:`track_get_key_count<class_Animation_method_track_get_key_count>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| |
  141. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | :ref:`float<class_float>` | :ref:`track_get_key_time<class_Animation_method_track_get_key_time>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  143. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | :ref:`float<class_float>` | :ref:`track_get_key_transition<class_Animation_method_track_get_key_transition>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  145. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | :ref:`Variant<class_Variant>` | :ref:`track_get_key_value<class_Animation_method_track_get_key_value>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| |
  147. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | :ref:`NodePath<class_NodePath>` | :ref:`track_get_path<class_Animation_method_track_get_path>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| |
  149. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | :ref:`TrackType<enum_Animation_TrackType>` | :ref:`track_get_type<class_Animation_method_track_get_type>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| |
  151. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | :ref:`int<class_int>` | :ref:`track_insert_key<class_Animation_method_track_insert_key>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, key\: :ref:`Variant<class_Variant>`, transition\: :ref:`float<class_float>` = 1\ ) |
  153. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. | :ref:`bool<class_bool>` | :ref:`track_is_compressed<class_Animation_method_track_is_compressed>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| |
  155. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  156. | :ref:`bool<class_bool>` | :ref:`track_is_enabled<class_Animation_method_track_is_enabled>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| |
  157. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  158. | :ref:`bool<class_bool>` | :ref:`track_is_imported<class_Animation_method_track_is_imported>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| |
  159. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  160. | |void| | :ref:`track_move_down<class_Animation_method_track_move_down>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |
  161. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  162. | |void| | :ref:`track_move_to<class_Animation_method_track_move_to>`\ (\ track_idx\: :ref:`int<class_int>`, to_idx\: :ref:`int<class_int>`\ ) |
  163. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  164. | |void| | :ref:`track_move_up<class_Animation_method_track_move_up>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |
  165. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  166. | |void| | :ref:`track_remove_key<class_Animation_method_track_remove_key>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |
  167. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  168. | |void| | :ref:`track_remove_key_at_time<class_Animation_method_track_remove_key_at_time>`\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`\ ) |
  169. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  170. | |void| | :ref:`track_set_enabled<class_Animation_method_track_set_enabled>`\ (\ track_idx\: :ref:`int<class_int>`, enabled\: :ref:`bool<class_bool>`\ ) |
  171. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  172. | |void| | :ref:`track_set_imported<class_Animation_method_track_set_imported>`\ (\ track_idx\: :ref:`int<class_int>`, imported\: :ref:`bool<class_bool>`\ ) |
  173. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  174. | |void| | :ref:`track_set_interpolation_loop_wrap<class_Animation_method_track_set_interpolation_loop_wrap>`\ (\ track_idx\: :ref:`int<class_int>`, interpolation\: :ref:`bool<class_bool>`\ ) |
  175. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  176. | |void| | :ref:`track_set_interpolation_type<class_Animation_method_track_set_interpolation_type>`\ (\ track_idx\: :ref:`int<class_int>`, interpolation\: :ref:`InterpolationType<enum_Animation_InterpolationType>`\ ) |
  177. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  178. | |void| | :ref:`track_set_key_time<class_Animation_method_track_set_key_time>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`\ ) |
  179. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  180. | |void| | :ref:`track_set_key_transition<class_Animation_method_track_set_key_transition>`\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, transition\: :ref:`float<class_float>`\ ) |
  181. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  182. | |void| | :ref:`track_set_key_value<class_Animation_method_track_set_key_value>`\ (\ track_idx\: :ref:`int<class_int>`, key\: :ref:`int<class_int>`, value\: :ref:`Variant<class_Variant>`\ ) |
  183. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  184. | |void| | :ref:`track_set_path<class_Animation_method_track_set_path>`\ (\ track_idx\: :ref:`int<class_int>`, path\: :ref:`NodePath<class_NodePath>`\ ) |
  185. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  186. | |void| | :ref:`track_swap<class_Animation_method_track_swap>`\ (\ track_idx\: :ref:`int<class_int>`, with_idx\: :ref:`int<class_int>`\ ) |
  187. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  188. | :ref:`UpdateMode<enum_Animation_UpdateMode>` | :ref:`value_track_get_update_mode<class_Animation_method_value_track_get_update_mode>`\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| |
  189. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  190. | :ref:`Variant<class_Variant>` | :ref:`value_track_interpolate<class_Animation_method_value_track_interpolate>`\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| |
  191. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  192. | |void| | :ref:`value_track_set_update_mode<class_Animation_method_value_track_set_update_mode>`\ (\ track_idx\: :ref:`int<class_int>`, mode\: :ref:`UpdateMode<enum_Animation_UpdateMode>`\ ) |
  193. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  194. .. rst-class:: classref-section-separator
  195. ----
  196. .. rst-class:: classref-descriptions-group
  197. Enumerations
  198. ------------
  199. .. _enum_Animation_TrackType:
  200. .. rst-class:: classref-enumeration
  201. enum **TrackType**: :ref:`๐Ÿ”—<enum_Animation_TrackType>`
  202. .. _class_Animation_constant_TYPE_VALUE:
  203. .. rst-class:: classref-enumeration-constant
  204. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_VALUE** = ``0``
  205. Value tracks set values in node properties, but only those which can be interpolated. For 3D position/rotation/scale, using the dedicated :ref:`TYPE_POSITION_3D<class_Animation_constant_TYPE_POSITION_3D>`, :ref:`TYPE_ROTATION_3D<class_Animation_constant_TYPE_ROTATION_3D>` and :ref:`TYPE_SCALE_3D<class_Animation_constant_TYPE_SCALE_3D>` track types instead of :ref:`TYPE_VALUE<class_Animation_constant_TYPE_VALUE>` is recommended for performance reasons.
  206. .. _class_Animation_constant_TYPE_POSITION_3D:
  207. .. rst-class:: classref-enumeration-constant
  208. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_POSITION_3D** = ``1``
  209. 3D position track (values are stored in :ref:`Vector3<class_Vector3>`\ s).
  210. .. _class_Animation_constant_TYPE_ROTATION_3D:
  211. .. rst-class:: classref-enumeration-constant
  212. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_ROTATION_3D** = ``2``
  213. 3D rotation track (values are stored in :ref:`Quaternion<class_Quaternion>`\ s).
  214. .. _class_Animation_constant_TYPE_SCALE_3D:
  215. .. rst-class:: classref-enumeration-constant
  216. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_SCALE_3D** = ``3``
  217. 3D scale track (values are stored in :ref:`Vector3<class_Vector3>`\ s).
  218. .. _class_Animation_constant_TYPE_BLEND_SHAPE:
  219. .. rst-class:: classref-enumeration-constant
  220. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_BLEND_SHAPE** = ``4``
  221. Blend shape track.
  222. .. _class_Animation_constant_TYPE_METHOD:
  223. .. rst-class:: classref-enumeration-constant
  224. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_METHOD** = ``5``
  225. Method tracks call functions with given arguments per key.
  226. .. _class_Animation_constant_TYPE_BEZIER:
  227. .. rst-class:: classref-enumeration-constant
  228. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_BEZIER** = ``6``
  229. 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>`).
  230. .. _class_Animation_constant_TYPE_AUDIO:
  231. .. rst-class:: classref-enumeration-constant
  232. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_AUDIO** = ``7``
  233. 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.
  234. .. _class_Animation_constant_TYPE_ANIMATION:
  235. .. rst-class:: classref-enumeration-constant
  236. :ref:`TrackType<enum_Animation_TrackType>` **TYPE_ANIMATION** = ``8``
  237. Animation tracks play animations in other :ref:`AnimationPlayer<class_AnimationPlayer>` nodes.
  238. .. rst-class:: classref-item-separator
  239. ----
  240. .. _enum_Animation_InterpolationType:
  241. .. rst-class:: classref-enumeration
  242. enum **InterpolationType**: :ref:`๐Ÿ”—<enum_Animation_InterpolationType>`
  243. .. _class_Animation_constant_INTERPOLATION_NEAREST:
  244. .. rst-class:: classref-enumeration-constant
  245. :ref:`InterpolationType<enum_Animation_InterpolationType>` **INTERPOLATION_NEAREST** = ``0``
  246. No interpolation (nearest value).
  247. .. _class_Animation_constant_INTERPOLATION_LINEAR:
  248. .. rst-class:: classref-enumeration-constant
  249. :ref:`InterpolationType<enum_Animation_InterpolationType>` **INTERPOLATION_LINEAR** = ``1``
  250. Linear interpolation.
  251. .. _class_Animation_constant_INTERPOLATION_CUBIC:
  252. .. rst-class:: classref-enumeration-constant
  253. :ref:`InterpolationType<enum_Animation_InterpolationType>` **INTERPOLATION_CUBIC** = ``2``
  254. Cubic interpolation. This looks smoother than linear interpolation, but is more expensive to interpolate. Stick to :ref:`INTERPOLATION_LINEAR<class_Animation_constant_INTERPOLATION_LINEAR>` for complex 3D animations imported from external software, even if it requires using a higher animation framerate in return.
  255. .. _class_Animation_constant_INTERPOLATION_LINEAR_ANGLE:
  256. .. rst-class:: classref-enumeration-constant
  257. :ref:`InterpolationType<enum_Animation_InterpolationType>` **INTERPOLATION_LINEAR_ANGLE** = ``3``
  258. Linear interpolation with shortest path rotation.
  259. \ **Note:** The result value is always normalized and may not match the key value.
  260. .. _class_Animation_constant_INTERPOLATION_CUBIC_ANGLE:
  261. .. rst-class:: classref-enumeration-constant
  262. :ref:`InterpolationType<enum_Animation_InterpolationType>` **INTERPOLATION_CUBIC_ANGLE** = ``4``
  263. Cubic interpolation with shortest path rotation.
  264. \ **Note:** The result value is always normalized and may not match the key value.
  265. .. rst-class:: classref-item-separator
  266. ----
  267. .. _enum_Animation_UpdateMode:
  268. .. rst-class:: classref-enumeration
  269. enum **UpdateMode**: :ref:`๐Ÿ”—<enum_Animation_UpdateMode>`
  270. .. _class_Animation_constant_UPDATE_CONTINUOUS:
  271. .. rst-class:: classref-enumeration-constant
  272. :ref:`UpdateMode<enum_Animation_UpdateMode>` **UPDATE_CONTINUOUS** = ``0``
  273. Update between keyframes and hold the value.
  274. .. _class_Animation_constant_UPDATE_DISCRETE:
  275. .. rst-class:: classref-enumeration-constant
  276. :ref:`UpdateMode<enum_Animation_UpdateMode>` **UPDATE_DISCRETE** = ``1``
  277. Update at the keyframes.
  278. .. _class_Animation_constant_UPDATE_CAPTURE:
  279. .. rst-class:: classref-enumeration-constant
  280. :ref:`UpdateMode<enum_Animation_UpdateMode>` **UPDATE_CAPTURE** = ``2``
  281. Same as :ref:`UPDATE_CONTINUOUS<class_Animation_constant_UPDATE_CONTINUOUS>` but works as a flag to capture the value of the current object and perform interpolation in some methods. See also :ref:`AnimationMixer.capture<class_AnimationMixer_method_capture>`, :ref:`AnimationPlayer.playback_auto_capture<class_AnimationPlayer_property_playback_auto_capture>`, and :ref:`AnimationPlayer.play_with_capture<class_AnimationPlayer_method_play_with_capture>`.
  282. .. rst-class:: classref-item-separator
  283. ----
  284. .. _enum_Animation_LoopMode:
  285. .. rst-class:: classref-enumeration
  286. enum **LoopMode**: :ref:`๐Ÿ”—<enum_Animation_LoopMode>`
  287. .. _class_Animation_constant_LOOP_NONE:
  288. .. rst-class:: classref-enumeration-constant
  289. :ref:`LoopMode<enum_Animation_LoopMode>` **LOOP_NONE** = ``0``
  290. At both ends of the animation, the animation will stop playing.
  291. .. _class_Animation_constant_LOOP_LINEAR:
  292. .. rst-class:: classref-enumeration-constant
  293. :ref:`LoopMode<enum_Animation_LoopMode>` **LOOP_LINEAR** = ``1``
  294. At both ends of the animation, the animation will be repeated without changing the playback direction.
  295. .. _class_Animation_constant_LOOP_PINGPONG:
  296. .. rst-class:: classref-enumeration-constant
  297. :ref:`LoopMode<enum_Animation_LoopMode>` **LOOP_PINGPONG** = ``2``
  298. Repeats playback and reverse playback at both ends of the animation.
  299. .. rst-class:: classref-item-separator
  300. ----
  301. .. _enum_Animation_LoopedFlag:
  302. .. rst-class:: classref-enumeration
  303. enum **LoopedFlag**: :ref:`๐Ÿ”—<enum_Animation_LoopedFlag>`
  304. .. _class_Animation_constant_LOOPED_FLAG_NONE:
  305. .. rst-class:: classref-enumeration-constant
  306. :ref:`LoopedFlag<enum_Animation_LoopedFlag>` **LOOPED_FLAG_NONE** = ``0``
  307. This flag indicates that the animation proceeds without any looping.
  308. .. _class_Animation_constant_LOOPED_FLAG_END:
  309. .. rst-class:: classref-enumeration-constant
  310. :ref:`LoopedFlag<enum_Animation_LoopedFlag>` **LOOPED_FLAG_END** = ``1``
  311. This flag indicates that the animation has reached the end of the animation and just after loop processed.
  312. .. _class_Animation_constant_LOOPED_FLAG_START:
  313. .. rst-class:: classref-enumeration-constant
  314. :ref:`LoopedFlag<enum_Animation_LoopedFlag>` **LOOPED_FLAG_START** = ``2``
  315. This flag indicates that the animation has reached the start of the animation and just after loop processed.
  316. .. rst-class:: classref-item-separator
  317. ----
  318. .. _enum_Animation_FindMode:
  319. .. rst-class:: classref-enumeration
  320. enum **FindMode**: :ref:`๐Ÿ”—<enum_Animation_FindMode>`
  321. .. _class_Animation_constant_FIND_MODE_NEAREST:
  322. .. rst-class:: classref-enumeration-constant
  323. :ref:`FindMode<enum_Animation_FindMode>` **FIND_MODE_NEAREST** = ``0``
  324. Finds the nearest time key.
  325. .. _class_Animation_constant_FIND_MODE_APPROX:
  326. .. rst-class:: classref-enumeration-constant
  327. :ref:`FindMode<enum_Animation_FindMode>` **FIND_MODE_APPROX** = ``1``
  328. Finds only the key with approximating the time.
  329. .. _class_Animation_constant_FIND_MODE_EXACT:
  330. .. rst-class:: classref-enumeration-constant
  331. :ref:`FindMode<enum_Animation_FindMode>` **FIND_MODE_EXACT** = ``2``
  332. Finds only the key with matching the time.
  333. .. rst-class:: classref-section-separator
  334. ----
  335. .. rst-class:: classref-descriptions-group
  336. Property Descriptions
  337. ---------------------
  338. .. _class_Animation_property_capture_included:
  339. .. rst-class:: classref-property
  340. :ref:`bool<class_bool>` **capture_included** = ``false`` :ref:`๐Ÿ”—<class_Animation_property_capture_included>`
  341. .. rst-class:: classref-property-setget
  342. - :ref:`bool<class_bool>` **is_capture_included**\ (\ )
  343. Returns ``true`` if the capture track is included. This is a cached readonly value for performance.
  344. .. rst-class:: classref-item-separator
  345. ----
  346. .. _class_Animation_property_length:
  347. .. rst-class:: classref-property
  348. :ref:`float<class_float>` **length** = ``1.0`` :ref:`๐Ÿ”—<class_Animation_property_length>`
  349. .. rst-class:: classref-property-setget
  350. - |void| **set_length**\ (\ value\: :ref:`float<class_float>`\ )
  351. - :ref:`float<class_float>` **get_length**\ (\ )
  352. The total length of the animation (in seconds).
  353. \ **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.
  354. .. rst-class:: classref-item-separator
  355. ----
  356. .. _class_Animation_property_loop_mode:
  357. .. rst-class:: classref-property
  358. :ref:`LoopMode<enum_Animation_LoopMode>` **loop_mode** = ``0`` :ref:`๐Ÿ”—<class_Animation_property_loop_mode>`
  359. .. rst-class:: classref-property-setget
  360. - |void| **set_loop_mode**\ (\ value\: :ref:`LoopMode<enum_Animation_LoopMode>`\ )
  361. - :ref:`LoopMode<enum_Animation_LoopMode>` **get_loop_mode**\ (\ )
  362. Determines the behavior of both ends of the animation timeline during animation playback. This is used for correct interpolation of animation cycles, and for hinting the player that it must restart the animation.
  363. .. rst-class:: classref-item-separator
  364. ----
  365. .. _class_Animation_property_step:
  366. .. rst-class:: classref-property
  367. :ref:`float<class_float>` **step** = ``0.0333333`` :ref:`๐Ÿ”—<class_Animation_property_step>`
  368. .. rst-class:: classref-property-setget
  369. - |void| **set_step**\ (\ value\: :ref:`float<class_float>`\ )
  370. - :ref:`float<class_float>` **get_step**\ (\ )
  371. The animation step value.
  372. .. rst-class:: classref-section-separator
  373. ----
  374. .. rst-class:: classref-descriptions-group
  375. Method Descriptions
  376. -------------------
  377. .. _class_Animation_method_add_track:
  378. .. rst-class:: classref-method
  379. :ref:`int<class_int>` **add_track**\ (\ type\: :ref:`TrackType<enum_Animation_TrackType>`, at_position\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_Animation_method_add_track>`
  380. Adds a track to the Animation.
  381. .. rst-class:: classref-item-separator
  382. ----
  383. .. _class_Animation_method_animation_track_get_key_animation:
  384. .. rst-class:: classref-method
  385. :ref:`StringName<class_StringName>` **animation_track_get_key_animation**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_animation_track_get_key_animation>`
  386. Returns the animation name at the key identified by ``key_idx``. The ``track_idx`` must be the index of an Animation Track.
  387. .. rst-class:: classref-item-separator
  388. ----
  389. .. _class_Animation_method_animation_track_insert_key:
  390. .. rst-class:: classref-method
  391. :ref:`int<class_int>` **animation_track_insert_key**\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, animation\: :ref:`StringName<class_StringName>`\ ) :ref:`๐Ÿ”—<class_Animation_method_animation_track_insert_key>`
  392. Inserts a key with value ``animation`` at the given ``time`` (in seconds). The ``track_idx`` must be the index of an Animation Track.
  393. .. rst-class:: classref-item-separator
  394. ----
  395. .. _class_Animation_method_animation_track_set_key_animation:
  396. .. rst-class:: classref-method
  397. |void| **animation_track_set_key_animation**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, animation\: :ref:`StringName<class_StringName>`\ ) :ref:`๐Ÿ”—<class_Animation_method_animation_track_set_key_animation>`
  398. Sets the key identified by ``key_idx`` to value ``animation``. The ``track_idx`` must be the index of an Animation Track.
  399. .. rst-class:: classref-item-separator
  400. ----
  401. .. _class_Animation_method_audio_track_get_key_end_offset:
  402. .. rst-class:: classref-method
  403. :ref:`float<class_float>` **audio_track_get_key_end_offset**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_audio_track_get_key_end_offset>`
  404. Returns the end offset of the key identified by ``key_idx``. The ``track_idx`` must be the index of an Audio Track.
  405. End offset is the number of seconds cut off at the ending of the audio stream.
  406. .. rst-class:: classref-item-separator
  407. ----
  408. .. _class_Animation_method_audio_track_get_key_start_offset:
  409. .. rst-class:: classref-method
  410. :ref:`float<class_float>` **audio_track_get_key_start_offset**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_audio_track_get_key_start_offset>`
  411. Returns the start offset of the key identified by ``key_idx``. The ``track_idx`` must be the index of an Audio Track.
  412. Start offset is the number of seconds cut off at the beginning of the audio stream.
  413. .. rst-class:: classref-item-separator
  414. ----
  415. .. _class_Animation_method_audio_track_get_key_stream:
  416. .. rst-class:: classref-method
  417. :ref:`Resource<class_Resource>` **audio_track_get_key_stream**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_audio_track_get_key_stream>`
  418. Returns the audio stream of the key identified by ``key_idx``. The ``track_idx`` must be the index of an Audio Track.
  419. .. rst-class:: classref-item-separator
  420. ----
  421. .. _class_Animation_method_audio_track_insert_key:
  422. .. rst-class:: classref-method
  423. :ref:`int<class_int>` **audio_track_insert_key**\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, stream\: :ref:`Resource<class_Resource>`, start_offset\: :ref:`float<class_float>` = 0, end_offset\: :ref:`float<class_float>` = 0\ ) :ref:`๐Ÿ”—<class_Animation_method_audio_track_insert_key>`
  424. Inserts an Audio Track key at the given ``time`` in seconds. The ``track_idx`` must be the index of an Audio Track.
  425. \ ``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.
  426. .. rst-class:: classref-item-separator
  427. ----
  428. .. _class_Animation_method_audio_track_is_use_blend:
  429. .. rst-class:: classref-method
  430. :ref:`bool<class_bool>` **audio_track_is_use_blend**\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_audio_track_is_use_blend>`
  431. Returns ``true`` if the track at ``track_idx`` will be blended with other animations.
  432. .. rst-class:: classref-item-separator
  433. ----
  434. .. _class_Animation_method_audio_track_set_key_end_offset:
  435. .. rst-class:: classref-method
  436. |void| **audio_track_set_key_end_offset**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, offset\: :ref:`float<class_float>`\ ) :ref:`๐Ÿ”—<class_Animation_method_audio_track_set_key_end_offset>`
  437. 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.
  438. .. rst-class:: classref-item-separator
  439. ----
  440. .. _class_Animation_method_audio_track_set_key_start_offset:
  441. .. rst-class:: classref-method
  442. |void| **audio_track_set_key_start_offset**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, offset\: :ref:`float<class_float>`\ ) :ref:`๐Ÿ”—<class_Animation_method_audio_track_set_key_start_offset>`
  443. 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.
  444. .. rst-class:: classref-item-separator
  445. ----
  446. .. _class_Animation_method_audio_track_set_key_stream:
  447. .. rst-class:: classref-method
  448. |void| **audio_track_set_key_stream**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, stream\: :ref:`Resource<class_Resource>`\ ) :ref:`๐Ÿ”—<class_Animation_method_audio_track_set_key_stream>`
  449. Sets the stream of the key identified by ``key_idx`` to value ``stream``. The ``track_idx`` must be the index of an Audio Track.
  450. .. rst-class:: classref-item-separator
  451. ----
  452. .. _class_Animation_method_audio_track_set_use_blend:
  453. .. rst-class:: classref-method
  454. |void| **audio_track_set_use_blend**\ (\ track_idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_Animation_method_audio_track_set_use_blend>`
  455. Sets whether the track will be blended with other animations. If ``true``, the audio playback volume changes depending on the blend value.
  456. .. rst-class:: classref-item-separator
  457. ----
  458. .. _class_Animation_method_bezier_track_get_key_in_handle:
  459. .. rst-class:: classref-method
  460. :ref:`Vector2<class_Vector2>` **bezier_track_get_key_in_handle**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_bezier_track_get_key_in_handle>`
  461. Returns the in handle of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
  462. .. rst-class:: classref-item-separator
  463. ----
  464. .. _class_Animation_method_bezier_track_get_key_out_handle:
  465. .. rst-class:: classref-method
  466. :ref:`Vector2<class_Vector2>` **bezier_track_get_key_out_handle**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_bezier_track_get_key_out_handle>`
  467. Returns the out handle of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
  468. .. rst-class:: classref-item-separator
  469. ----
  470. .. _class_Animation_method_bezier_track_get_key_value:
  471. .. rst-class:: classref-method
  472. :ref:`float<class_float>` **bezier_track_get_key_value**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_bezier_track_get_key_value>`
  473. Returns the value of the key identified by ``key_idx``. The ``track_idx`` must be the index of a Bezier Track.
  474. .. rst-class:: classref-item-separator
  475. ----
  476. .. _class_Animation_method_bezier_track_insert_key:
  477. .. rst-class:: classref-method
  478. :ref:`int<class_int>` **bezier_track_insert_key**\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, value\: :ref:`float<class_float>`, in_handle\: :ref:`Vector2<class_Vector2>` = Vector2(0, 0), out_handle\: :ref:`Vector2<class_Vector2>` = Vector2(0, 0)\ ) :ref:`๐Ÿ”—<class_Animation_method_bezier_track_insert_key>`
  479. Inserts a Bezier Track key at the given ``time`` in seconds. The ``track_idx`` must be the index of a Bezier Track.
  480. \ ``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.
  481. .. rst-class:: classref-item-separator
  482. ----
  483. .. _class_Animation_method_bezier_track_interpolate:
  484. .. rst-class:: classref-method
  485. :ref:`float<class_float>` **bezier_track_interpolate**\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_bezier_track_interpolate>`
  486. Returns the interpolated value at the given ``time`` (in seconds). The ``track_idx`` must be the index of a Bezier Track.
  487. .. rst-class:: classref-item-separator
  488. ----
  489. .. _class_Animation_method_bezier_track_set_key_in_handle:
  490. .. rst-class:: classref-method
  491. |void| **bezier_track_set_key_in_handle**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, in_handle\: :ref:`Vector2<class_Vector2>`, balanced_value_time_ratio\: :ref:`float<class_float>` = 1.0\ ) :ref:`๐Ÿ”—<class_Animation_method_bezier_track_set_key_in_handle>`
  492. 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.
  493. .. rst-class:: classref-item-separator
  494. ----
  495. .. _class_Animation_method_bezier_track_set_key_out_handle:
  496. .. rst-class:: classref-method
  497. |void| **bezier_track_set_key_out_handle**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, out_handle\: :ref:`Vector2<class_Vector2>`, balanced_value_time_ratio\: :ref:`float<class_float>` = 1.0\ ) :ref:`๐Ÿ”—<class_Animation_method_bezier_track_set_key_out_handle>`
  498. 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.
  499. .. rst-class:: classref-item-separator
  500. ----
  501. .. _class_Animation_method_bezier_track_set_key_value:
  502. .. rst-class:: classref-method
  503. |void| **bezier_track_set_key_value**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, value\: :ref:`float<class_float>`\ ) :ref:`๐Ÿ”—<class_Animation_method_bezier_track_set_key_value>`
  504. 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.
  505. .. rst-class:: classref-item-separator
  506. ----
  507. .. _class_Animation_method_blend_shape_track_insert_key:
  508. .. rst-class:: classref-method
  509. :ref:`int<class_int>` **blend_shape_track_insert_key**\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, amount\: :ref:`float<class_float>`\ ) :ref:`๐Ÿ”—<class_Animation_method_blend_shape_track_insert_key>`
  510. Inserts a key in a given blend shape track. Returns the key index.
  511. .. rst-class:: classref-item-separator
  512. ----
  513. .. _class_Animation_method_blend_shape_track_interpolate:
  514. .. rst-class:: classref-method
  515. :ref:`float<class_float>` **blend_shape_track_interpolate**\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_blend_shape_track_interpolate>`
  516. Returns the interpolated blend shape value at the given time (in seconds). The ``track_idx`` must be the index of a blend shape track.
  517. .. rst-class:: classref-item-separator
  518. ----
  519. .. _class_Animation_method_clear:
  520. .. rst-class:: classref-method
  521. |void| **clear**\ (\ ) :ref:`๐Ÿ”—<class_Animation_method_clear>`
  522. Clear the animation (clear all tracks and reset all).
  523. .. rst-class:: classref-item-separator
  524. ----
  525. .. _class_Animation_method_compress:
  526. .. rst-class:: classref-method
  527. |void| **compress**\ (\ page_size\: :ref:`int<class_int>` = 8192, fps\: :ref:`int<class_int>` = 120, split_tolerance\: :ref:`float<class_float>` = 4.0\ ) :ref:`๐Ÿ”—<class_Animation_method_compress>`
  528. Compress the animation and all its tracks in-place. This will make :ref:`track_is_compressed<class_Animation_method_track_is_compressed>` return ``true`` once called on this **Animation**. Compressed tracks require less memory to be played, and are designed to be used for complex 3D animations (such as cutscenes) imported from external 3D software. Compression is lossy, but the difference is usually not noticeable in real world conditions.
  529. \ **Note:** Compressed tracks have various limitations (such as not being editable from the editor), so only use compressed animations if you actually need them.
  530. .. rst-class:: classref-item-separator
  531. ----
  532. .. _class_Animation_method_copy_track:
  533. .. rst-class:: classref-method
  534. |void| **copy_track**\ (\ track_idx\: :ref:`int<class_int>`, to_animation\: :ref:`Animation<class_Animation>`\ ) :ref:`๐Ÿ”—<class_Animation_method_copy_track>`
  535. Adds a new track to ``to_animation`` that is a copy of the given track from this animation.
  536. .. rst-class:: classref-item-separator
  537. ----
  538. .. _class_Animation_method_find_track:
  539. .. rst-class:: classref-method
  540. :ref:`int<class_int>` **find_track**\ (\ path\: :ref:`NodePath<class_NodePath>`, type\: :ref:`TrackType<enum_Animation_TrackType>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_find_track>`
  541. Returns the index of the specified track. If the track is not found, return -1.
  542. .. rst-class:: classref-item-separator
  543. ----
  544. .. _class_Animation_method_get_track_count:
  545. .. rst-class:: classref-method
  546. :ref:`int<class_int>` **get_track_count**\ (\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_get_track_count>`
  547. Returns the amount of tracks in the animation.
  548. .. rst-class:: classref-item-separator
  549. ----
  550. .. _class_Animation_method_method_track_get_name:
  551. .. rst-class:: classref-method
  552. :ref:`StringName<class_StringName>` **method_track_get_name**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_method_track_get_name>`
  553. Returns the method name of a method track.
  554. .. rst-class:: classref-item-separator
  555. ----
  556. .. _class_Animation_method_method_track_get_params:
  557. .. rst-class:: classref-method
  558. :ref:`Array<class_Array>` **method_track_get_params**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_method_track_get_params>`
  559. Returns the arguments values to be called on a method track for a given key in a given track.
  560. .. rst-class:: classref-item-separator
  561. ----
  562. .. _class_Animation_method_position_track_insert_key:
  563. .. rst-class:: classref-method
  564. :ref:`int<class_int>` **position_track_insert_key**\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, position\: :ref:`Vector3<class_Vector3>`\ ) :ref:`๐Ÿ”—<class_Animation_method_position_track_insert_key>`
  565. Inserts a key in a given 3D position track. Returns the key index.
  566. .. rst-class:: classref-item-separator
  567. ----
  568. .. _class_Animation_method_position_track_interpolate:
  569. .. rst-class:: classref-method
  570. :ref:`Vector3<class_Vector3>` **position_track_interpolate**\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_position_track_interpolate>`
  571. Returns the interpolated position value at the given time (in seconds). The ``track_idx`` must be the index of a 3D position track.
  572. .. rst-class:: classref-item-separator
  573. ----
  574. .. _class_Animation_method_remove_track:
  575. .. rst-class:: classref-method
  576. |void| **remove_track**\ (\ track_idx\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_Animation_method_remove_track>`
  577. Removes a track by specifying the track index.
  578. .. rst-class:: classref-item-separator
  579. ----
  580. .. _class_Animation_method_rotation_track_insert_key:
  581. .. rst-class:: classref-method
  582. :ref:`int<class_int>` **rotation_track_insert_key**\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, rotation\: :ref:`Quaternion<class_Quaternion>`\ ) :ref:`๐Ÿ”—<class_Animation_method_rotation_track_insert_key>`
  583. Inserts a key in a given 3D rotation track. Returns the key index.
  584. .. rst-class:: classref-item-separator
  585. ----
  586. .. _class_Animation_method_rotation_track_interpolate:
  587. .. rst-class:: classref-method
  588. :ref:`Quaternion<class_Quaternion>` **rotation_track_interpolate**\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_rotation_track_interpolate>`
  589. Returns the interpolated rotation value at the given time (in seconds). The ``track_idx`` must be the index of a 3D rotation track.
  590. .. rst-class:: classref-item-separator
  591. ----
  592. .. _class_Animation_method_scale_track_insert_key:
  593. .. rst-class:: classref-method
  594. :ref:`int<class_int>` **scale_track_insert_key**\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, scale\: :ref:`Vector3<class_Vector3>`\ ) :ref:`๐Ÿ”—<class_Animation_method_scale_track_insert_key>`
  595. Inserts a key in a given 3D scale track. Returns the key index.
  596. .. rst-class:: classref-item-separator
  597. ----
  598. .. _class_Animation_method_scale_track_interpolate:
  599. .. rst-class:: classref-method
  600. :ref:`Vector3<class_Vector3>` **scale_track_interpolate**\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_scale_track_interpolate>`
  601. Returns the interpolated scale value at the given time (in seconds). The ``track_idx`` must be the index of a 3D scale track.
  602. .. rst-class:: classref-item-separator
  603. ----
  604. .. _class_Animation_method_track_find_key:
  605. .. rst-class:: classref-method
  606. :ref:`int<class_int>` **track_find_key**\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, find_mode\: :ref:`FindMode<enum_Animation_FindMode>` = 0, limit\: :ref:`bool<class_bool>` = false, backward\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_find_key>`
  607. Finds the key index by time in a given track. Optionally, only find it if the approx/exact time is given.
  608. If ``limit`` is ``true``, it does not return keys outside the animation range.
  609. If ``backward`` is ``true``, the direction is reversed in methods that rely on one directional processing.
  610. For example, in case ``find_mode`` is :ref:`FIND_MODE_NEAREST<class_Animation_constant_FIND_MODE_NEAREST>`, if there is no key in the current position just after seeked, the first key found is retrieved by searching before the position, but if ``backward`` is ``true``, the first key found is retrieved after the position.
  611. .. rst-class:: classref-item-separator
  612. ----
  613. .. _class_Animation_method_track_get_interpolation_loop_wrap:
  614. .. rst-class:: classref-method
  615. :ref:`bool<class_bool>` **track_get_interpolation_loop_wrap**\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_get_interpolation_loop_wrap>`
  616. Returns ``true`` if the track at ``track_idx`` wraps the interpolation loop. New tracks wrap the interpolation loop by default.
  617. .. rst-class:: classref-item-separator
  618. ----
  619. .. _class_Animation_method_track_get_interpolation_type:
  620. .. rst-class:: classref-method
  621. :ref:`InterpolationType<enum_Animation_InterpolationType>` **track_get_interpolation_type**\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_get_interpolation_type>`
  622. Returns the interpolation type of a given track.
  623. .. rst-class:: classref-item-separator
  624. ----
  625. .. _class_Animation_method_track_get_key_count:
  626. .. rst-class:: classref-method
  627. :ref:`int<class_int>` **track_get_key_count**\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_get_key_count>`
  628. Returns the number of keys in a given track.
  629. .. rst-class:: classref-item-separator
  630. ----
  631. .. _class_Animation_method_track_get_key_time:
  632. .. rst-class:: classref-method
  633. :ref:`float<class_float>` **track_get_key_time**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_get_key_time>`
  634. Returns the time at which the key is located.
  635. .. rst-class:: classref-item-separator
  636. ----
  637. .. _class_Animation_method_track_get_key_transition:
  638. .. rst-class:: classref-method
  639. :ref:`float<class_float>` **track_get_key_transition**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_get_key_transition>`
  640. Returns the transition curve (easing) for a specific key (see the built-in math function :ref:`@GlobalScope.ease<class_@GlobalScope_method_ease>`).
  641. .. rst-class:: classref-item-separator
  642. ----
  643. .. _class_Animation_method_track_get_key_value:
  644. .. rst-class:: classref-method
  645. :ref:`Variant<class_Variant>` **track_get_key_value**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_get_key_value>`
  646. Returns the value of a given key in a given track.
  647. .. rst-class:: classref-item-separator
  648. ----
  649. .. _class_Animation_method_track_get_path:
  650. .. rst-class:: classref-method
  651. :ref:`NodePath<class_NodePath>` **track_get_path**\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_get_path>`
  652. Gets the path of a track. For more information on the path format, see :ref:`track_set_path<class_Animation_method_track_set_path>`.
  653. .. rst-class:: classref-item-separator
  654. ----
  655. .. _class_Animation_method_track_get_type:
  656. .. rst-class:: classref-method
  657. :ref:`TrackType<enum_Animation_TrackType>` **track_get_type**\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_get_type>`
  658. Gets the type of a track.
  659. .. rst-class:: classref-item-separator
  660. ----
  661. .. _class_Animation_method_track_insert_key:
  662. .. rst-class:: classref-method
  663. :ref:`int<class_int>` **track_insert_key**\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`, key\: :ref:`Variant<class_Variant>`, transition\: :ref:`float<class_float>` = 1\ ) :ref:`๐Ÿ”—<class_Animation_method_track_insert_key>`
  664. Inserts a generic key in a given track. Returns the key index.
  665. .. rst-class:: classref-item-separator
  666. ----
  667. .. _class_Animation_method_track_is_compressed:
  668. .. rst-class:: classref-method
  669. :ref:`bool<class_bool>` **track_is_compressed**\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_is_compressed>`
  670. Returns ``true`` if the track is compressed, ``false`` otherwise. See also :ref:`compress<class_Animation_method_compress>`.
  671. .. rst-class:: classref-item-separator
  672. ----
  673. .. _class_Animation_method_track_is_enabled:
  674. .. rst-class:: classref-method
  675. :ref:`bool<class_bool>` **track_is_enabled**\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_is_enabled>`
  676. Returns ``true`` if the track at index ``track_idx`` is enabled.
  677. .. rst-class:: classref-item-separator
  678. ----
  679. .. _class_Animation_method_track_is_imported:
  680. .. rst-class:: classref-method
  681. :ref:`bool<class_bool>` **track_is_imported**\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_track_is_imported>`
  682. Returns ``true`` if the given track is imported. Else, return ``false``.
  683. .. rst-class:: classref-item-separator
  684. ----
  685. .. _class_Animation_method_track_move_down:
  686. .. rst-class:: classref-method
  687. |void| **track_move_down**\ (\ track_idx\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_move_down>`
  688. Moves a track down.
  689. .. rst-class:: classref-item-separator
  690. ----
  691. .. _class_Animation_method_track_move_to:
  692. .. rst-class:: classref-method
  693. |void| **track_move_to**\ (\ track_idx\: :ref:`int<class_int>`, to_idx\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_move_to>`
  694. Changes the index position of track ``track_idx`` to the one defined in ``to_idx``.
  695. .. rst-class:: classref-item-separator
  696. ----
  697. .. _class_Animation_method_track_move_up:
  698. .. rst-class:: classref-method
  699. |void| **track_move_up**\ (\ track_idx\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_move_up>`
  700. Moves a track up.
  701. .. rst-class:: classref-item-separator
  702. ----
  703. .. _class_Animation_method_track_remove_key:
  704. .. rst-class:: classref-method
  705. |void| **track_remove_key**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_remove_key>`
  706. Removes a key by index in a given track.
  707. .. rst-class:: classref-item-separator
  708. ----
  709. .. _class_Animation_method_track_remove_key_at_time:
  710. .. rst-class:: classref-method
  711. |void| **track_remove_key_at_time**\ (\ track_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_remove_key_at_time>`
  712. Removes a key at ``time`` in a given track.
  713. .. rst-class:: classref-item-separator
  714. ----
  715. .. _class_Animation_method_track_set_enabled:
  716. .. rst-class:: classref-method
  717. |void| **track_set_enabled**\ (\ track_idx\: :ref:`int<class_int>`, enabled\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_set_enabled>`
  718. Enables/disables the given track. Tracks are enabled by default.
  719. .. rst-class:: classref-item-separator
  720. ----
  721. .. _class_Animation_method_track_set_imported:
  722. .. rst-class:: classref-method
  723. |void| **track_set_imported**\ (\ track_idx\: :ref:`int<class_int>`, imported\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_set_imported>`
  724. Sets the given track as imported or not.
  725. .. rst-class:: classref-item-separator
  726. ----
  727. .. _class_Animation_method_track_set_interpolation_loop_wrap:
  728. .. rst-class:: classref-method
  729. |void| **track_set_interpolation_loop_wrap**\ (\ track_idx\: :ref:`int<class_int>`, interpolation\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_set_interpolation_loop_wrap>`
  730. If ``true``, the track at ``track_idx`` wraps the interpolation loop.
  731. .. rst-class:: classref-item-separator
  732. ----
  733. .. _class_Animation_method_track_set_interpolation_type:
  734. .. rst-class:: classref-method
  735. |void| **track_set_interpolation_type**\ (\ track_idx\: :ref:`int<class_int>`, interpolation\: :ref:`InterpolationType<enum_Animation_InterpolationType>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_set_interpolation_type>`
  736. Sets the interpolation type of a given track.
  737. .. rst-class:: classref-item-separator
  738. ----
  739. .. _class_Animation_method_track_set_key_time:
  740. .. rst-class:: classref-method
  741. |void| **track_set_key_time**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, time\: :ref:`float<class_float>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_set_key_time>`
  742. Sets the time of an existing key.
  743. .. rst-class:: classref-item-separator
  744. ----
  745. .. _class_Animation_method_track_set_key_transition:
  746. .. rst-class:: classref-method
  747. |void| **track_set_key_transition**\ (\ track_idx\: :ref:`int<class_int>`, key_idx\: :ref:`int<class_int>`, transition\: :ref:`float<class_float>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_set_key_transition>`
  748. Sets the transition curve (easing) for a specific key (see the built-in math function :ref:`@GlobalScope.ease<class_@GlobalScope_method_ease>`).
  749. .. rst-class:: classref-item-separator
  750. ----
  751. .. _class_Animation_method_track_set_key_value:
  752. .. rst-class:: classref-method
  753. |void| **track_set_key_value**\ (\ track_idx\: :ref:`int<class_int>`, key\: :ref:`int<class_int>`, value\: :ref:`Variant<class_Variant>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_set_key_value>`
  754. Sets the value of an existing key.
  755. .. rst-class:: classref-item-separator
  756. ----
  757. .. _class_Animation_method_track_set_path:
  758. .. rst-class:: classref-method
  759. |void| **track_set_path**\ (\ track_idx\: :ref:`int<class_int>`, path\: :ref:`NodePath<class_NodePath>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_set_path>`
  760. Sets the path of a track. Paths must be valid scene-tree paths to a node and must be specified starting from the :ref:`AnimationMixer.root_node<class_AnimationMixer_property_root_node>` that will reproduce the animation. Tracks that control properties or bones must append their name after the path, separated by ``":"``.
  761. For example, ``"character/skeleton:ankle"`` or ``"character/mesh:transform/local"``.
  762. .. rst-class:: classref-item-separator
  763. ----
  764. .. _class_Animation_method_track_swap:
  765. .. rst-class:: classref-method
  766. |void| **track_swap**\ (\ track_idx\: :ref:`int<class_int>`, with_idx\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_Animation_method_track_swap>`
  767. Swaps the track ``track_idx``'s index position with the track ``with_idx``.
  768. .. rst-class:: classref-item-separator
  769. ----
  770. .. _class_Animation_method_value_track_get_update_mode:
  771. .. rst-class:: classref-method
  772. :ref:`UpdateMode<enum_Animation_UpdateMode>` **value_track_get_update_mode**\ (\ track_idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_value_track_get_update_mode>`
  773. Returns the update mode of a value track.
  774. .. rst-class:: classref-item-separator
  775. ----
  776. .. _class_Animation_method_value_track_interpolate:
  777. .. rst-class:: classref-method
  778. :ref:`Variant<class_Variant>` **value_track_interpolate**\ (\ track_idx\: :ref:`int<class_int>`, time_sec\: :ref:`float<class_float>`, backward\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`๐Ÿ”—<class_Animation_method_value_track_interpolate>`
  779. Returns the interpolated value at the given time (in seconds). The ``track_idx`` must be the index of a value track.
  780. A ``backward`` mainly affects the direction of key retrieval of the track with :ref:`UPDATE_DISCRETE<class_Animation_constant_UPDATE_DISCRETE>` converted by :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_DISCRETE_FORCE_CONTINUOUS<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_DISCRETE_FORCE_CONTINUOUS>` to match the result with :ref:`track_find_key<class_Animation_method_track_find_key>`.
  781. .. rst-class:: classref-item-separator
  782. ----
  783. .. _class_Animation_method_value_track_set_update_mode:
  784. .. rst-class:: classref-method
  785. |void| **value_track_set_update_mode**\ (\ track_idx\: :ref:`int<class_int>`, mode\: :ref:`UpdateMode<enum_Animation_UpdateMode>`\ ) :ref:`๐Ÿ”—<class_Animation_method_value_track_set_update_mode>`
  786. Sets the update mode (see :ref:`UpdateMode<enum_Animation_UpdateMode>`) of a value track.
  787. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  788. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  789. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  790. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  791. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  792. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  793. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  794. .. |void| replace:: :abbr:`void (No return value.)`