Skip to main content

Function: changeSpeed()

changeSpeed(animation, speedFunc, options?): ChangeSpeed

Defined in: animation/speed/index.ts:229

Create a ChangeSpeed animation that modifies playback speed dynamically.

Parameters

animation

Animation

The animation to wrap

speedFunc

SpeedFunction

A function mapping progress (0-1) to speed multiplier

options?

ChangeSpeedOptions

Optional configuration

Returns

ChangeSpeed

A new ChangeSpeed animation

Example

// Slow down at the end for emphasis
changeSpeed(fadeIn(circle), (t) => 1 + (1 - t));

// Speed up in the middle
changeSpeed(rotate(square), (t) => {
const mid = Math.abs(t - 0.5);
return 0.5 + mid * 3; // Slow at edges, fast in middle
});