Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

SpriteFrames

Inherits: Resource < RefCounted < Object

Sprite frame library for AnimatedSprite2D and AnimatedSprite3D.

Description

Sprite frame library for an AnimatedSprite2D or AnimatedSprite3D node. Contains frames and animation data for playback.

Methods

void

add_animation ( StringName anim )

void

add_frame ( StringName anim, Texture2D texture, float duration=1.0, int at_position=-1 )

void

clear ( StringName anim )

void

clear_all ( )

bool

get_animation_loop ( StringName anim ) const

PackedStringArray

get_animation_names ( ) const

float

get_animation_speed ( StringName anim ) const

int

get_frame_count ( StringName anim ) const

float

get_frame_duration ( StringName anim, int idx ) const

Texture2D

get_frame_texture ( StringName anim, int idx ) const

bool

has_animation ( StringName anim ) const

void

remove_animation ( StringName anim )

void

remove_frame ( StringName anim, int idx )

void

rename_animation ( StringName anim, StringName newname )

void

set_animation_loop ( StringName anim, bool loop )

void

set_animation_speed ( StringName anim, float fps )

void

set_frame ( StringName anim, int idx, Texture2D texture, float duration=1.0 )


Method Descriptions

void add_animation ( StringName anim )

Adds a new anim animation to the library.


void add_frame ( StringName anim, Texture2D texture, float duration=1.0, int at_position=-1 )

Adds a frame to the anim animation. If at_position is -1, the frame will be added to the end of the animation.


void clear ( StringName anim )

Removes all frames from the anim animation.


void clear_all ( )

Removes all animations. An empty default animation will be created.


bool get_animation_loop ( StringName anim ) const

Returns true if the given animation is configured to loop when it finishes playing. Otherwise, returns false.


PackedStringArray get_animation_names ( ) const

Returns an array containing the names associated to each animation. Values are placed in alphabetical order.


float get_animation_speed ( StringName anim ) const

Returns the speed in frames per second for the anim animation.


int get_frame_count ( StringName anim ) const

Returns the n