AnimatedSprite

class AnimatedSprite(var slice: TextureSlice = Textures.white, var anchorX: Float = 0.0f, var anchorY: Float = 0.0f) : AnimationPlayer<TextureSlice>

Author

Colton Daily

Constructors

Link copied to clipboard
fun AnimatedSprite(slice: TextureSlice = Textures.white, anchorX: Float = 0.0f, anchorY: Float = 0.0f)

Functions

Link copied to clipboard
fun play(animation: Animation<TextureSlice>, times: Int = 1, queue: Boolean = false)

Play the specified animation an X number of times.

fun play(animation: Animation<TextureSlice>, duration: Duration, queue: Boolean = false)

Play the specified animation for a duration.

fun play(frame: TextureSlice, frameTime: Duration = 50.milliseconds, numFrames: Int = 1)

Play a specified frame for a certain amount of frames.

Link copied to clipboard

Play the specified animation as a loop.

Link copied to clipboard

Play the specified animation one time.

Link copied to clipboard
fun registerState(anim: Animation<TextureSlice>, priority: Int, loop: Boolean = true, reason: () -> Boolean = { true })

Priority is represented by the deepest. The deepest has top priority while the shallowest has lowest.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun render(batch: Batch)
Link copied to clipboard
fun restart()

Restarts the current running animation from the beginning. Is the same as invoking stop and then start.

Link copied to clipboard
fun resume()

Resumes any currently stopped animation. This only does something when an animation is stopped with stop.

Link copied to clipboard
fun start()

Starts any currently stopped animation from the beginning. This only does something when an animation is stopped with stop.

Link copied to clipboard
fun stop()

Stops any running animations. Resume the current animation with resume.

Link copied to clipboard
fun update(dt: Duration)

Runs any updates for any requested animation and grabs the next frame if so.

Properties

Link copied to clipboard
var anchorX: Float = 0.0f
Link copied to clipboard
var anchorY: Float = 0.0f
Link copied to clipboard

The current playing animations. Set this by using one of the play methods.

Link copied to clipboard

The index of the current frame

Link copied to clipboard
Link copied to clipboard

Invoked when a frame is changed.

Link copied to clipboard
Link copied to clipboard
var scaleX: Float = 0.0f
Link copied to clipboard
var scaleY: Float = 0.0f
Link copied to clipboard
Link copied to clipboard

The total frames the currentAnimation has.

Link copied to clipboard

The total amount of frames played across all animations.

Link copied to clipboard
var x: Float = 0.0f
Link copied to clipboard
var y: Float = 0.0f