easing
Import from @pierre/ecs/modules/easing.
The standard Robert Penner easing curves — pure, domain-free, zero-dependency functions that reshape normalized time.
type Easing = (t: number) => number; // t ∈ [0,1] → eased progressCompose an easing with a value interpolation (lerp from
modules/math, or the modules/tween
primitive which does this for you):
import { easeOutCubic } from '@pierre/ecs/modules/easing';import { lerp } from '@pierre/ecs/modules/math';
const value = lerp(from, to, easeOutCubic(t));Curves
Section titled “Curves”Every family ships easeIn*, easeOut*, easeInOut*, plus linear:
linear · Quad · Cubic · Quart · Quint · Sine · Expo · Circ ·
Back · Elastic · Bounce (31 functions total).
easeIn*accelerates from rest;easeOut*decelerates to rest;easeInOut*is symmetric (exactly0.5att = 0.5).- All pin
f(0) = 0andf(1) = 1. BackandElasticdeliberately overshoot[0, 1](anticipation / spring). Composeclamp01frommodules/mathif your target can’t exceed its bounds.
import { easeOutBack, easeInOutSine } from '@pierre/ecs/modules/easing';
// Pop-in with a little overshoot:sprite.scale = lerp(0, 1, easeOutBack(progress));
// Smooth camera bob:camera.y = lerp(low, high, easeInOutSine(progress));Import via @pierre/ecs/modules/easing. Depends on nothing.