AnimationPlayerComponent class

Plays the animations (glTF clips) of the entity's ModelComponent.

Saved, as authored: which clip plays, how fast, whether it loops, whether it plays, and how long a change of clip fades. What plays at run time is kept apart from that and never saved — playingClip, playingSpeed, playingLoop, isPlaying, with the playback position — so an editor that runs the game's systems while a scene is edited saves the scene as it was authored. Call play to change clip, or playBlend for several clips at once (a blend tree's motions, kept in step); the old one fades out over crossfade seconds. release goes back to what was authored. An animator graph drives it through SkeletalAnimationTarget.

Inheritance

Constructors

AnimationPlayerComponent({String clip = '', double speed = 1.0, bool loop = true, bool playing = true, double crossfade = 0.2})
A player starting clip.

Properties

blendClips ↔ List<String>
The clips of the blend playing, or empty for playingClip alone (runtime).
getter/setter pair
blendSpeeds ↔ List<double>
Each of blendClips' own speed (runtime).
getter/setter pair
blendWeights ↔ List<double>
Each of blendClips' weight; they sum to 1 (runtime).
getter/setter pair
clip ↔ String
The clip's name in the model, as authored: what plays until play or playBlend says otherwise; empty shows the rest pose. What plays now is playingClip.
getter/setter pair
componentType → Type
Type identifier for this component
no setterinherited
crossfade ↔ double
Seconds a change of clip blends over.
getter/setter pair
cycles ↔ int
How many times playingClip (or the blend) has looped since it started (runtime).
getter/setter pair
duration ↔ double
playingClip's length in seconds, once its model has loaded (runtime).
getter/setter pair
fade ↔ double
How far the fade has gone: 1 when only what plays now shows (runtime).
getter/setter pair
fadeSeconds → double
The length of the fade under way, seconds (runtime).
no setter
fadingFrom ↔ String
The clip fading out, or empty (runtime).
getter/setter pair
fadingFromBlend ↔ List<String>
The blend fading out, when a blend was playing (runtime).
getter/setter pair
fadingFromLoop ↔ bool
Whether what fades out loops, as playingLoop said when it began to fade; otherwise it holds at its end (runtime).
getter/setter pair
fadingFromPhase ↔ double
Its phase (runtime).
getter/setter pair
fadingFromSpeed ↔ double
The rate what fades out plays at: playingSpeed as it began to fade, or 0 when it was paused (runtime).
getter/setter pair
fadingFromSpeeds ↔ List<double>
Its clips' own speeds (runtime).
getter/setter pair
fadingFromTime ↔ double
Seconds into fadingFrom (runtime).
getter/setter pair
fadingFromWeights ↔ List<double>
Its weights (runtime).
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
isBlending → bool
Whether a blend is playing.
no setter
isDriven → bool
Whether something at run time has taken over from what was authored: a clip or a blend played, a speed, a looping or a pause set.
no setter
isFading → bool
Whether something is fading out.
no setter
isPlaying ↔ bool
Whether time moves (runtime): play and playBlend start it; else playing.
getter/setter pair
loop ↔ bool
Whether the clip starts again at its end (else it holds the last pose), as authored. Whether it does now is playingLoop.
getter/setter pair
phase ↔ double
How far through one cycle the blend is, 0–1: every clip of a blend is played at the same point of its own length, so a walk and a run keep their feet in step (runtime).
getter/setter pair
playing ↔ bool
Whether time moves, as authored. Whether it moves now is isPlaying.
getter/setter pair
playingClip → String
The clip playing (runtime): what play or playBlend chose — while a blend plays (blendClips), the first of them — else clip.
no setter
playingLoop ↔ bool
Whether what plays loops (runtime): what was set here at run time, else loop.
getter/setter pair
playingSpeed ↔ double
The rate playing (runtime): what was set here at run time, else speed.
getter/setter pair
previousPhase ↔ double
phase at the previous update (runtime).
getter/setter pair
previousTime ↔ double
time at the previous update, for drawing between updates (runtime).
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
speed ↔ double
Playback rate as authored: 1 is as made, negative plays backwards. The rate now is playingSpeed.
getter/setter pair
time ↔ double
Seconds into playingClip (runtime).
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAttach(EntityId entityId) → void
Called when this component is added to an entity.
inherited
onDetach(EntityId entityId) → void
Called when this component is removed from an entity.
inherited
play(String name, {double? fade, bool restart = false}) → void
Plays name from its start, fading from what played over fade seconds (crossfade when null; 0 cuts). Asking for the clip already playing does nothing unless restart. The authored clip stays as it is.
playBlend(List<String> clips, List<double> weights, {List<double>? speeds, double? fade}) → void
Plays clips together, weighted by weights (see setBlendWeights) and kept in step, fading from what played over fade seconds.
release({double? fade}) → void
Lets go of everything set at run time — the clip or blend played, the speed, the looping, a pause — and plays what was authored from its start, fading from what played over fade seconds (crossfade when null; 0 cuts). What an animator or a timeline does when it lets go of the model.
setBlendWeights(List<double> weights) → void
Changes the playing blend's weights, every update as its parameters move; ignored when no blend plays or the count differs.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited