class_animatedsprite.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_AnimatedSprite:
  4. AnimatedSprite
  5. ==============
  6. **Inherits:** :ref:`Node2D<class_node2d>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Sprite node that can use multiple textures for animation.
  11. Member Functions
  12. ----------------
  13. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`String<class_string>` | :ref:`get_animation<class_AnimatedSprite_get_animation>` **(** **)** const |
  15. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`int<class_int>` | :ref:`get_frame<class_AnimatedSprite_get_frame>` **(** **)** const |
  17. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`Color<class_color>` | :ref:`get_modulate<class_AnimatedSprite_get_modulate>` **(** **)** const |
  19. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`Vector2<class_vector2>` | :ref:`get_offset<class_AnimatedSprite_get_offset>` **(** **)** const |
  21. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`SpriteFrames<class_spriteframes>` | :ref:`get_sprite_frames<class_AnimatedSprite_get_sprite_frames>` **(** **)** const |
  23. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`is_centered<class_AnimatedSprite_is_centered>` **(** **)** const |
  25. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`is_flipped_h<class_AnimatedSprite_is_flipped_h>` **(** **)** const |
  27. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`is_flipped_v<class_AnimatedSprite_is_flipped_v>` **(** **)** const |
  29. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimatedSprite_is_playing>` **(** **)** const |
  31. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`play<class_AnimatedSprite_play>` **(** :ref:`String<class_string>` anim="" **)** |
  33. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`set_animation<class_AnimatedSprite_set_animation>` **(** :ref:`String<class_string>` animation **)** |
  35. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`set_centered<class_AnimatedSprite_set_centered>` **(** :ref:`bool<class_bool>` centered **)** |
  37. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`set_flip_h<class_AnimatedSprite_set_flip_h>` **(** :ref:`bool<class_bool>` flip_h **)** |
  39. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`set_flip_v<class_AnimatedSprite_set_flip_v>` **(** :ref:`bool<class_bool>` flip_v **)** |
  41. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`set_frame<class_AnimatedSprite_set_frame>` **(** :ref:`int<class_int>` frame **)** |
  43. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`set_modulate<class_AnimatedSprite_set_modulate>` **(** :ref:`Color<class_color>` modulate **)** |
  45. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`set_offset<class_AnimatedSprite_set_offset>` **(** :ref:`Vector2<class_vector2>` offset **)** |
  47. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`set_sprite_frames<class_AnimatedSprite_set_sprite_frames>` **(** :ref:`SpriteFrames<class_spriteframes>` sprite_frames **)** |
  49. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`stop<class_AnimatedSprite_stop>` **(** **)** |
  51. +------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
  52. Signals
  53. -------
  54. - **finished** **(** **)**
  55. Emitted when the animation is finished (when it plays the last frame). If the animation is looping, this signal is emitted everytime the last frame is drawn, before looping.
  56. - **frame_changed** **(** **)**
  57. Emitted when frame is changed.
  58. Description
  59. -----------
  60. Sprite node that can use multiple textures for animation.
  61. Member Function Description
  62. ---------------------------
  63. .. _class_AnimatedSprite_get_animation:
  64. - :ref:`String<class_string>` **get_animation** **(** **)** const
  65. Return the name of the current animation set to the node.
  66. .. _class_AnimatedSprite_get_frame:
  67. - :ref:`int<class_int>` **get_frame** **(** **)** const
  68. Return the visible frame index.
  69. .. _class_AnimatedSprite_get_modulate:
  70. - :ref:`Color<class_color>` **get_modulate** **(** **)** const
  71. Return the color modulation for this sprite.
  72. .. _class_AnimatedSprite_get_offset:
  73. - :ref:`Vector2<class_vector2>` **get_offset** **(** **)** const
  74. Return the offset of the sprite in the node origin.
  75. .. _class_AnimatedSprite_get_sprite_frames:
  76. - :ref:`SpriteFrames<class_spriteframes>` **get_sprite_frames** **(** **)** const
  77. Get the :ref:`SpriteFrames<class_spriteframes>` resource, which contains all frames.
  78. .. _class_AnimatedSprite_is_centered:
  79. - :ref:`bool<class_bool>` **is_centered** **(** **)** const
  80. Return true when centered. See :ref:`set_centered<class_AnimatedSprite_set_centered>`.
  81. .. _class_AnimatedSprite_is_flipped_h:
  82. - :ref:`bool<class_bool>` **is_flipped_h** **(** **)** const
  83. Return true if sprite is flipped horizontally.
  84. .. _class_AnimatedSprite_is_flipped_v:
  85. - :ref:`bool<class_bool>` **is_flipped_v** **(** **)** const
  86. Return true if sprite is flipped vertically.
  87. .. _class_AnimatedSprite_is_playing:
  88. - :ref:`bool<class_bool>` **is_playing** **(** **)** const
  89. Return true if an animation if currently being played.
  90. .. _class_AnimatedSprite_play:
  91. - void **play** **(** :ref:`String<class_string>` anim="" **)**
  92. Play the animation set in parameter. If no parameter is provided, the current animation is played.
  93. .. _class_AnimatedSprite_set_animation:
  94. - void **set_animation** **(** :ref:`String<class_string>` animation **)**
  95. Set the current animation of the node and reinits the frame counter of the animation.
  96. .. _class_AnimatedSprite_set_centered:
  97. - void **set_centered** **(** :ref:`bool<class_bool>` centered **)**
  98. When turned on, offset at (0,0) is the center of the sprite, when off, the top-left corner is.
  99. .. _class_AnimatedSprite_set_flip_h:
  100. - void **set_flip_h** **(** :ref:`bool<class_bool>` flip_h **)**
  101. If true, sprite is flipped horizontally.
  102. .. _class_AnimatedSprite_set_flip_v:
  103. - void **set_flip_v** **(** :ref:`bool<class_bool>` flip_v **)**
  104. If true, sprite is flipped vertically.
  105. .. _class_AnimatedSprite_set_frame:
  106. - void **set_frame** **(** :ref:`int<class_int>` frame **)**
  107. Set the visible sprite frame index (from the list of frames inside the :ref:`SpriteFrames<class_spriteframes>` resource).
  108. .. _class_AnimatedSprite_set_modulate:
  109. - void **set_modulate** **(** :ref:`Color<class_color>` modulate **)**
  110. Change the color modulation (multiplication) for this sprite.
  111. .. _class_AnimatedSprite_set_offset:
  112. - void **set_offset** **(** :ref:`Vector2<class_vector2>` offset **)**
  113. Set the offset of the sprite in the node origin. Position varies depending on whether it is centered or not.
  114. .. _class_AnimatedSprite_set_sprite_frames:
  115. - void **set_sprite_frames** **(** :ref:`SpriteFrames<class_spriteframes>` sprite_frames **)**
  116. Set the :ref:`SpriteFrames<class_spriteframes>` resource, which contains all frames.
  117. .. _class_AnimatedSprite_stop:
  118. - void **stop** **(** **)**
  119. Stop the current animation (does not reset the frame counter).