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.

Note: You can associate a set of normal or specular maps by creating additional SpriteFrames resources with a _normal or _specular suffix. For example, having 3 SpriteFrames resources run, run_normal, and run_specular will make it so the run animation uses normal and specular maps.

Properties

Array

frames

Methods

void

add_animation ( StringName anim )

void

add_frame ( StringName anim, Texture2D frame, 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

Texture2D

get_frame ( StringName anim, int idx ) const

int

get_frame_count ( StringName anim ) 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 speed )

void

set_frame ( StringName anim, int idx, Texture2D txt )

Property Descriptions

Compatibility property, always equals to an empty array.

Method Descriptions

Adds a new animation to the library.


Adds a frame to the given animation.


Removes all frames from the given animation.


  • void clear_all ( )

Removes all animations. A "default" animation will be created.


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


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


The animation's speed in frames per second.


Returns the animation's selected frame.


Returns the number of frames in the animation.


If true, the named animation exists.


Removes the given animation.


Removes the animation's selected frame.


Changes the animation's name to newname.


If true, the animation will loop.


The animation's speed in frames per second.


Sets the texture of the given frame.