Skip to content

KeyframeAnimationDef

Defined in: KeyframeAnimator.ts:13

Definition for a named keyframe animation.

T extends Interpolatable = Interpolatable

optional clock?: ProcessClock

Defined in: KeyframeAnimator.ts:48

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:53

Track length in seconds, finite and > 0. Defaults to the last keyframe’s time.


optional easing?: EasingFunction

Defined in: KeyframeAnimator.ts:54


keyframes: Keyframe<T>[]

Defined in: KeyframeAnimator.ts:20

At least 2 keyframes, sorted by time. A track interpolates between control points, so play() throws on fewer than 2.


optional loop?: boolean

Defined in: KeyframeAnimator.ts:49


optional onEnter?: () => void

Defined in: KeyframeAnimator.ts:55

void


optional onExit?: (complete) => void

Defined in: KeyframeAnimator.ts:56

boolean

void


optional speed?: number

Defined in: KeyframeAnimator.ts:51

Playback speed multiplier (default 1). Finite and > 0.

optional setter(value): void

Defined in: KeyframeAnimator.ts:33

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

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/core.md.