W3cubDocs

/Godot 3.0

SpriteFrames

Inherits: Resource < Reference < Object

Category: Core

Brief Description

Sprite frame library for AnimatedSprite.

Member Functions

void add_animation ( String anim )
void add_frame ( String anim, Texture frame, int at_position=-1 )
void clear ( String anim )
void clear_all ( )
bool get_animation_loop ( String anim ) const
float get_animation_speed ( String anim ) const
Texture get_frame ( String anim, int idx ) const
int get_frame_count ( String anim ) const
bool has_animation ( String anim ) const
void remove_animation ( String anim )
void remove_frame ( String anim, int idx )
void rename_animation ( String anim, String newname )
void set_animation_loop ( String anim, bool loop )
void set_animation_speed ( String anim, float speed )
void set_frame ( String anim, int idx, Texture txt )

Member Variables

Array frames

Description

Sprite frame library for AnimatedSprite. Contains frames and animation data for playback.

Member Function Description

void add_animation ( String anim )

Adds a new animation to the the library.

void add_frame ( String anim, Texture frame, int at_position=-1 )

Adds a frame to the given animation.

void clear ( String anim )

Removes all frames from the given animation.

void clear_all ( )

Removes all animations. A “default” animation will be created.

bool get_animation_loop ( String anim ) const

If true the given animation will loop.

float get_animation_speed ( String anim ) const

The animation’s speed in frames per second.

Texture get_frame ( String anim, int idx ) const

Returns the animation’s selected frame.

int get_frame_count ( String anim ) const

Returns the number of frames in the animation.

bool has_animation ( String anim ) const

If true the named animation exists.

void remove_animation ( String anim )

Removes the given animation.

void remove_frame ( String anim, int idx )

Removes the animation’s selected frame.

void rename_animation ( String anim, String newname )

Changes the animation’s name to newname.

void set_animation_loop ( String anim, bool loop )

If true the animation will loop.

void set_animation_speed ( String anim, float speed )

The animation’s speed in frames per second.

void set_frame ( String anim, int idx, Texture txt )

Sets the texture of the given frame.

© 2014–2018 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
http://docs.godotengine.org/en/3.0/classes/class_spriteframes.html