class_animatedsprite.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. Member Functions
  13. ----------------
  14. +--------------------------+----------------------------------------------------------------------------------------+
  15. | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimatedSprite_is_playing>` **(** **)** const |
  16. +--------------------------+----------------------------------------------------------------------------------------+
  17. | void | :ref:`play<class_AnimatedSprite_play>` **(** :ref:`String<class_string>` anim="" **)** |
  18. +--------------------------+----------------------------------------------------------------------------------------+
  19. | void | :ref:`stop<class_AnimatedSprite_stop>` **(** **)** |
  20. +--------------------------+----------------------------------------------------------------------------------------+
  21. Signals
  22. -------
  23. .. _class_AnimatedSprite_animation_finished:
  24. - **animation_finished** **(** **)**
  25. 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.
  26. .. _class_AnimatedSprite_frame_changed:
  27. - **frame_changed** **(** **)**
  28. Emitted when :ref:`frame<class_AnimatedSprite_frame>` changed.
  29. Member Variables
  30. ----------------
  31. .. _class_AnimatedSprite_animation:
  32. - :ref:`String<class_string>` **animation** - The current animation from the ``frames`` resource. If this value changes, the ``frame`` counter is reset.
  33. .. _class_AnimatedSprite_centered:
  34. - :ref:`bool<class_bool>` **centered** - If ``true`` texture will be centered. Default value: ``true``.
  35. .. _class_AnimatedSprite_flip_h:
  36. - :ref:`bool<class_bool>` **flip_h** - If ``true`` texture is flipped horizontally. Default value: ``false``.
  37. .. _class_AnimatedSprite_flip_v:
  38. - :ref:`bool<class_bool>` **flip_v** - If ``true`` texture is flipped vertically. Default value: ``false``.
  39. .. _class_AnimatedSprite_frame:
  40. - :ref:`int<class_int>` **frame** - The displayed animation frame's index.
  41. .. _class_AnimatedSprite_frames:
  42. - :ref:`SpriteFrames<class_spriteframes>` **frames** - The :ref:`SpriteFrames<class_spriteframes>` resource containing the animation(s).
  43. .. _class_AnimatedSprite_offset:
  44. - :ref:`Vector2<class_vector2>` **offset** - The texture's drawing offset.
  45. .. _class_AnimatedSprite_playing:
  46. - :ref:`bool<class_bool>` **playing** - If ``true`` the :ref:`animation<class_AnimatedSprite_animation>` is currently playing.
  47. Description
  48. -----------
  49. Animations are created using a :ref:`SpriteFrames<class_spriteframes>` resource, which can be configured in the editor via the SpriteFrames panel.
  50. Member Function Description
  51. ---------------------------
  52. .. _class_AnimatedSprite_is_playing:
  53. - :ref:`bool<class_bool>` **is_playing** **(** **)** const
  54. Return true if an animation if currently being played.
  55. .. _class_AnimatedSprite_play:
  56. - void **play** **(** :ref:`String<class_string>` anim="" **)**
  57. Play the animation set in parameter. If no parameter is provided, the current animation is played.
  58. .. _class_AnimatedSprite_stop:
  59. - void **stop** **(** **)**
  60. Stop the current animation (does not reset the frame counter).