AnimatedTexture

package
v0.0.0-...-535787f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

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

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

graphics.gd/classdb/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 [graphics.gd/classdb/AtlasTexture]s. Each frame needs to be a separate graphics.gd/classdb/Texture2D.

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

Index

Constants

View Source
const MaxFrames int = 256 //gd:AnimatedTexture.MAX_FRAMES

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsAnimatedTexture() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsAnimatedTexture

func (self *Extension[T]) AsAnimatedTexture() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

func (*Extension[T]) AsTexture

func (self *Extension[T]) AsTexture() Texture.Instance

func (*Extension[T]) AsTexture2D

func (self *Extension[T]) AsTexture2D() Texture2D.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.AnimatedTexture

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsAnimatedTexture

func (self Instance) AsAnimatedTexture() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) AsTexture

func (self Instance) AsTexture() Texture.Instance

func (Instance) AsTexture2D

func (self Instance) AsTexture2D() Texture2D.Instance

func (Instance) CurrentFrame

func (self Instance) CurrentFrame() int

func (Instance) Frames

func (self Instance) Frames() int

func (Instance) GetFrameDuration

func (self Instance) GetFrameDuration(frame_ int) Float.X

Returns the given 'frame”s duration, in seconds.

func (Instance) GetFrameTexture

func (self Instance) GetFrameTexture(frame_ int) Texture2D.Instance

Returns the given frame's graphics.gd/classdb/Texture2D.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) OneShot

func (self Instance) OneShot() bool

func (Instance) Pause

func (self Instance) Pause() bool

func (Instance) SetCurrentFrame

func (self Instance) SetCurrentFrame(value int)

func (Instance) SetFrameDuration

func (self Instance) SetFrameDuration(frame_ int, duration Float.X)

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

func (Instance) SetFrameTexture

func (self Instance) SetFrameTexture(frame_ int, texture Texture2D.Instance)

Assigns a graphics.gd/classdb/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 Instance.Frames - 1.

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

func (Instance) SetFrames

func (self Instance) SetFrames(value int)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetOneShot

func (self Instance) SetOneShot(value bool)

func (Instance) SetPause

func (self Instance) SetPause(value bool)

func (Instance) SetSpeedScale

func (self Instance) SetSpeedScale(value Float.X)

func (Instance) SpeedScale

func (self Instance) SpeedScale() Float.X

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL