Instance Methodmigueldeicaza.swiftgodot 0.45.0SwiftGodot
renameAnimation(anim:newname:)
Changes the anim
animation’s name to newname
.
final func renameAnimation(anim: StringName, newname: StringName)
Other members in extension
Type members
Instance members
func addAnimation(anim: StringName
) Adds a new
anim
animation to the library.func addFrame(anim: StringName, texture: Texture2D?, duration: Double, atPosition: Int32
) Adds a frame to the
anim
animation. IfatPosition
is-1
, the frame will be added to the end of the animation.func clear(anim: StringName
) Removes all frames from the
anim
animation.func clearAll(
) Removes all animations. An empty
default
animation will be created.func getAnimationLoop(anim: StringName
) -> Bool Returns
true
if the given animation is configured to loop when it finishes playing. Otherwise, returnsfalse
.func getAnimationNames(
) -> PackedStringArray Returns an array containing the names associated to each animation. Values are placed in alphabetical order.
func getAnimationSpeed(anim: StringName
) -> Double Returns the speed in frames per second for the
anim
animation.func getFrameCount(anim: StringName
) -> Int32 Returns the number of frames for the
anim
animation.func getFrameDuration(anim: StringName, idx: Int32
) -> Double Returns a relative duration of the frame
idx
in theanim
animation (defaults to1.0
). For example, a frame with a duration of2.0
is displayed twice as long as a frame with a duration of1.0
. You can calculate the absolute duration (in seconds) of a frame using the following formula:func getFrameTexture(anim: StringName, idx: Int32
) -> Texture2D? Returns the texture of the frame
idx
in theanim
animation.func hasAnimation(anim: StringName
) -> Bool Returns
true
if theanim
animation exists.func removeAnimation(anim: StringName
) Removes the
anim
animation.func removeFrame(anim: StringName, idx: Int32
) Removes the
anim
animation’s frameidx
.func setAnimationLoop(anim: StringName, loop: Bool
) If
loop
istrue
, theanim
animation will loop when it reaches the end, or the start if it is played in reverse.func setAnimationSpeed(anim: StringName, fps: Double
) Sets the speed for the
anim
animation in frames per second.func setFrame(anim: StringName, idx: Int32, texture: Texture2D?, duration: Double
) Sets the
texture
and theduration
of the frameidx
in theanim
animation.