Skip to main content

Methods

note

All Module methods are available in this class.

lerpFactor

Calculates a linear interpolation factor to make animations run the same regardless of FPS.

See demo

// lerpFactor() calculates an FPS-independent interpolation coefficient.
// Use it to make animations feel consistent across 60Hz, 120Hz, and 144Hz displays.
const ease = raf.lerpFactor(0.1);

lerp(from, to, ease);

pause

Pauses the animation loop.

raf.pause();

play

Starts the animation loop.

raf.play();

destroy

Destroys the instance and cleans up resources.

raf.destroy();