:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the AnimatedSprite.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_AnimatedSprite: AnimatedSprite ============== **Inherits:** :ref:`Node2D` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Sprite node that can use multiple textures for animation. Properties ---------- +-----------------------------------------+---------------------------------------------------------------+ | :ref:`String` | :ref:`animation` | +-----------------------------------------+---------------------------------------------------------------+ | :ref:`bool` | :ref:`centered` | +-----------------------------------------+---------------------------------------------------------------+ | :ref:`bool` | :ref:`flip_h` | +-----------------------------------------+---------------------------------------------------------------+ | :ref:`bool` | :ref:`flip_v` | +-----------------------------------------+---------------------------------------------------------------+ | :ref:`int` | :ref:`frame` | +-----------------------------------------+---------------------------------------------------------------+ | :ref:`SpriteFrames` | :ref:`frames` | +-----------------------------------------+---------------------------------------------------------------+ | :ref:`Vector2` | :ref:`offset` | +-----------------------------------------+---------------------------------------------------------------+ | :ref:`bool` | :ref:`playing` | +-----------------------------------------+---------------------------------------------------------------+ | :ref:`float` | :ref:`speed_scale` | +-----------------------------------------+---------------------------------------------------------------+ Methods ------- +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_playing` **(** **)** const | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`play` **(** :ref:`String` anim="", :ref:`bool` backwards=false **)** | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`stop` **(** **)** | +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- .. _class_AnimatedSprite_signal_animation_finished: - **animation_finished** **(** **)** 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. ---- .. _class_AnimatedSprite_signal_frame_changed: - **frame_changed** **(** **)** Emitted when :ref:`frame` changed. Description ----------- Animations are created using a :ref:`SpriteFrames` resource, which can be configured in the editor via the SpriteFrames panel. Property Descriptions --------------------- .. _class_AnimatedSprite_property_animation: - :ref:`String` **animation** +----------+----------------------+ | *Setter* | set_animation(value) | +----------+----------------------+ | *Getter* | get_animation() | +----------+----------------------+ The current animation from the ``frames`` resource. If this value changes, the ``frame`` counter is reset. ---- .. _class_AnimatedSprite_property_centered: - :ref:`bool` **centered** +----------+---------------------+ | *Setter* | set_centered(value) | +----------+---------------------+ | *Getter* | is_centered() | +----------+---------------------+ If ``true``, texture will be centered. Default value: ``true``. ---- .. _class_AnimatedSprite_property_flip_h: - :ref:`bool` **flip_h** +----------+-------------------+ | *Setter* | set_flip_h(value) | +----------+-------------------+ | *Getter* | is_flipped_h() | +----------+-------------------+ If ``true``, texture is flipped horizontally. Default value: ``false``. ---- .. _class_AnimatedSprite_property_flip_v: - :ref:`bool` **flip_v** +----------+-------------------+ | *Setter* | set_flip_v(value) | +----------+-------------------+ | *Getter* | is_flipped_v() | +----------+-------------------+ If ``true``, texture is flipped vertically. Default value: ``false``. ---- .. _class_AnimatedSprite_property_frame: - :ref:`int` **frame** +----------+------------------+ | *Setter* | set_frame(value) | +----------+------------------+ | *Getter* | get_frame() | +----------+------------------+ The displayed animation frame's index. ---- .. _class_AnimatedSprite_property_frames: - :ref:`SpriteFrames` **frames** +----------+--------------------------+ | *Setter* | set_sprite_frames(value) | +----------+--------------------------+ | *Getter* | get_sprite_frames() | +----------+--------------------------+ The :ref:`SpriteFrames` resource containing the animation(s). ---- .. _class_AnimatedSprite_property_offset: - :ref:`Vector2` **offset** +----------+-------------------+ | *Setter* | set_offset(value) | +----------+-------------------+ | *Getter* | get_offset() | +----------+-------------------+ The texture's drawing offset. ---- .. _class_AnimatedSprite_property_playing: - :ref:`bool` **playing** If ``true``, the :ref:`animation` is currently playing. ---- .. _class_AnimatedSprite_property_speed_scale: - :ref:`float` **speed_scale** +----------+------------------------+ | *Setter* | set_speed_scale(value) | +----------+------------------------+ | *Getter* | get_speed_scale() | +----------+------------------------+ The animation speed is multiplied by this value. Method Descriptions ------------------- .. _class_AnimatedSprite_method_is_playing: - :ref:`bool` **is_playing** **(** **)** const Returns ``true`` if an animation if currently being played. ---- .. _class_AnimatedSprite_method_play: - void **play** **(** :ref:`String` anim="", :ref:`bool` backwards=false **)** 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``. ---- .. _class_AnimatedSprite_method_stop: - void **stop** **(** **)** Stop the current animation (does not reset the frame counter).