Constructor

new(?library:Dynamic)

Creates a new animation player. This interpolates tracks from a FoxAnimation and handles property linking for any object.

Parameters:

library

Either a single FoxAnimation or a StringMap containing multiple FoxAnimation for the player's library

Variables

@:value(new StringMap())library:Map<String, FoxAnimation> = new StringMap()

@:value(false)playing:Bool = false

@:value(0)time:Float = 0

@:value(1)timeScale:Float = 1

@:value(false)reverse:Bool = false

@:value(new StringMap())trackData:StringMap<StringMap<FoxTrackData>> = new StringMap()

Stores cached interpolated values for all animation tracks per animation

@:value(true)fineTuned:Bool = true

If enabled, will ensure the animation plays smoothly if keyframes are too close together. For more details, check fineTune(). Disable this if performance is unacceptable.

private@:value(false)__reset:Bool = false

private@:value(true)__playFrame:Bool = true

@:value(new FlxTypedSignalImpl())onLoop:FlxTypedSignalImpl<() ‑> Void> = new FlxTypedSignalImpl()

@:value(new FlxTypedSignalImpl())onFinish:FlxTypedSignalImpl<() ‑> Void> = new FlxTypedSignalImpl()

@:value(new FlxTypedSignalImpl())onUpdate:FlxTypedSignalImpl<() ‑> Void> = new FlxTypedSignalImpl()

Methods

@:value({ seekIndex : -1, continuousCall : false })interpolateTracks(time:Float, direction:Int, animation:FoxAnimation, trackDst:Map<String, FoxTrackData>, continuousCall:Bool = false, seekIndex:Int = -1):Void

Interpolates track values for an animation with data over time.

Can be used to update other animations offline.

Parameters:

time

The current time for the track, this determines the result values

direction

The direction for keyframe interpolation (1: forwards, -1: backwards)

animation

The animation object for tracks source

trackDst

The tracks that will recieve the interpolated values

seekIndex

If greater than -1, will set frame index to that index. Mainly used for track looping

continuousCall

If true, will signal the interpolator to call function tracks every frame

removeAnimation(name:String):Void

getTrackValue(name:String):Any

Gets the interpolated track value from a currently active animation.

Warning! Can be null if no animation is playing.

play(name:String, ?from:Float, ?reversed:Bool):Void

fineTune(data:FoxTrackData, frames:Array<FoxKeyframe<Any>>, time:Float, direction:Int, duration:Float):Int

Fine-tunes a frame index to always interpolate between two timestamps for a current play time.

This ensures the animation plays smoothly and doesn't hold onto a keyframe if they're too close together until the next frame.

@:value({ forceUpdate : false })seek(seekTime:Float, forceUpdate:Bool = false):Void

Seeks the animation to a particular time. This has the same effect as setting time directly, with a bit extra safety.

Parameters:

forceUpdate

Forces the animation to update right away (values will interpolate and functions may be called)

stop():Void

pause():Void

resume():Void

queryReset():Void

getTrack(name:String):Any

Inherited Variables

Defined by FoxAnimationLinker

@:value(new StringMap())linkData:Map<String, Array<FoxTrackLinkData>> = new StringMap()

Defined by FoxBasic

@:value("FoxBasic")name:String = "FoxBasic"

@:value(true)visible:Bool = true

@:value(true)active:Bool = true

@:value(null)scene:FoxScene = null

@:value(false)__destroyed:Bool = false

animation:FoxAnimationPlayer

An animation controller for this basic. Although properties have to be manually linked, this is intended to be a general-purpose animator for this object

Inherited Methods

Defined by FoxAnimationLinker

link(trackName:String, object:Dynamic, property:String):Int

Links an object's property to an animation track, thus causing it to animate.

Functions work aswell! In that case, the number of components of a vector will serve as arguments: For example FlxSprite.setPosition() will recieve the Vector2 x and y.

The only exception to this is tracks of type Matrix3D, they will recieve the matrix object instead.

Note: For non-functions, make sure the property type and the track type are equal, else the link will not work.

Returns:

The index of the link in the track

unlink(trackName:String, object:Dynamic, property:String):Void

Removes an object's property from a linked animation track.

unlinkByIndex(trackName:String, index:Int):Void

Removes a link from an animation track by its index

unlinkAllOf(object:Dynamic, ?property:String, ?trackName:String):Void

Removes all links of an object from the linker.

Parameters:

property

(Optional) A property name which will act as a filter, and will only remove links affecting that property.

trackName

(Optional) If set, it will remove all links from that track only.

linkSkin(skin:FoxSkinData):Void

Links all supported tracks to a FoxSkinData

Tracks with the name following the format boneName:property will be linked. Supported properties are position, rotation and scale

linkObject(trackPrefix:String, object:FoxObject):Void

Links a FoxObject's transforms to this track data

unlinkObject(trackPrefix:String, object:FoxObject):Void

findLink(trackName:String, object:Dynamic, property:String):Int

Searches for a link for a track and returns its index on the linker

clearLinks():Void

updateLink(trackSrc:Map<String, FoxTrackData>):Void

Sends tracks value to the objects with linked properties

Parameters:

trackSrc

The tracks source

Defined by FoxBasic

draw(camera:FoxCamera):Void

Intended for transforms, actual drawing happens in the camera render pass

pushDrawData(scene:FoxScene):Void

This function gets called when the scene starts building draw groups.

It should call the scene's addToDrawGroups() function for every drawable of this object.

Override this with your custom draw data function.

Note: Internal use only, it is a performance critical operation, keep it fast.

privateset_visible(v:Bool):Bool