Back to library
INTERACTION_073

Scroll Controlled Headline Sequence.

Three headlines swap in a pinned frame driven purely by scroll. The first headline visible, the rest at 0 opacity before the trigger; cross-fading and lifting between headlines at each third of progress once scroll progress through the pinned section.

CATEGORY
Headlines
COMPLEXITY
Advanced
TECH
CSS + JS
PLATFORM
Both
PERFORMANCE
Medium
LIVE PLAYGROUND
BUILT FOR
FOUNDERSDESIGNERS
CSS / CSS
/* Scroll Controlled Headline Sequence — Three headlines swap in a pinned frame driven purely by scroll. */
.scroll-controlled-headline-sequence {
  --dur: scroll-linked;
  --ease: linear;
  --stagger: 60ms;
  will-change: transform, opacity;
}

.scroll-controlled-headline-sequence > * {
  opacity: 0;
  transform: translateY(14px);
  animation: scroll-controlled-headline-sequence-in var(--dur) var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}

/* the first headline visible, the rest at 0 opacity -> cross-fading and lifting between headlines at each third of progress */
@keyframes scroll-controlled-headline-sequence-in {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-controlled-headline-sequence > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
React / TSX
import { useEffect, useRef } from "react";

/** Scroll Controlled Headline Sequence — trigger: scroll progress through the pinned section */
export function ScrollControlledHeadlineSequence({ children }: { children: React.ReactNode }) {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current;
    if (!el) return;
    if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
      el.dataset["state"] = "in";
      return;
    }
    const io = new IntersectionObserver(
      ([entry]) => {
        if (entry?.isIntersecting) {
          el.dataset["state"] = "in";
          io.unobserve(el);
        }
      },
      { threshold: 0.2 },
    );
    io.observe(el);
    return () => io.disconnect();
  }, []);

  return (
    <div ref={ref} className="scroll-controlled-headline-sequence" data-state="out">
      {children}
    </div>
  );
}

IF YOU LIKE THIS, STEAL THESE TOO.

SHIPFASTER
INTERACTION_064CSS + JS

Pinned Headline Transformation

A pinned headline changes scale and wording as the section scrolls.

Headlines / MediumView
HEADLINE
INTERACTION_066CSS

Animated Headline Underline

A precise 2px rule draws itself under the headline.

Headlines / LightView
SHIPFASTER
INTERACTION_071CSS

Headline Zoom Transition

The headline scales up slightly as the section takes focus.

Headlines / LightView
SPLIT LINE
HERO REVEAL.
INTERACTION_063CSS

Split Line Hero Reveal

The hero headline arrives line by line from behind its own masks.

Headlines / LightView