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.

AnimatedTexture

Inherits: Texture2D < Texture < Resource < RefCounted < Object

Proxy texture for simple frame-based animations.

Description

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.

Note: AnimatedTexture doesn't support using AtlasTextures. Each frame needs to be a separate Texture2D.

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

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

Properties

int

current_frame

int

frames

1

bool

one_shot

false

bool

pause

false

bool

resource_local_to_scene

false (overrides Resource)

float

speed_scale

1.0

Methods

float

get_frame_duration ( int frame ) const

Texture2D

get_frame_texture ( int frame ) const

void

set_frame_duration ( int frame, float duration )

void

set_frame_texture ( int frame, Texture2D texture )


Constants

MAX_FRAMES =