class_animatedsprite.rst 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the AnimatedSprite.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_AnimatedSprite:
  5. AnimatedSprite
  6. ==============
  7. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Sprite node that can use multiple textures for animation.
  12. Properties
  13. ----------
  14. +-----------------------------------------+------------------------------------------------------+
  15. | :ref:`String<class_String>` | :ref:`animation<class_AnimatedSprite_animation>` |
  16. +-----------------------------------------+------------------------------------------------------+
  17. | :ref:`bool<class_bool>` | :ref:`centered<class_AnimatedSprite_centered>` |
  18. +-----------------------------------------+------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`flip_h<class_AnimatedSprite_flip_h>` |
  20. +-----------------------------------------+------------------------------------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`flip_v<class_AnimatedSprite_flip_v>` |
  22. +-----------------------------------------+------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`frame<class_AnimatedSprite_frame>` |
  24. +-----------------------------------------+------------------------------------------------------+
  25. | :ref:`SpriteFrames<class_SpriteFrames>` | :ref:`frames<class_AnimatedSprite_frames>` |
  26. +-----------------------------------------+------------------------------------------------------+
  27. | :ref:`Vector2<class_Vector2>` | :ref:`offset<class_AnimatedSprite_offset>` |
  28. +-----------------------------------------+------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`playing<class_AnimatedSprite_playing>` |
  30. +-----------------------------------------+------------------------------------------------------+
  31. | :ref:`float<class_float>` | :ref:`speed_scale<class_AnimatedSprite_speed_scale>` |
  32. +-----------------------------------------+------------------------------------------------------+
  33. Methods
  34. -------
  35. +--------------------------+----------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimatedSprite_is_playing>` **(** **)** const |
  37. +--------------------------+----------------------------------------------------------------------------------------+
  38. | void | :ref:`play<class_AnimatedSprite_play>` **(** :ref:`String<class_String>` anim="" **)** |
  39. +--------------------------+----------------------------------------------------------------------------------------+
  40. | void | :ref:`stop<class_AnimatedSprite_stop>` **(** **)** |
  41. +--------------------------+----------------------------------------------------------------------------------------+
  42. Signals
  43. -------
  44. .. _class_AnimatedSprite_animation_finished:
  45. - **animation_finished** **(** **)**
  46. 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.
  47. .. _class_AnimatedSprite_frame_changed:
  48. - **frame_changed** **(** **)**
  49. Emitted when :ref:`frame<class_AnimatedSprite_frame>` changed.
  50. Description
  51. -----------
  52. Animations are created using a :ref:`SpriteFrames<class_SpriteFrames>` resource, which can be configured in the editor via the SpriteFrames panel.
  53. Property Descriptions
  54. ---------------------
  55. .. _class_AnimatedSprite_animation:
  56. - :ref:`String<class_String>` **animation**
  57. +----------+----------------------+
  58. | *Setter* | set_animation(value) |
  59. +----------+----------------------+
  60. | *Getter* | get_animation() |
  61. +----------+----------------------+
  62. The current animation from the ``frames`` resource. If this value changes, the ``frame`` counter is reset.
  63. .. _class_AnimatedSprite_centered:
  64. - :ref:`bool<class_bool>` **centered**
  65. +----------+---------------------+
  66. | *Setter* | set_centered(value) |
  67. +----------+---------------------+
  68. | *Getter* | is_centered() |
  69. +----------+---------------------+
  70. If ``true`` texture will be centered. Default value: ``true``.
  71. .. _class_AnimatedSprite_flip_h:
  72. - :ref:`bool<class_bool>` **flip_h**
  73. +----------+-------------------+
  74. | *Setter* | set_flip_h(value) |
  75. +----------+-------------------+
  76. | *Getter* | is_flipped_h() |
  77. +----------+-------------------+
  78. If ``true`` texture is flipped horizontally. Default value: ``false``.
  79. .. _class_AnimatedSprite_flip_v:
  80. - :ref:`bool<class_bool>` **flip_v**
  81. +----------+-------------------+
  82. | *Setter* | set_flip_v(value) |
  83. +----------+-------------------+
  84. | *Getter* | is_flipped_v() |
  85. +----------+-------------------+
  86. If ``true`` texture is flipped vertically. Default value: ``false``.
  87. .. _class_AnimatedSprite_frame:
  88. - :ref:`int<class_int>` **frame**
  89. +----------+------------------+
  90. | *Setter* | set_frame(value) |
  91. +----------+------------------+
  92. | *Getter* | get_frame() |
  93. +----------+------------------+
  94. The displayed animation frame's index.
  95. .. _class_AnimatedSprite_frames:
  96. - :ref:`SpriteFrames<class_SpriteFrames>` **frames**
  97. +----------+--------------------------+
  98. | *Setter* | set_sprite_frames(value) |
  99. +----------+--------------------------+
  100. | *Getter* | get_sprite_frames() |
  101. +----------+--------------------------+
  102. The :ref:`SpriteFrames<class_SpriteFrames>` resource containing the animation(s).
  103. .. _class_AnimatedSprite_offset:
  104. - :ref:`Vector2<class_Vector2>` **offset**
  105. +----------+-------------------+
  106. | *Setter* | set_offset(value) |
  107. +----------+-------------------+
  108. | *Getter* | get_offset() |
  109. +----------+-------------------+
  110. The texture's drawing offset.
  111. .. _class_AnimatedSprite_playing:
  112. - :ref:`bool<class_bool>` **playing**
  113. If ``true`` the :ref:`animation<class_AnimatedSprite_animation>` is currently playing.
  114. .. _class_AnimatedSprite_speed_scale:
  115. - :ref:`float<class_float>` **speed_scale**
  116. +----------+------------------------+
  117. | *Setter* | set_speed_scale(value) |
  118. +----------+------------------------+
  119. | *Getter* | get_speed_scale() |
  120. +----------+------------------------+
  121. Method Descriptions
  122. -------------------
  123. .. _class_AnimatedSprite_is_playing:
  124. - :ref:`bool<class_bool>` **is_playing** **(** **)** const
  125. Return true if an animation if currently being played.
  126. .. _class_AnimatedSprite_play:
  127. - void **play** **(** :ref:`String<class_String>` anim="" **)**
  128. Play the animation set in parameter. If no parameter is provided, the current animation is played.
  129. .. _class_AnimatedSprite_stop:
  130. - void **stop** **(** **)**
  131. Stop the current animation (does not reset the frame counter).