AnimatedSprite3D

Inherits: SpriteBase3D < GeometryInstance < VisualInstance < CullInstance < Spatial < Node < Object

2D sprite node in 3D world, that can use multiple 2D textures for animation.

Description

Animations are created using a SpriteFrames resource, which can be configured in the editor via the SpriteFrames panel.

Tutorials

Properties

String

animation

"default"

int

frame

0

SpriteFrames

frames

bool

playing

false

Methods

bool

is_playing ( ) const

void

play ( String anim="" )

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"

  • void set_animation ( String value )

  • String get_animation ( )

The current animation from the frames resource. If this value changes, the frame counter is reset.


int frame = 0

  • void set_frame ( int value )

  • int get_frame ( )

The displayed animation frame's index.


SpriteFrames frames

The SpriteFrames resource containing the animation(s).


bool playing = false

If true, the animation is currently playing.


Method Descriptions

bool is_playing ( ) const

Returns true if an animation is currently being played.


void play ( String anim="" )

Plays the animation named anim. If no anim is provided, the current animation is played.


void stop ( )

Stops the current animation (does not reset the frame counter).