Just a helper structure for the FlxSprite animation system.

Constructor

@:value({ flipY : false, flipX : false, looped : true, frameRate : 0.0 })new(parent:FlxAnimationController, name:String, frames:Array<Int>, frameRate:Float = 0.0, looped:Bool = true, flipX:Bool = false, flipY:Bool = false)

Parameters:

name

What this animation should be called (e.g. "run").

frames

An array of numbers indicating what frames to play in what order (e.g. [1, 2, 3]).

frameRate

The speed in frames per second that the animation should play at (e.g. 40).

looped

Whether or not the animation is looped or just plays once.

flipX

Whether or not the frames of this animation are horizontally flipped.

flipY

Whether or not the frames of this animation are vertically flipped.

Variables

@:value(0)curFrame:Int = 0

Keeps track of the current frame of animation. This is NOT an index into the tile sheet, but the frame number in the animation object.

delay:Float

Deprecated: "FlxAnimation.delay is deprecated, use `frameDuration`"

Seconds between frames (inverse of the framerate)

@:value(true)read onlyfinished:Bool = true

Whether the current animation has finished.

@:value(false)flipX:Bool = false

Whether or not the frames of this animation are horizontally flipped

@:value(false)flipY:Bool = false

Whether or not the frames of this animation are vertically flipped

@:value(0)frameDuration:Float = 0

Seconds between frames (inverse of the framerate)

Note: FlxFrameCollections and FlxAtlasFrames may have their own duration set per-frame, those values will override this value.

frameRate:Float

Animation frameRate - the speed in frames per second that the animation should play at.

frames:Array<Int>

A list of frames stored as int indices

Available since

4.2.0

.

@:value(0)loopPoint:Int = 0

The custom loop point for this animation. This allows you to skip the first few frames of an animation when looping.

@:value(true)looped:Bool = true

Whether or not the animation is looped.

read onlynumFrames:Int

Accessor for frames.length

@:value(true)paused:Bool = true

Whether the current animation gets updated or not.

@:value(false)read onlyreversed:Bool = false

Whether or not this animation is being played backwards.

@:value(1.0)timeScale:Float = 1.0

How fast or slow time should pass for this animation.

Similar to FlxAnimationController's timeScale, but won't effect other animations.

Available since

5.4.1

.

Methods

destroy():Void

Clean up memory.

@:value({ Frame : 0, Reversed : false, Force : false })play(Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void

Starts this animation playback.

Parameters:

Force

Whether to force this animation to restart.

Reversed

Whether to play animation backwards or not.

Frame

The frame number in this animation you want to start from (0 by default). If you pass a negative value then it will start from a random frame. If you Reversed is true, the frame value will be "reversed" (Frame = numFrames - 1 - Frame), so Frame value will mean frame index from the animation's end in this case.

inlineresume():Void

Inherited Variables

Defined by FlxBaseAnimation

@:value(0)curIndex:Int = 0

Keeps track of the current index into the tile sheet based on animation or rotation.

name:String

String name of the animation (e.g. "walk")

read onlyparent:FlxAnimationController

Animation controller this animation belongs to

Inherited Methods