No.298 · Text Animations
Weight Wave
A headline in a variable font where weight moves: left alone, a slow wave of weight breathes along the line; bring the pointer close and it becomes a lens, swelling the nearest letters to their heaviest and easing them back to hairline as you pass.
The prompt
Written for the variant you picked above: Night
Build a headline ("Feel every letter", Hanken Grotesk variable, clamp(3rem, 11vw, 9rem), centred, words kept whole) whose per-letter weight is animated between 220 and 900. Each letter is a span. Measure every letter's centre once at the resting weight (host-local, corrected for scaled hosts) and cache it, re-measuring on resize and fonts.ready — so the reflow caused by changing weights never moves the lens itself. One rAF loop (paused offscreen via IntersectionObserver and when the tab is hidden): an idle wave weight = min + 0.62·(max − min)·((0.5 + 0.5·sin(1.85t − 0.42i))^2.2), a crest travelling along the line; and a pointer lens weight = min + (max − min)·exp(−(dx² + dy²)/2) with dx, dy scaled by 1.05em and 0.9em. A "near" factor eases between the two (rate 5/s) as the pointer arrives or leaves, and each letter's weight eases to its target (rate 14/s). Each letter also gets --w (0–1) so heavier letters carry more ink (opacity from 62% to 100%). Touch: pointer events with touch-action: pan-y, so dragging a finger sideways works and a lift lets go. Reduced motion: a fixed middle weight, no loop. The h2 carries the text; letter spans are aria-hidden. Selected variant — Night: theme="night": ivory letters (#f2eee6) on #0b0b0d; light letters at 62% opacity.
Notes
- Interaction
- Move the pointer (or drag a finger) across the words.
- Motion
- Idle travelling wave (~3.4s); lens with a Gaussian falloff; weights ease at 14/s.
- Accessibility
- The heading carries the text; the letters are aria-hidden spans. Reduced motion holds a fixed weight. Opacity never drops below 50%.
- Responsive
- Type is fluid (11vw) and wraps between words, never inside one.
- On touch
- Drag a finger sideways across the words to move the lens.