Extended version of Animation with named animation storage and primitive command buffer. Command buffer triggers next command either when delay timeout runs out or animation reaches it's end.

Constructor

new (?frames:Array<AnimationFrame>, ?parent:Object)

Variables

@:value(new Map())animations:Map<String, AnimationDescriptor> = new Map()

List of named animation between which AnimationExt can switch.

read onlycurrentAnimation:String

Current animation name.

Methods

addCommand (cmd:AnimationCommand):Void

Adds new command to the end of command buffer.

durationOf (anim:String):Float

Returns duration of specified animation. Uses either animation descriptor speed, or current Animation speed value.

playAnim (name:String, ?atFrame:Int):Void

Plays animation with specified name, and optionally at specific frame.

resetCommands ():Void

Clears command buffer.

Inherited Variables

Defined by Animation

currentFrame:Int

The current frame the animation is currently playing. Always in [0,frames.length] range

read onlyduration:Float

Duration of current animation. Affected by speed variable, for duration of frame use static getDuration function.

read onlyframes:Array<AnimationFrame>

The current animation, as a list of AnimationFrame instances to display.

read onlyheight:Int

Total height of the animation. Accounts for all frames.

@:value(true)loop:Bool = true

Disabling loop will stop the animation at the last frame (default : true)

@:value(false)pause:Bool = false

Setting pause will pause the animation, preventing any automatic change to currentFrame.

@:value(false)playWhenHidden:Bool = false

Enables playback of animation even when visible = false. (default: false) Does not check for nested visibility.

@:value(1.)speed:Float = 1.

Playback speed multiplier for animation (default : 1)

read onlywidth:Int

Total width of the animation. Accounts for all frames.

Inherited Methods

Defined by Animation

inlinegetFrame ():AnimationFrame

Returns current AnimationFrame being played.

getTile ():Tile

Returns current h2d.Tile being played.

dynamiconAnimEnd ():Void

onAnimEnd is automatically called each time the animation will reach past the last frame. If loop is true, it is called everytime the animation loops. If loop is false, it is called once when the animation reachs currentFrame == frames.length

dynamiconEvent (name:String):Void

Triggers when frame contains event string

@:value({ frame : 0 })palyAt (frame:Int = 0):Void

Starts animation playback at specified frame.

@:value({ atFrame : 0 })play (frames:Array<AnimationFrame>, atFrame:Int = 0):Void

Change the currently playing animation and unset the pause if it was set.