MotionDriver
Defined in: animation/motion.ts:140
How one kind of motion is played. A driver supplies EITHER sample — stating
values for something else to compose — or apply, for a motion that can only
be switched to, a sprite sheet having no meaning halfway between two clips.
Only a motion that states values without writing them can be blended.
Type Parameters
Section titled “Type Parameters”M extends AnimatorMotion = AnimatorMotion
Methods
Section titled “Methods”apply()?
Section titled “apply()?”
optionalapply(ctx,motion,enter):void
Defined in: animation/motion.ts:146
Drive motion on the context’s entity. Called every frame the state is
active, so a driver must be idempotent in steady state; enter is true
only on the frame the state was entered, and means restart from the top.
Parameters
Section titled “Parameters”motion
Section titled “motion”M
boolean
Returns
Section titled “Returns”void
duration()?
Section titled “duration()?”
optionalduration(ctx,motion):number
Defined in: animation/motion.ts:155
One pass in seconds. Absent, or 0, means the motion does not say.
Parameters
Section titled “Parameters”motion
Section titled “motion”M
Returns
Section titled “Returns”number
events()?
Section titled “events()?”
optionalevents(ctx,motion,span,out):void
Defined in: animation/motion.ts:164
Append every event motion crossed over span to out, in the order the
clip declares them. Wrapping belongs here for the same reason sampling does:
only the driver knows how long its clip runs and whether it repeats, and a
caller differencing two absolute times cannot tell a loop from a rewind.
Parameters
Section titled “Parameters”motion
Section titled “motion”M
Returns
Section titled “Returns”void
isFinished()?
Section titled “isFinished()?”
optionalisFinished(ctx,motion):boolean
Defined in: animation/motion.ts:176
Whether the motion has ended — what gates a hasExitTime transition. For
a driver whose end is no clock the animator keeps (a sprite clip, a spine
track); one reporting a duration is judged on the animator’s own time.
Absent answers false: a transition that never fires is the visible failure.
Parameters
Section titled “Parameters”motion
Section titled “motion”M
Returns
Section titled “Returns”boolean
loops()?
Section titled “loops()?”
optionalloops(ctx,motion):boolean
Defined in: animation/motion.ts:157
Whether the motion repeats. A looping motion never finishes.
Parameters
Section titled “Parameters”motion
Section titled “motion”M
Returns
Section titled “Returns”boolean
rootMotion()?
Section titled “rootMotion()?”
optionalrootMotion(ctx,motion,span,out):boolean
Defined in: animation/motion.ts:169
How far motion asks to move over span, into out. False when the motion
states no root motion — which is not the same as stating none this frame.
Parameters
Section titled “Parameters”motion
Section titled “motion”M
Returns
Section titled “Returns”boolean
sample()?
Section titled “sample()?”
optionalsample(ctx,motion,time,pose):boolean
Defined in: animation/motion.ts:153
Evaluate motion at time seconds into pose, writing no component;
wrapping belongs here, only the driver knowing how long its clip runs.
Returns whether anything was sampled — a composite whose chosen child
cannot be must answer false, or the caller takes silence for a pose.
Parameters
Section titled “Parameters”motion
Section titled “motion”M
number
Pose
Returns
Section titled “Returns”boolean