Easings
import { easeInOutCubic, easeOutQuad } from '@studiometa/js-toolkit/utils';
easeOutQuad(0.5); // 0.75An EasingFunction takes a 0 → 1 progress and returns a shaped 0 → 1 value.
Choosing one
Eight curves, three directions each. Every out and in-out is derived from its in.
Deriving one
createEaseOut(easeIn: EasingFunction): EasingFunction
createEaseInOut(easeIn: EasingFunction): EasingFunctionEvery out and in-out above is one of these applied to its in. Which means a custom curve gets its whole family for two lines:
import { createEaseInOut, createEaseOut, type EasingFunction } from '@studiometa/js-toolkit/utils';
const easeInBack: EasingFunction = (progress) => progress * progress * (2.7 * progress - 1.7);
const easeOutBack = createEaseOut(easeInBack);
const easeInOutBack = createEaseInOut(easeInBack);That is why only the eight in functions are written out and the other sixteen are derived: an out is an in run backwards, and writing it twice is how the two drift apart.
createEaseOut
createEaseOut(easeIn: EasingFunction): EasingFunctionMirror an in curve into its out.
createEaseInOut
createEaseInOut(easeIn: EasingFunction): EasingFunctionCompose an in curve into its symmetric in-out.
Using one
import { easeOutCubic, lerp } from '@studiometa/js-toolkit/utils';
function positionAt(progress) {
return lerp(0, 400, easeOutCubic(progress));
}An easing shapes a progress, so it pairs with a value that already runs 0 → 1: a useScrollProgress() subscriber, or a map() of anything else.
They do not animate
There is no clock here — an easing is a pure function of a progress you already have.
- For a value chasing a target frame by frame, use
damp()orsmoothTo(). - For time-based playback, stagger and sequencing, that is the separate
ui-animationpackage.tweenandanimateare not shipped.
The functions
Each takes a 0 → 1 progress and returns the shaped value.
easeLinear
easeLinear(progress: number): numberThe identity. It exists so a call site can name "no easing" rather than branch on undefined.
easeInQuad
easeInQuad(progress: number): numbereaseOutQuad
easeOutQuad(progress: number): numbereaseInOutQuad
easeInOutQuad(progress: number): numbereaseInCubic
easeInCubic(progress: number): numbereaseOutCubic
easeOutCubic(progress: number): numbereaseInOutCubic
easeInOutCubic(progress: number): numbereaseInQuart
easeInQuart(progress: number): numbereaseOutQuart
easeOutQuart(progress: number): numbereaseInOutQuart
easeInOutQuart(progress: number): numbereaseInQuint
easeInQuint(progress: number): numbereaseOutQuint
easeOutQuint(progress: number): numbereaseInOutQuint
easeInOutQuint(progress: number): numbereaseInSine
easeInSine(progress: number): numbereaseOutSine
easeOutSine(progress: number): numbereaseInOutSine
easeInOutSine(progress: number): numbereaseInCirc
easeInCirc(progress: number): numbereaseOutCirc
easeOutCirc(progress: number): numbereaseInOutCirc
easeInOutCirc(progress: number): numbereaseInExpo
easeInExpo(progress: number): numbereaseOutExpo
easeOutExpo(progress: number): numbereaseInOutExpo
easeInOutExpo(progress: number): number