AnimatedSprite
Inherits: Node2D < CanvasItem < Node < Object Sprite node that can use multiple textures for animation.
Description
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
- 2D 精灵动画
- 2D Dodge The Creeps Demo
Properties
Methods
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 ( )
frame changed.
Property Descriptions
- String animation
framesresource. If this value changes, theframecounter is reset.
- bool centered
true, texture will be centered.
- bool flip_h
true, texture is flipped horizontally.
- bool flip_v
true, texture is flipped vertically.
- int frame The displayed animation frame’s index.
- SpriteFrames frames SpriteFrames resource containing the animation(s).
- Vector2 offset The texture’s drawing offset.
- bool playing
true, the animation is currently playing.
- float speed_scale
The animation speed is multiplied by this value.
Method Descriptions
- bool is_playing ( ) const
trueif an animation is currently being played.
- play ( String anim=””, bool backwards=false )
anim. If noanimis provided, the current animation is played. Ifbackwardsistrue, the animation will be played in reverse.
- stop ( ) Stops the current animation (does not reset the frame counter).
