AnimationPlayer.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="AnimationPlayer" inherits="Node" category="Core" version="3.1">
  3. <brief_description>
  4. Container and player of [Animation] resources.
  5. </brief_description>
  6. <description>
  7. An animation player is used for general purpose playback of [Animation] resources. It contains a dictionary of animations (referenced by name) and custom blend times between their transitions. Additionally, animations can be played and blended in different channels.
  8. </description>
  9. <tutorials>
  10. <link>https://docs.godotengine.org/en/latest/getting_started/step_by_step/animations.html</link>
  11. <link>https://docs.godotengine.org/en/latest/tutorials/animation/index.html</link>
  12. </tutorials>
  13. <demos>
  14. </demos>
  15. <methods>
  16. <method name="add_animation">
  17. <return type="int" enum="Error">
  18. </return>
  19. <argument index="0" name="name" type="String">
  20. </argument>
  21. <argument index="1" name="animation" type="Animation">
  22. </argument>
  23. <description>
  24. Adds [code]animation[/code] to the player accessible with the key [code]name[/code].
  25. </description>
  26. </method>
  27. <method name="advance">
  28. <return type="void">
  29. </return>
  30. <argument index="0" name="delta" type="float">
  31. </argument>
  32. <description>
  33. Shifts position in the animation timeline. Delta is the time in seconds to shift.
  34. </description>
  35. </method>
  36. <method name="animation_get_next" qualifiers="const">
  37. <return type="String">
  38. </return>
  39. <argument index="0" name="anim_from" type="String">
  40. </argument>
  41. <description>
  42. Returns the name of the next animation in the queue.
  43. </description>
  44. </method>
  45. <method name="animation_set_next">
  46. <return type="void">
  47. </return>
  48. <argument index="0" name="anim_from" type="String">
  49. </argument>
  50. <argument index="1" name="anim_to" type="String">
  51. </argument>
  52. <description>
  53. Triggers the [code]anim_to[/code] animation when the [code]anim_from[/code] animation completes.
  54. </description>
  55. </method>
  56. <method name="clear_caches">
  57. <return type="void">
  58. </return>
  59. <description>
  60. [code]AnimationPlayer[/code] caches animated nodes. It may not notice if a node disappears, so clear_caches forces it to update the cache again.
  61. </description>
  62. </method>
  63. <method name="clear_queue">
  64. <return type="void">
  65. </return>
  66. <description>
  67. Clears all queued, unplayed animations.
  68. </description>
  69. </method>
  70. <method name="find_animation" qualifiers="const">
  71. <return type="String">
  72. </return>
  73. <argument index="0" name="animation" type="Animation">
  74. </argument>
  75. <description>
  76. Returns the name of [code]animation[/code] or empty string if not found.
  77. </description>
  78. </method>
  79. <method name="get_animation" qualifiers="const">
  80. <return type="Animation">
  81. </return>
  82. <argument index="0" name="name" type="String">
  83. </argument>
  84. <description>
  85. Returns the [Animation] with key [code]name[/code] or [code]null[/code] if not found.
  86. </description>
  87. </method>
  88. <method name="get_animation_list" qualifiers="const">
  89. <return type="PoolStringArray">
  90. </return>
  91. <description>
  92. Returns the list of stored animation names.
  93. </description>
  94. </method>
  95. <method name="get_blend_time" qualifiers="const">
  96. <return type="float">
  97. </return>
  98. <argument index="0" name="anim_from" type="String">
  99. </argument>
  100. <argument index="1" name="anim_to" type="String">
  101. </argument>
  102. <description>
  103. Get the blend time (in seconds) between two animations, referenced by their names.
  104. </description>
  105. </method>
  106. <method name="get_playing_speed" qualifiers="const">
  107. <return type="float">
  108. </return>
  109. <description>
  110. Get the actual playing speed of current animation or 0 if not playing. This speed is the [code]playback_speed[/code] property multiplied by [code]custom_speed[/code] argument specified when calling the [code]play[/code] method.
  111. </description>
  112. </method>
  113. <method name="get_queue">
  114. <return type="PoolStringArray">
  115. </return>
  116. <description>
  117. </description>
  118. </method>
  119. <method name="has_animation" qualifiers="const">
  120. <return type="bool">
  121. </return>
  122. <argument index="0" name="name" type="String">
  123. </argument>
  124. <description>
  125. Returns [code]true[/code] if the [code]AnimationPlayer[/code] stores an [Animation] with key [code]name[/code].
  126. </description>
  127. </method>
  128. <method name="is_playing" qualifiers="const">
  129. <return type="bool">
  130. </return>
  131. <description>
  132. Returns [code]true[/code] if playing an animation.
  133. </description>
  134. </method>
  135. <method name="play">
  136. <return type="void">
  137. </return>
  138. <argument index="0" name="name" type="String" default="&quot;&quot;">
  139. </argument>
  140. <argument index="1" name="custom_blend" type="float" default="-1">
  141. </argument>
  142. <argument index="2" name="custom_speed" type="float" default="1.0">
  143. </argument>
  144. <argument index="3" name="from_end" type="bool" default="false">
  145. </argument>
  146. <description>
  147. Play the animation with key [code]name[/code]. Custom speed and blend times can be set. If custom speed is negative (-1), 'from_end' being true can play the animation backwards.
  148. </description>
  149. </method>
  150. <method name="play_backwards">
  151. <return type="void">
  152. </return>
  153. <argument index="0" name="name" type="String" default="&quot;&quot;">
  154. </argument>
  155. <argument index="1" name="custom_blend" type="float" default="-1">
  156. </argument>
  157. <description>
  158. Play the animation with key [code]name[/code] in reverse.
  159. </description>
  160. </method>
  161. <method name="queue">
  162. <return type="void">
  163. </return>
  164. <argument index="0" name="name" type="String">
  165. </argument>
  166. <description>
  167. Queue an animation for playback once the current one is done.
  168. </description>
  169. </method>
  170. <method name="remove_animation">
  171. <return type="void">
  172. </return>
  173. <argument index="0" name="name" type="String">
  174. </argument>
  175. <description>
  176. Remove the animation with key [code]name[/code].
  177. </description>
  178. </method>
  179. <method name="rename_animation">
  180. <return type="void">
  181. </return>
  182. <argument index="0" name="name" type="String">
  183. </argument>
  184. <argument index="1" name="newname" type="String">
  185. </argument>
  186. <description>
  187. Rename an existing animation with key [code]name[/code] to [code]newname[/code].
  188. </description>
  189. </method>
  190. <method name="seek">
  191. <return type="void">
  192. </return>
  193. <argument index="0" name="seconds" type="float">
  194. </argument>
  195. <argument index="1" name="update" type="bool" default="false">
  196. </argument>
  197. <description>
  198. Seek the animation to the [code]seconds[/code] point in time (in seconds). If [code]update[/code] is [code]true[/code], the animation updates too, otherwise it updates at process time.
  199. </description>
  200. </method>
  201. <method name="set_blend_time">
  202. <return type="void">
  203. </return>
  204. <argument index="0" name="anim_from" type="String">
  205. </argument>
  206. <argument index="1" name="anim_to" type="String">
  207. </argument>
  208. <argument index="2" name="sec" type="float">
  209. </argument>
  210. <description>
  211. Specify a blend time (in seconds) between two animations, referenced by their names.
  212. </description>
  213. </method>
  214. <method name="stop">
  215. <return type="void">
  216. </return>
  217. <argument index="0" name="reset" type="bool" default="true">
  218. </argument>
  219. <description>
  220. Stop the currently playing animation. If [code]reset[/code] is [code]true[/code], the anim position is reset to [code]0[/code].
  221. </description>
  222. </method>
  223. </methods>
  224. <members>
  225. <member name="assigned_animation" type="String" setter="set_assigned_animation" getter="get_assigned_animation">
  226. If playing, the current animation; otherwise, the animation last played. When set, would change the animation, but would not play it unless currently playing. See also [member current_animation].
  227. </member>
  228. <member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay">
  229. The name of the animation to play when the scene loads. Default value: [code]""[/code].
  230. </member>
  231. <member name="current_animation" type="String" setter="set_current_animation" getter="get_current_animation">
  232. The name of the current animation, "" if not playing anything. When being set, does not restart the animation. See also [method play]. Default value: [code]""[/code].
  233. </member>
  234. <member name="current_animation_length" type="float" setter="" getter="get_current_animation_length">
  235. The length (in seconds) of the currently being played animation.
  236. </member>
  237. <member name="current_animation_position" type="float" setter="" getter="get_current_animation_position">
  238. The position (in seconds) of the currently playing animation.
  239. </member>
  240. <member name="playback_active" type="bool" setter="set_active" getter="is_active">
  241. If [code]true[/code], updates animations in response to process-related notifications. Default value: [code]true[/code].
  242. </member>
  243. <member name="playback_default_blend_time" type="float" setter="set_default_blend_time" getter="get_default_blend_time">
  244. The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 precision. Default value: [code]0[/code].
  245. </member>
  246. <member name="playback_process_mode" type="int" setter="set_animation_process_mode" getter="get_animation_process_mode" enum="AnimationPlayer.AnimationProcessMode">
  247. The process notification in which to update animations. Default value: [code]ANIMATION_PROCESS_IDLE[/code].
  248. </member>
  249. <member name="playback_speed" type="float" setter="set_speed_scale" getter="get_speed_scale">
  250. The speed scaling ratio. For instance, if this value is 1 then the animation plays at normal speed. If it's 0.5 then it plays at half speed. If it's 2 then it plays at double speed. Default value: [code]1[/code].
  251. </member>
  252. <member name="root_node" type="NodePath" setter="set_root" getter="get_root">
  253. The node from which node path references will travel. Default value: [code]".."[/code].
  254. </member>
  255. </members>
  256. <signals>
  257. <signal name="animation_changed">
  258. <argument index="0" name="old_name" type="String">
  259. </argument>
  260. <argument index="1" name="new_name" type="String">
  261. </argument>
  262. <description>
  263. If the currently being played animation changes, this signal will notify of such change.
  264. </description>
  265. </signal>
  266. <signal name="animation_finished">
  267. <argument index="0" name="anim_name" type="String">
  268. </argument>
  269. <description>
  270. Notifies when an animation finished playing.
  271. </description>
  272. </signal>
  273. <signal name="animation_started">
  274. <argument index="0" name="anim_name" type="String">
  275. </argument>
  276. <description>
  277. Notifies when an animation starts playing.
  278. </description>
  279. </signal>
  280. <signal name="caches_cleared">
  281. <description>
  282. </description>
  283. </signal>
  284. </signals>
  285. <constants>
  286. <constant name="ANIMATION_PROCESS_PHYSICS" value="0" enum="AnimationProcessMode">
  287. Process animation during the physics process. This is especially useful when animating physics bodies.
  288. </constant>
  289. <constant name="ANIMATION_PROCESS_IDLE" value="1" enum="AnimationProcessMode">
  290. Process animation during the idle process.
  291. </constant>
  292. <constant name="ANIMATION_PROCESS_MANUAL" value="2" enum="AnimationProcessMode">
  293. Do not process animation. Use the 'advance' method to process the animation manually.
  294. </constant>
  295. </constants>
  296. </class>