SHIPFASTER
INTERACTION_064CSS + JS
Pinned Headline Transformation
A pinned headline changes scale and wording as the section scrolls.
Headlines / MediumView
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.
/* 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;
}
}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>
);
}A pinned headline changes scale and wording as the section scrolls.
A precise 2px rule draws itself under the headline.
The headline scales up slightly as the section takes focus.
The hero headline arrives line by line from behind its own masks.