Travelling highlight

Guides the eye around a screen, one part at a time.

Rendered video, with motion blur.

0.00 / 5.80 s

Live preview, driven by the code below. No motion blur.

What it does

A highlight ring and camera glide together between parts.

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.

FactValue
Purpose
Emphasis
Acts on
Window
Typical length
0.65 s (20 frames at 30 fps), per glide, plus about 1.5 s per stop
Caution
One highlight at a time, and never scroll while it glides.
PropertyValue
Glide
0.65 s per move
Hold
About 1.5 s per stop
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 travellingHighlight(t: number, stops = 3, hold = 1.5) {
  const leg = Math.min(stops - 1, Math.floor(Math.max(0, t) / (0.65 + hold)));
  const k = leg === stops - 1 ? 0 : easeInOut(phase(t, leg * (0.65 + hold) + hold, 0.65));
  return { position: leg + k };
}

Best practices

Use it forAvoid
A screen tour
Two highlights
One focal part at a time
A simultaneous scroll

Reduced motion: a simple opacity fade over 0.2 s.