跳转到内容

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.

M extends AnimatorMotion = AnimatorMotion

optional apply(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.

MotionContext

M

boolean

void


optional duration(ctx, motion): number

Defined in: animation/motion.ts:155

One pass in seconds. Absent, or 0, means the motion does not say.

MotionContext

M

number


optional events(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.

MotionContext

M

MotionSpan

MotionEvent[]

void


optional isFinished(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.

MotionContext

M

boolean


optional loops(ctx, motion): boolean

Defined in: animation/motion.ts:157

Whether the motion repeats. A looping motion never finishes.

MotionContext

M

boolean


optional rootMotion(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.

MotionContext

M

MotionSpan

RootMotionDelta

boolean


optional sample(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.

MotionContext

M

number

Pose

boolean