Readonly AdvancedtargetRoot of the hierarchy this player animates
StaticdefaultDefaults for every new AnimationPlayer; an option passed as undefined keeps its default
A Model3D passes its own autoUpdate and autoPlay, so its player follows
Model3D.defaultOptions instead.
Labels of every registered animation, in registration order
Pass one to AnimationPlayer#play or AnimationPlayer#getState.
Whether playback advances on Ticker.shared
Turn it off to drive playback from your own ticker or fixed-step loop with AnimationPlayer#update.
Sets whether playback advances on Ticker.shared
false to call update yourself
Whether AnimationPlayer#destroy has been called on this player
Registers animations for playback
Array entries are keyed by each animation's own label. Record entries are keyed by the record property name.
Stops every animation and takes the player off the ticker for good
Calling it again does nothing, and play and gotoAndStop on an AnimationState kept
from before are ignored. A Model3D destroys its own player; call this for one you built.
Returns a registered animation by label
Registered animation label
The animation, or undefined when nothing is registered under the label
Returns the reusable playback state for an animation without starting playback
Each animation has one state per player, created on first request. Throws for a label nothing
is registered under; AnimationPlayer#getAnimation returns undefined instead.
The animation, or the label it's registered under
The playback state for the animation
Starts or resumes an animation from its state's current time
Animations already playing carry on and blend with it; call AnimationPlayer#stop first to switch from one to another. AnimationState#play covers restarting a one-shot animation that already finished.
The animation, or the label it's registered under
The playback state for the animation
Advances all playing states and applies the blended results to their targets
Runs every frame from Ticker.shared while autoUpdate
is on and something is playing. Call it yourself when driving playback from your own loop.
onComplete and onLoop callbacks run once every pose is applied, so they see this frame's
final pose and may play, stop or seek any state. A state they start begins advancing on the
next update.
Optionalticker: Ticker
The ticker driving this update; its deltaMS sets how far playback
advances. Omitted, one 60 fps frame is assumed.
Plays animations on a Container3D and its children
A Model3D loaded with animations already has one as player. Build your own to play animations authored in code.
Each animation gets one AnimationState per player, holding its time, speed and weight. Any number can play at once. Where two playing states drive the same property through tracks with the same label, the player blends their values by AnimationState#weight, which is how crossfades work. Playback advances on Ticker.shared unless AnimationPlayer#autoUpdate is off.
Example