Skip to content

KeyframeAnimationDef

Defined in: KeyframeAnimator.ts:11

Definition for a named keyframe animation.

T extends Interpolatable = Interpolatable

optional clock?: ProcessClock

Defined in: KeyframeAnimator.ts:40

Clock that advances this animation’s playback (see ProcessClock), default "frame".

"frame" is rendered-frame time, right for setter-driven visuals. "fixed" is the fixed timestep, right for timing that must stay in step with a fixed-step simulation — typically a setter-less timeline whose keyframe event callbacks drive gameplay. The choice is per animation, so one animator can hold a frame-clock walk cycle and a fixed-clock event timeline.

A setter on "fixed" is written on fixed steps, so a rendered frame that runs no fixed step shows the previous value.


optional duration?: number

Defined in: KeyframeAnimator.ts:43


optional easing?: EasingFunction

Defined in: KeyframeAnimator.ts:44


keyframes: Keyframe<T>[]

Defined in: KeyframeAnimator.ts:12


optional loop?: boolean

Defined in: KeyframeAnimator.ts:41


optional onEnter?: () => void

Defined in: KeyframeAnimator.ts:45

void


optional onExit?: (complete) => void

Defined in: KeyframeAnimator.ts:46

boolean

void


optional speed?: number

Defined in: KeyframeAnimator.ts:42

optional setter(value): void

Defined in: KeyframeAnimator.ts:25

Receives the interpolated value on every tick of the animation’s clock — each rendered frame by default. The tick that wraps a looping animation back to time 0 skips the setter, so the previous value holds for one tick. Optional — when omitted the animator only fires keyframe event callbacks (pure-timeline use case).

Declared as a method signature (rather than a (value: T) => void property) so the parameter type is bivariant — this is what lets a Record<string, KeyframeAnimationDef<number>> literal flow into the KeyframeAnimator constructor without per-key casts.

T

void