Progress bar
Show that work is happening and then finished.
Rendered video, with motion blur.
0.00 / 3.00 s
Live preview, driven by the code below. No motion blur.
What it does
A bar fills to 100%, smoothly or in uneven steps, holds full and hands off to a done state.
Curve
Ease in-out cubic
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 |
Acts on | Mark |
Typical length | 1 to 2 s (30 to 60 frames at 30 fps) |
Caution | Fill once to 100% and end on a done state; never loop or overshoot. |
| Property | Value |
|---|---|
Smooth fill | 0 to 100% over 1 to 2 s, ease-in-out cubic |
Stepped fill | 3 to 4 uneven steps, each 0.2 s ease-out cubic, with 0.15 to 0.3 s pauses, when it should feel like real loading |
Full | Hold 0.3 s, then hand off to Checkmark draw or a done state |
Limits | Never overshoot 100% and never loop |
Export samples | 12; 1 when still |
Starting values from research. Measure against a reference before relying on them.
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 progressStepped(t: number, start = 0, steps = [0.3, 0.55, 0.8, 1], pauses = [0.25, 0.15, 0.3]) {
let fill = 0, at = start;
steps.forEach((target, i) => {
const from = i === 0 ? 0 : steps[i - 1] ?? 0;
fill = t >= at ? lerp(from, target, cubicOut(phase(t, at, 0.2))) : fill;
at += 0.2 + (pauses[i] ?? 0);
});
return { fill: Math.min(1, fill) };
}
export const progressSmooth = (t: number, start = 0, duration = 1.5) => ({ fill: easeInOut(phase(t, start, duration)) });
export function checkmarkDraw(t: number, start = 0) {
return { circleScale: cubicOut(phase(t, start, 0.2)), tickDashOffset: 1 - cubicOut(phase(t, start + 0.2, 0.4)) };
}Best practices
| Use it for | Avoid |
|---|---|
Uploads, imports, builds and syncs | Looping or overshooting 100% |
A wait the product really has | Ending without a done state |
Reduced motion: a simple opacity fade over 0.2 s.