AnimatedSprite
Sprite node that can use multiple textures for animation.
Animations are created using a 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 suffix. For example, having 2 resources run
and run_normal
will make it so the run
animation uses the normal map.
Tutorials
Methods
is_playing ( ) const | |
void | ( String anim=””, backwards=false ) |
void | stop ( ) |
- 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 changed.
Property Descriptions
- String animation
Default | “default” |
Setter | set_animation(value) |
Getter | get_animation() |
- 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.
- flip_v
Default | false |
Setter | set_flip_v(value) |
Getter | is_flipped_v() |
If , texture is flipped vertically.
The displayed animation frame’s index.
- SpriteFrames frames
Setter | set_sprite_frames(value) |
Getter | get_sprite_frames() |
The resource containing the animation(s).
- Vector2 offset
Default | Vector2( 0, 0 ) |
Setter | set_offset(value) |
Getter | get_offset() |
- playing
If true
, the animation is currently playing.
- speed_scale
Default | 1.0 |
Setter | set_speed_scale(value) |
Getter | get_speed_scale() |
The animation speed is multiplied by this value.
- bool is_playing ( ) const
Returns true
if an animation is currently being played.
- void play ( anim=””, bool backwards=false )
Plays the animation named anim
. If no anim
is provided, the current animation is played. If backwards
is , the animation will be played in reverse.
- void stop ( )
Stops the current animation (does not reset the frame counter).