Fork me on GitHub
View source

package com.haxepunk.graphics

class Animation

Template used by Spritemap to define animations. Don't create these yourself, instead you can fetch them with Spritemap.add.

Constructor

View source

new (name : String, frames : Array<Int>, frameRate : Float = 0, loop : Bool = true, ?parent : Spritemap) : Void

Constructor.


Parameters:
name   

Animation name.

frames   

Array of frame indices to animate.

frameRate   

Animation speed.

loop   

If the animation should loop.

Variables

read only frameCount : Int

Amount of frames in the animation.

read only frameRate : Float

Animation speed.

read only frames : Array<Int>

Array of frame indices to animate.

read only loop : Bool

If the animation loops.

read only name : String

Name of the animation.

Functions

View source

play (reset : Bool = false, reverse : Bool = false) : Void

Plays the animation.


Parameters:
reset   

If the animation should force-restart if it is already playing.