Try 'magnetic button'
View code

Number 41: Masked headline reveal

Specification

Catalogue
No. 41 of 110
Interaction
Text Animation, Autoplay
Preview
Live component
Imports
react 19.3.1
Added

Notes

Each word rises out of its own mask with a slight rotation that settles to level, staggered by 70ms across both lines. The masks have a little bottom padding so descenders are not clipped at rest.

The small line above and the call to action below fade in on the same curve, with the button arriving after the headline has landed.

The headline is fully visible without the animation. The animation is only added while it plays, so a slow device or reduced motion shows the finished state.

Code

React and plain CSS
"use client";

import { useState, type CSSProperties } from "react";
import type { LivePreviewProps } from "@/components/live/types";
import styles from "./headline-reveal.module.css";

const LINES = [["Quiet", "websites"], ["for", "loud", "ideas."]];
/** Index of each line's first word, so the stagger runs across both lines. */
const OFFSETS = LINES.map((_, l) => LINES.slice(0, l).flat().length);

export default function HeadlineReveal({ active, context }: LivePreviewProps) {
  const [run, setRun] = useState(0);
  const demo = active && context === "card";

  // In a card the reveal replays each time the card becomes active.
  const [demoRunning, setDemoRunning] = useState(demo);
  if (demoRunning !== demo) {
    setDemoRunning(demo);
    if (demo) setRun((r) => r + 1);
  }

  const playing = context === "detail" || demo;

  return (
    <div className={styles.root}>
      <div key={run} className={styles.stage} data-playing={playing || undefined}>
        <p className={styles.kicker}>Studio for brands that move</p>
        <h3 className={styles.title}>
          {LINES.map((line, l) => (
            <span key={l} className={styles.line}>
              {line.map((w, i) => (
                <span key={w} className={styles.mask}>
                  <span className={styles.word} style={{ "--w": (OFFSETS[l] ?? 0) + i } as CSSProperties}>
                    {w}
                  </span>
                </span>
              ))}
            </span>
          ))}
        </h3>
        <div className={styles.footer}>
          <span className={styles.cta}>See our work</span>
          <span className={styles.meta}>Booking from spring</span>
        </div>
      </div>
      {context === "detail" && (
        <button type="button" className={styles.replay} onClick={() => setRun((r) => r + 1)}>
          Replay
        </button>
      )}
    </div>
  );
}

More like this

Living watercolour wash

AutoplayPage sections

Sweeping headline phrase

Text AnimationText and code

Statement that reads with the scroll

Scroll, Text AnimationText and code

Sign-up that hands over the next issue

Type, FeedbackForms and inputs

Video poster that opens the player

Press, Layout AnimationMedia and galleries

Hand-drawn emphasis

Text AnimationText and code