BUILT FOR
FOUNDERSDESIGNERS
INTERACTION_073CSS + JS
Scroll Controlled Headline Sequence
Three headlines swap in a pinned frame driven purely by scroll.
Headlines / MediumView
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.
/* 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;
}
}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>
);
}Three headlines swap in a pinned frame driven purely by scroll.
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.