Back to library
INTERACTION_064

Pinned Headline Transformation.

A pinned headline changes scale and wording as the section scrolls. Small and centered at the section start before the trigger; scaling the headline and swapping the emphasised word at progress thresholds once scroll progress through the pinned section.

CATEGORY
Headlines
COMPLEXITY
Advanced
TECH
CSS + JS
PLATFORM
Both
PERFORMANCE
Medium
LIVE PLAYGROUND
SHIPFASTER
CSS / CSS
/* Pinned Headline Transformation — A pinned headline changes scale and wording as the section scrolls. */
.pinned-headline-transformation {
  --dur: scroll-linked;
  --ease: linear;
  --stagger: 60ms;
  will-change: transform, opacity;
}

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

/* small and centered at the section start -> scaling the headline and swapping the emphasised word at progress thresholds */
@keyframes pinned-headline-transformation-in {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

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

/** Pinned Headline Transformation — trigger: scroll progress through the pinned section */
export function PinnedHeadlineTransformation({ 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="pinned-headline-transformation" data-state="out">
      {children}
    </div>
  );
}

IF YOU LIKE THIS, STEAL THESE TOO.

BUILT FOR
FOUNDERSDESIGNERS
INTERACTION_073CSS + JS

Scroll Controlled Headline Sequence

Three headlines swap in a pinned frame driven purely by scroll.

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