A collection of mathematical easing functions and progress helpers for frame-based animations. Use these to create smooth transitions and custom motion effects.
// Source: https://github.com/nishit-g/tokovo | License: MIT | Copyright 2026 Tokovo contributors
// Provided via justclaw.it.com; keep this notice with the code.
const TAU = Math.PI * 2;
export function clamp01(value: number): number {
return Math.min(1, Math.max(0, value));
}
export function frameProgress(frame: number, startFrame: number, durationInFrames: number): number {
if (durationInFrames <= 0) return frame >= startFrame ? 1 : 0;
return clamp01((frame - startFrame) / durationInFrames);
}
export function easeOutCubic(progress: number): number {
const p = clamp01(progress);
return 1 - Math.pow(1 - p, 3);
}
export function easeInOutSine(progress: number): number {
const p = clamp01(progress);
return -(Math.cos(Math.PI * p) - 1) / 2;
}
export function loopProgress(
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key