Back to library
INTERACTION_071

Headline Zoom Transition.

The headline scales up slightly as the section takes focus. Scaled to 0.92 at 0 opacity before the trigger; scaling to 1 while fading in once the section crosses 30% of the viewport.

CATEGORY
Headlines
COMPLEXITY
Easy
TECH
CSS
PLATFORM
Both
PERFORMANCE
Light
LIVE PLAYGROUND
SHIPFASTER
CSS / CSS
/* Headline Zoom Transition — The headline scales up slightly as the section takes focus. */
.headline-zoom-transition {
  --dur: 780ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --stagger: 60ms;
  will-change: transform, opacity;
}

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

/* scaled to 0.92 at 0 opacity -> scaling to 1 while fading in */
@keyframes headline-zoom-transition-in {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

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

/** Headline Zoom Transition — trigger: the section crosses 30% of the viewport */
export function HeadlineZoomTransition({ 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="headline-zoom-transition" data-state="out">
      {children}
    </div>
  );
}

IF YOU LIKE THIS, STEAL THESE TOO.

HEADLINE
INTERACTION_066CSS

Animated Headline Underline

A precise 2px rule draws itself under the headline.

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
SHIPFASTER
INTERACTION_064CSS + JS

Pinned Headline Transformation

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

Headlines / MediumView
BUILT FOR
FOUNDERSDESIGNERS
INTERACTION_067CSS

Changing Emphasis Word

The emphasised word cycles through audiences or outcomes.

Headlines / LightView