Count up
Lands one important number, giving it time to count before it stops.
Rendered video, with motion blur.
0
0.00 / 2.40 s
Live preview, driven by the code below. No motion blur.
What it does
A number rises into focus and counts with frame-stepped digits.
Curve
Expo out
Values
S is the frame's short side, 1080 px at 1080p. Unmeasured inputs in the preview are illustrations, not rules.
| Fact | Value |
|---|---|
Purpose | Build, emphasis |
Acts on | Number |
Typical length | 1 to 1.4 s (30 to 42 frames at 30 fps) |
Caution | Step digits once a frame and never blur between them. |
| Property | Value |
|---|---|
Count duration | 1.0 to 1.4 s |
Digits | Step once per frame, never between shutter samples |
Arrival rise | 6.5% S (70 px) |
Arrival blur | 1.1% S (12 px) to 0 |
Handover lift | 8.3% S (90 px) |
Handover blur | 0 to 1.1% S (12 px) |
Colour | Ink |
Export samples | 12; 1 when still |
Code
ts
export const seg = (t: number, a: number, b: number) => Math.max(0, Math.min(1, (t - a) / (b - a)));
export const lerp = (a: number, b: number, k: number) => a + (b - a) * k;
export const out = (k: number) => (k >= 1 ? 1 : 1 - Math.pow(2, -10 * k));
export const io = (k: number) => (k < 0.5 ? 16 * k ** 5 : 1 - Math.pow(-2 * k + 2, 5) / 2);
export const inn = (k: number) => k * k * k;
export const cubicOut = (k: number) => 1 - Math.pow(1 - k, 3);
export const h = (i: number, j: number) => { const x = Math.sin(i * 127.1 + j * 311.7) * 43758.5453; return x - Math.floor(x); };
export const phase = (t: number, start = 0, duration = 0.6) => seg(t, start, start + duration);
export const easeInOut = (p: number) => p < 0.5 ? 4 * p ** 3 : 1 - (-2 * p + 2) ** 3 / 2;
export function countUpFrame(t: number, to = 100, duration = 1.2, fps = 24, handover = duration + 0.8) {
const frameTime = Math.floor(Math.max(0, t) * fps + 1e-8) / fps;
const digitK = out(phase(frameTime, 0, duration));
const k = out(phase(t, 0, duration));
const exit = out(phase(t, handover, 0.4));
return { value: Math.round(to * (t >= duration ? 1 : digitK)), y: 70 * (1 - k) - 90 * exit, blur: 12 * (1 - k) + 12 * exit, opacity: 1 - exit };
}Best practices
| Use it for | Avoid |
|---|---|
One payoff number | Blurring between digits |
Pairing with a trend line | Multiple competing counters |
Reduced motion: a simple opacity fade over 0.2 s.