Instance Propertymigueldeicaza.swiftgodot 0.45.0SwiftGodot
speedScale
The animation speed is multiplied by this value. If set to a negative value, the animation is played in reverse.
AnimatedTexture.swift:79final var speedScale: Double { get set }
Other members in extension
Type members
static let maxFrames: Int
The maximum number of frames supported by
AnimatedTexture
. If you need more frames in your animation, useAnimationPlayer
orAnimatedSprite2D
.class var godotClassName: StringName
Instance members
var currentFrame: Int32
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.
var frames: Int32
Number of frames to use in the animation. While you can create the frames independently with
setFrameTexture(frame:texture:)
, you need to set this value for the animation to take new frames into account. The maximum number of frames ismaxFrames
.var oneShot: 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 setpause
totrue
.var pause: Bool
If
true
, the animation will pause where it currently is (i.e. atcurrentFrame
). The animation will continue from where it was paused when changing this property tofalse
.func getFrameDuration(frame: Int32
) -> Double Returns the given
frame
’s duration, in seconds.func getFrameTexture(frame: Int32
) -> Texture2D? Returns the given frame’s
Texture2D
.func setFrameDuration(frame: Int32, duration: Double
) Sets the duration of any given
frame
. The final duration is affected by thespeedScale
. If set to0
, the frame is skipped during playback.func setFrameTexture(frame: Int32, texture: Texture2D?
) 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 IDframes
- 1.