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
- type Advanced
- type Any
- type Extension
- func (self *Extension[T]) AsAnimatedTexture() Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
- func (self *Extension[T]) AsResource() Resource.Instance
- func (self *Extension[T]) AsTexture() Texture.Instance
- func (self *Extension[T]) AsTexture2D() Texture2D.Instance
- type ID
- type Instance
- func (self Instance) AsAnimatedTexture() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) AsTexture() Texture.Instance
- func (self Instance) AsTexture2D() Texture2D.Instance
- func (self Instance) CurrentFrame() int
- func (self Instance) Frames() int
- func (self Instance) GetFrameDuration(frame_ int) Float.X
- func (self Instance) GetFrameTexture(frame_ int) Texture2D.Instance
- func (self Instance) ID() ID
- func (self Instance) OneShot() bool
- func (self Instance) Pause() bool
- func (self Instance) SetCurrentFrame(value int)
- func (self Instance) SetFrameDuration(frame_ int, duration Float.X)
- func (self Instance) SetFrameTexture(frame_ int, texture Texture2D.Instance)
- func (self Instance) SetFrames(value int)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetOneShot(value bool)
- func (self Instance) SetPause(value bool)
- func (self Instance) SetSpeedScale(value Float.X)
- func (self Instance) SpeedScale() Float.X
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
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 Extension ¶
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 (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
func (*Extension[T]) AsTexture2D ¶
type 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.
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 (Instance) AsAnimatedTexture ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) AsTexture2D ¶
func (Instance) CurrentFrame ¶
func (Instance) GetFrameDuration ¶
Returns the given 'frame”s duration, in seconds.
func (Instance) GetFrameTexture ¶
Returns the given frame's graphics.gd/classdb/Texture2D.
func (Instance) SetCurrentFrame ¶
func (Instance) SetFrameDuration ¶
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 ¶
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.