class-description NEWS COMMUNITY STORE LABS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE LABS TOGGLE FULLSCREEN VOLLBILD AN/AUS ObjectRefCountedResourceTextureTexture2D AnimatedTexture
Proxy texture for simple frame-based animations.

AnimatedTexture is a resource format for frame-based animations, where multiple textures can be chained automatically with a predefined delay for each frame. Unlike AnimationPlayer or AnimatedSprite2D, it isn't a Node, but has the advantage of being usable anywhere a Texture2D resource can be used, e.g. in a TileSet.

The playback of the animation is controlled by the speed_scale property, as well as each frame's duration (see set_frame_duration). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame.

AnimatedTexture currently requires all frame textures to have the same size, otherwise the bigger ones will be cropped to match the smallest one.

Warning: The current implementation is not efficient for the modern renderers.

Deprecated. This class is deprecated, and might be removed in a future release.

int current_frame<>():int

Sets the currently visible frame of the texture. Setting this frame while playing resets the current frame time, so the newly selected frame plays for its whole configured frame duration.

int frames<>():int

Number of frames to use in the animation. While you can create the frames independently with set_frame_texture, you need to set this value for the animation to take new frames into account. The maximum number of frames is MAX_FRAMES.

bool one_shot<>():bool

If true, the animation will only play once and will not loop back to the first frame after reaching the end. Note that reaching the end will not set pause to true.

bool pause<>():bool

If true, the animation will pause where it currently is (i.e. at current_frame). The animation will continue from where it was paused when changing this property to false.

float speed_scale<>():float

The animation speed is multiplied by this value. If set to a negative value, the animation is played in reverse.

float get_frame_duration<>( int frame=, frame:int=, ):float

Returns the given frame's duration, in seconds.

Texture2D get_frame_texture<>( int frame=, frame:int=, ):Texture2D

Returns the given frame's Texture2D.

void set_frame_duration<>( int frame=, frame:int=, float duration=, duration:float=, ):void

Sets the duration of any given frame. The final duration is affected by the speed_scale. If set to 0, the frame is skipped during playback.

void set_frame_texture<>( int frame=, frame:int=, Texture2D texture=, texture:Texture2D=, ):void

Assigns a Texture2D to the given frame. Frame IDs start at 0, so the first frame has ID 0, and the last frame of the animation has ID frames - 1.

You can define any number of textures up to MAX_FRAMES, but keep in mind that only frames from 0 to frames - 1 will be part of the animation.




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...