class flixel.animation.FlxAnimationController implements IFlxDestroyable
Available on all platforms
Instance Fields
Tell the sprite to change to a frame with specific name. * Useful for sprites with loaded TexturePacker atlas.
function add(Name:String, Frames:Array<Int>, ?FrameRate:Int = 30, ?Looped:Bool = true):Void
Adds a new _animations to the sprite. *
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 _animations should play at (e.g. 40 fps). * |
Looped | Whether or not the _animations is looped or just plays once. |
function addByIndices(Name:String, Prefix:String, Indices:Array<Int>, Postfix:String, ?FrameRate:Int = 30, ?Looped:Bool = true):Void
Adds a new _animations to the sprite. *
Name | What this _animations should be called (e.g. "run"). * |
Prefix | Common beginning of image names in atlas (e.g. "tiles-") * |
Indices | An array of numbers indicating what frames to play in what order (e.g. 1, 2, 3). * |
Postfix | Common ending of image names in atlas (e.g. ".png") * |
FrameRate | The speed in frames per second that the _animations should play at (e.g. 40 fps). * |
Looped | Whether or not the _animations is looped or just plays once. |
function addByNames(Name:String, FrameNames:Array<String>, ?FrameRate:Int = 30, ?Looped:Bool = true):Void
Adds a new _animations to the sprite. *
Name | What this _animations should be called (e.g. "run"). * |
FrameNames | An array of image names from atlas indicating what frames to play in what order. * |
FrameRate | The speed in frames per second that the _animations should play at (e.g. 40 fps). * |
Looped | Whether or not the _animations is looped or just plays once. |
function addByPrefix(Name:String, Prefix:String, ?FrameRate:Int = 30, ?Looped:Bool = true):Void
Adds a new _animations to the sprite. *
Name | What this _animations should be called (e.g. "run"). * |
Prefix | Common beginning of image names in atlas (e.g. "tiles-") * |
FrameRate | The speed in frames per second that the _animations should play at (e.g. 40 fps). * |
Looped | Whether or not the _animations is looped or just plays once. |
function addByStringIndices(Name:String, Prefix:String, Indices:Array<String>, Postfix:String, ?FrameRate:Int = 30, ?Looped:Bool = true):Void
Adds a new _animations to the sprite. Should works a little bit faster than addByIndices() *
Name | What this _animations should be called (e.g. "run"). * |
Prefix | Common beginning of image names in atlas (e.g. "tiles-") * |
Indices | An array of strings indicating what frames to play in what order (e.g. ["01", "02", "03"]). * |
Postfix | Common ending of image names in atlas (e.g. ".png") * |
FrameRate | The speed in frames per second that the _animations should play at (e.g. 40 fps). * |
Looped | Whether or not the _animations is looped or just plays once. |
function append(Name:String, Frames:Array<Int>):Void
Adds to an existing _animations in the sprite by appending the specified frames to the existing frames. * Use this method when the indices of the frames in the atlas are already known. * The animation must already exist in order to append frames to it. FrameRate and Looped are unchanged. *
Name | What the existing _animations is called (e.g. "run"). * |
Frames | An array of numbers indicating what frames to append (e.g. 1, 2, 3). |
function appendByIndices(Name:String, Prefix:String, Indices:Array<Int>, Postfix:String):Void
Adds to an existing _animations in the sprite by appending the specified frames to the existing frames. * Use this method when the names of each frame from the atlas share a common prefix and postfix (e.g. "walk00.png", "walk01.png"). Leading zeroes are ignored for matching indices (5 will match "5" and "005"). * The animation must already exist in order to append frames to it. FrameRate and Looped are unchanged. *
Name | What the existing _animations is called (e.g. "run"). * |
Prefix | Common beginning of image names in atlas (e.g. "tiles-") * |
Indices | An array of numbers indicating what frames to append (e.g. 1, 2, 3). * |
Postfix | Common ending of image names in atlas (e.g. ".png") |
function appendByNames(Name:String, FrameNames:Array<String>):Void
Adds to an existing _animations in the sprite by appending the specified frames to the existing frames. * Use this method when the exact name of each frame from the atlas is known (e.g. "walk00.png", "walk01.png"). * The animation must already exist in order to append frames to it. FrameRate and Looped are unchanged. *
Name | What the existing _animations is called (e.g. "run"). * |
FrameNames | An array of image names from atlas indicating what frames to append. |
function appendByPrefix(Name:String, Prefix:String):Void
Adds to an existing _animations in the sprite by appending the specified frames to the existing frames. * Use this method when the names of each frame from the atlas share a common prefix (e.g. "walk00.png", "walk01.png"). Frames are sorted numerically while ignoring postfixes (e.g. ".png", ".gif"). * The animation must already exist in order to append frames to it. FrameRate and Looped are unchanged. *
Name | What the existing _animations is called (e.g. "run"). * |
Prefix | Common beginning of image names in atlas (e.g. "tiles-") |
function appendByStringIndices(Name:String, Prefix:String, Indices:Array<String>, Postfix:String):Void
Adds to an existing _animations in the sprite by appending the specified frames to the existing frames. Should works a little bit faster than appendByIndices(). * Use this method when the names of each frame from the atlas share a common prefix and postfix (e.g. "walk00.png", "walk01.png"). * The animation must already exist in order to append frames to it. FrameRate and Looped are unchanged. *
Name | What the existing _animations is called (e.g. "run"). * |
Prefix | Common beginning of image names in atlas (e.g. "tiles-") * |
Indices | An array of strings indicating what frames to append (e.g. "01", "02", "03"). * |
Postfix | Common ending of image names in atlas (e.g. ".png") |
function callback(:String, :Int, :Int):Void
If assigned, will be called each time the current frame changes. * A function that has 3 parameters: a string name, a frame number, and a frame index.
function get(Name:String):FlxAnimation
Gets an animation by name *
Name | The name of the animation. * |
returns | Animation FlxAnimation object with the specified name. |
function getFrameIndex(Frame:FlxFrame):Int
Helper function used for finding index of FlxFrame in _framesData's frames array *
Frame | FlxFrame to find * |
returns | position of specified FlxFrame object. |
function play(AnimName:String, ?Force:Bool = false, ?Frame:Int = 0):Void
Plays an existing animations (e.g. "run"). * If you call an animations that is already playing it will be ignored. *
AnimName | The string name of the _animations you want to play. * |
Force | Whether to force the _animations to restart. * |
Frame | The frame number in _animations you want to start from (0 by default). If you pass negative value then it will start from random frame |
function randomFrame():Void
Tell the sprite to change to a random frame of _animations * Useful for instantiating particles or other weird things.