class-description NEWS COMMUNITY STORE TUTORIALS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE TUTORIALS TOGGLE FULLSCREEN VOLLBILD AN/AUS ObjectRefCountedResource SpriteFrames
Sprite frame library for AnimatedSprite2D and AnimatedSprite3D.

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

void add_animation<>( StringName anim=, anim:StringName=, ):void

Adds a new anim animation to the library.

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

Adds a frame to the anim animation. If at_position is -1, the frame will be added to the end of the animation. duration specifies the relative duration, see get_frame_duration() for details.

void clear<>( StringName anim=, anim:StringName=, ):void

Removes all frames from the anim animation.

void clear_all<>():void

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

void duplicate_animation<>( StringName anim_from=, anim_from:StringName=, StringName anim_to=, anim_to:StringName=, ):void

Duplicates the animation anim_from to a new animation named anim_to. Fails if anim_to already exists, or if anim_from does not exist.

bool get_animation_loop<>( StringName anim=, anim:StringName=, ):bool

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

PackedStringArray get_animation_names<>():PackedStringArray

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

float get_animation_speed<>( StringName anim=, anim:StringName=, ):float

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

int get_frame_count<>( StringName anim=, anim:StringName=, ):int

Returns the number of frames for the anim animation.

float get_frame_duration<>( StringName anim=, anim:StringName=, int idx=, idx:int=, ):float

Returns a relative duration of the frame idx in the anim animation (defaults to 1.0). For example, a frame with a duration of 2.0 is displayed twice as long as a frame with a duration of 1.0. You can calculate the absolute duration (in seconds) of a frame using the following formula:

absolute_duration = relative_duration / (animation_fps * abs(playing_speed))

In this example, playing_speed refers to either AnimatedSprite2D.get_playing_speed() or AnimatedSprite3D.get_playing_speed().

Texture2D get_frame_texture<>( StringName anim=, anim:StringName=, int idx=, idx:int=, ):Texture2D

Returns the texture of the frame idx in the anim animation.

bool has_animation<>( StringName anim=, anim:StringName=, ):bool

Returns true if the anim animation exists.

void remove_animation<>( StringName anim=, anim:StringName=, ):void

Removes the anim animation.

void remove_frame<>( StringName anim=, anim:StringName=, int idx=, idx:int=, ):void

Removes the anim animation's frame idx.

void rename_animation<>( StringName anim=, anim:StringName=, StringName newname=, newname:StringName=, ):void

Changes the anim animation's name to newname.

void set_animation_loop<>( StringName anim=, anim:StringName=, bool loop=, loop:bool=, ):void

If loop is true, the anim animation will loop when it reaches the end, or the start if it is played in reverse.

void set_animation_speed<>( StringName anim=, anim:StringName=, float fps=, fps:float=, ):void

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

void set_frame<>( StringName anim=, anim:StringName=, int idx=, idx:int=, Texture2D texture=, texture:Texture2D=, float duration=1.0, duration:float=1.0, ):void

Sets the texture and the duration of the frame idx in the anim animation. duration specifies the relative duration, see get_frame_duration() for details.




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...