Skip to content

Documentation / Animatable / createAnimation

createAnimation() ​

ts
function createAnimation<Init>(init, timing): Animation<Init>;

Defined in: Animate/Animatable.ts:138

Creates an animation info object, automatically inferring type from the init object.

Type Parameters ​

Init ​

Init extends Animatable<unknown>

Parameters ​

init ​

Init

The initial state of the animation

timing ​

Interp

The timing function. See Interp for some common timing functions.

Returns ​

Animation<Init>

The animation info object.

Example ​

ts
const anim = createAnimation({ a: 0, b: 0 }, getLinearInterp(1), {
 upper: { a: 1, b: 1 },
 lower: { a: -1, b: -1 },
})