AnimatedSprite
Inherits: Node2D < CanvasItem < Node < Object
Sprite node that can use multiple textures for animation.
Description
Animations are created using a SpriteFrames resource, which can be configured in the editor via the SpriteFrames panel.
Note: You can associate a set of normal maps by creating additional SpriteFrames resources with a _normal suffix. For example, having 2 SpriteFrames resources run and run_normal will make it so the run animation uses the normal map.
Tutorials
Properties
| String | animation | "default" |  
| bool | centered | true |  
| bool | flip_h | false |  
| bool | flip_v | false |  
| int | frame | 0 |  
| SpriteFrames | frames | |
| Vector2 | offset | Vector2( 0, 0 ) |  
| bool | playing | false |  
| float | speed_scale | 1.0 |  
Methods
| bool | is_playing ( ) const | 
| void | play ( String anim="", bool backwards=false ) | 
| void | stop ( ) | 
Signals
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.
frame_changed ( )
Emitted when frame changed.
Property Descriptions
String animation
| Default | "default" |  
| Setter | set_animation(value) | 
| Getter | get_animation() | 
The current animation from the frames resource. If this value changes, the frame counter is reset.
bool centered
| Default | true |  
| Setter | set_centered(value) | 
| Getter | is_centered() | 
If true, texture will be centered.
bool flip_h
| Default | false |  
| Setter | set_flip_h(value) | 
| Getter | is_flipped_h() | 
If true, texture is flipped horizontally.
bool flip_v
| Default | false |  
| Setter | set_flip_v(value) | 
| Getter | is_flipped_v() | 
If true, texture is flipped vertically.
int frame
| Default | 0 |  
| Setter | set_frame(value) | 
| Getter | get_frame() | 
The displayed animation frame's index.
SpriteFrames frames
| Setter | set_sprite_frames(value) | 
| Getter | get_sprite_frames() | 
The SpriteFrames resource containing the animation(s).
Vector2 offset
| Default | Vector2( 0, 0 ) |  
| Setter | set_offset(value) | 
| Getter | get_offset() | 
The texture's drawing offset.
bool playing
| Default | false |  
If true, the animation is currently playing.
float speed_scale
| Default | 1.0 |  
| Setter | set_speed_scale(value) | 
| Getter | get_speed_scale() | 
The animation speed is multiplied by this value.
Method Descriptions
bool is_playing ( ) const
Returns true if an animation is currently being played.
void play ( String anim="", bool backwards=false )
Plays the animation named anim. If no anim is provided, the current animation is played. If backwards is true, the animation will be played in reverse.
void stop ( )
Stops the current animation (does not reset the frame counter).
    © 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
    https://docs.godotengine.org/en/3.2/classes/class_animatedsprite.html