class_animatedsprite.rst 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the AnimatedSprite.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_AnimatedSprite:
  6. AnimatedSprite
  7. ==============
  8. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Sprite node that can use multiple textures for animation.
  13. Properties
  14. ----------
  15. +-----------------------------------------+---------------------------------------------------------------+
  16. | :ref:`String<class_String>` | :ref:`animation<class_AnimatedSprite_property_animation>` |
  17. +-----------------------------------------+---------------------------------------------------------------+
  18. | :ref:`bool<class_bool>` | :ref:`centered<class_AnimatedSprite_property_centered>` |
  19. +-----------------------------------------+---------------------------------------------------------------+
  20. | :ref:`bool<class_bool>` | :ref:`flip_h<class_AnimatedSprite_property_flip_h>` |
  21. +-----------------------------------------+---------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`flip_v<class_AnimatedSprite_property_flip_v>` |
  23. +-----------------------------------------+---------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`frame<class_AnimatedSprite_property_frame>` |
  25. +-----------------------------------------+---------------------------------------------------------------+
  26. | :ref:`SpriteFrames<class_SpriteFrames>` | :ref:`frames<class_AnimatedSprite_property_frames>` |
  27. +-----------------------------------------+---------------------------------------------------------------+
  28. | :ref:`Vector2<class_Vector2>` | :ref:`offset<class_AnimatedSprite_property_offset>` |
  29. +-----------------------------------------+---------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`playing<class_AnimatedSprite_property_playing>` |
  31. +-----------------------------------------+---------------------------------------------------------------+
  32. | :ref:`float<class_float>` | :ref:`speed_scale<class_AnimatedSprite_property_speed_scale>` |
  33. +-----------------------------------------+---------------------------------------------------------------+
  34. Methods
  35. -------
  36. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimatedSprite_method_is_playing>` **(** **)** const |
  38. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`play<class_AnimatedSprite_method_play>` **(** :ref:`String<class_String>` anim="", :ref:`bool<class_bool>` backwards=false **)** |
  40. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`stop<class_AnimatedSprite_method_stop>` **(** **)** |
  42. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
  43. Signals
  44. -------
  45. .. _class_AnimatedSprite_signal_animation_finished:
  46. - **animation_finished** **(** **)**
  47. Emitted when the animation is finished (when it plays the last frame). If the animation is looping, this signal is emitted every time the last frame is drawn.
  48. ----
  49. .. _class_AnimatedSprite_signal_frame_changed:
  50. - **frame_changed** **(** **)**
  51. Emitted when :ref:`frame<class_AnimatedSprite_property_frame>` changed.
  52. Description
  53. -----------
  54. Animations are created using a :ref:`SpriteFrames<class_SpriteFrames>` resource, which can be configured in the editor via the SpriteFrames panel.
  55. Property Descriptions
  56. ---------------------
  57. .. _class_AnimatedSprite_property_animation:
  58. - :ref:`String<class_String>` **animation**
  59. +----------+----------------------+
  60. | *Setter* | set_animation(value) |
  61. +----------+----------------------+
  62. | *Getter* | get_animation() |
  63. +----------+----------------------+
  64. The current animation from the ``frames`` resource. If this value changes, the ``frame`` counter is reset.
  65. ----
  66. .. _class_AnimatedSprite_property_centered:
  67. - :ref:`bool<class_bool>` **centered**
  68. +----------+---------------------+
  69. | *Setter* | set_centered(value) |
  70. +----------+---------------------+
  71. | *Getter* | is_centered() |
  72. +----------+---------------------+
  73. If ``true``, texture will be centered. Default value: ``true``.
  74. ----
  75. .. _class_AnimatedSprite_property_flip_h:
  76. - :ref:`bool<class_bool>` **flip_h**
  77. +----------+-------------------+
  78. | *Setter* | set_flip_h(value) |
  79. +----------+-------------------+
  80. | *Getter* | is_flipped_h() |
  81. +----------+-------------------+
  82. If ``true``, texture is flipped horizontally. Default value: ``false``.
  83. ----
  84. .. _class_AnimatedSprite_property_flip_v:
  85. - :ref:`bool<class_bool>` **flip_v**
  86. +----------+-------------------+
  87. | *Setter* | set_flip_v(value) |
  88. +----------+-------------------+
  89. | *Getter* | is_flipped_v() |
  90. +----------+-------------------+
  91. If ``true``, texture is flipped vertically. Default value: ``false``.
  92. ----
  93. .. _class_AnimatedSprite_property_frame:
  94. - :ref:`int<class_int>` **frame**
  95. +----------+------------------+
  96. | *Setter* | set_frame(value) |
  97. +----------+------------------+
  98. | *Getter* | get_frame() |
  99. +----------+------------------+
  100. The displayed animation frame's index.
  101. ----
  102. .. _class_AnimatedSprite_property_frames:
  103. - :ref:`SpriteFrames<class_SpriteFrames>` **frames**
  104. +----------+--------------------------+
  105. | *Setter* | set_sprite_frames(value) |
  106. +----------+--------------------------+
  107. | *Getter* | get_sprite_frames() |
  108. +----------+--------------------------+
  109. The :ref:`SpriteFrames<class_SpriteFrames>` resource containing the animation(s).
  110. ----
  111. .. _class_AnimatedSprite_property_offset:
  112. - :ref:`Vector2<class_Vector2>` **offset**
  113. +----------+-------------------+
  114. | *Setter* | set_offset(value) |
  115. +----------+-------------------+
  116. | *Getter* | get_offset() |
  117. +----------+-------------------+
  118. The texture's drawing offset.
  119. ----
  120. .. _class_AnimatedSprite_property_playing:
  121. - :ref:`bool<class_bool>` **playing**
  122. If ``true``, the :ref:`animation<class_AnimatedSprite_property_animation>` is currently playing.
  123. ----
  124. .. _class_AnimatedSprite_property_speed_scale:
  125. - :ref:`float<class_float>` **speed_scale**
  126. +----------+------------------------+
  127. | *Setter* | set_speed_scale(value) |
  128. +----------+------------------------+
  129. | *Getter* | get_speed_scale() |
  130. +----------+------------------------+
  131. The animation speed is multiplied by this value.
  132. Method Descriptions
  133. -------------------
  134. .. _class_AnimatedSprite_method_is_playing:
  135. - :ref:`bool<class_bool>` **is_playing** **(** **)** const
  136. Returns ``true`` if an animation if currently being played.
  137. ----
  138. .. _class_AnimatedSprite_method_play:
  139. - void **play** **(** :ref:`String<class_String>` anim="", :ref:`bool<class_bool>` backwards=false **)**
  140. Play the animation set in parameter. If no parameter is provided, the current animation is played. Property ``backwards`` plays the animation in reverse if set to ``true``.
  141. ----
  142. .. _class_AnimatedSprite_method_stop:
  143. - void **stop** **(** **)**
  144. Stop the current animation (does not reset the frame counter).