Skip to content

Animations ​

Every animation function Vizzy exposes. All are passed to play(), which returns a promise you can await.

Fade ​

FunctionSignatureDescription
fadeInfadeIn(shape, { shift?, duration?, easing? })Fade shape in from transparent. Adds shape to scene automatically.
fadeOutfadeOut(shape, { duration?, easing? })Fade shape out to transparent.

Creation ​

FunctionSignatureDescription
createcreate(shape, { duration?, easing? })Progressively draw the shape's stroke, as if tracing with a pen.

Movement ​

FunctionSignatureDescription
animateShiftanimateShift(shape, [dx, dy], { duration?, easing? })Relative translation from current position.
animateMoveToanimateMoveTo(shape, [x, y], { duration?, easing? })Absolute translation to a destination.

Transform ​

FunctionSignatureDescription
animateRotateanimateRotate(shape, angle, { duration?, easing? })Rotate by angle in radians.
animateScaleanimateScale(shape, factor, { duration?, easing? })Scale uniformly (1 = no change).

Style ​

FunctionSignatureDescription
animateColoranimateColor(shape, { stroke?, fill?, duration?, easing? })Smooth color transition for stroke and/or fill.
animateOpacityanimateOpacity(shape, target, { duration?, easing? })Fade to a specific opacity (0–1).

Custom ​

FunctionSignatureDescription
duringduring(callback, { duration?, easing? })Run callback(t) every frame while other animations play. Useful for live labels, computed positions.
makeAnimationmakeAnimation({ apply, duration?, easing? })Low-level primitive to build custom animation types.

Playback ​

FunctionSignatureDescription
playplay(...animations, options?)Run animations, returns a promise. Multiple args run simultaneously.
waitwait(seconds)Pause for a duration.

Sequential vs simultaneous:

typescript
// Simultaneous - all at once
await play(fadeIn(a), fadeIn(b));

// Sequential - one after another
await play(fadeIn(a));
await play(fadeIn(b));

Options ​

All animations accept the same options object:

OptionDefaultDescription
duration1Length in seconds.
easingsmoothEasing function (see below).

Easing functions ​

NameCurve
linearConstant speed.
easeInQuad, easeInCubic, easeInSineStart slow, accelerate.
easeOutQuad, easeOutCubic, easeOutSineStart fast, decelerate.
easeInOutQuad, easeInOutCubic, easeInOutSineSlow at both ends.
smoothHermite smoothstep (default).
smootherKen Perlin's smootherstep.

Quad is mildest (t²), cubic is stronger (t³), sine is the most gradual.

See the Animations guide for worked examples.