Skip to main content

Function: prepareNumericTween()

prepareNumericTween<T>(target, to): (t) => void

Defined in: tween/prepare.ts:17

Snapshots the current numeric property values on target for the keys present in to, then returns a lerp callback that writes interpolated values back each frame.

The snapshot is taken at call time, so invoke this immediately before the animation starts (not lazily) to capture the correct from state.

Type Parameters

T

T extends object

Parameters

target

T

The object whose properties will be animated.

to

Partial<Record<keyof T, number>>

Desired end values keyed by property name. Keys with undefined values are ignored.

Returns

A function (t: number) => void that writes lerp(from, to, t) for each key. t must already be eased by the caller.

(t) => void