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 |
|---|
Variables
trackData:StringMap<StringMap<FoxTrackData>> = new StringMap()
Stores cached interpolated values for all animation tracks per animation
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.
Methods
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 |
getTrackValue(name:String):Any
Gets the interpolated track value from a currently active animation.
Warning! Can be null if no animation is playing.
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.
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) |
|---|