SPLIT LINE
HERO REVEAL.
INTERACTION_063CSS
Split Line Hero Reveal
The hero headline arrives line by line from behind its own masks.
Headlines / LightView
The emphasised word cycles through audiences or outcomes. The first word visible, the rest stacked below in a clipped slot before the trigger; translating the stack up one slot with a short blur on exit once a 2.8 second interval while in view.
/* Changing Emphasis Word — The emphasised word cycles through audiences or outcomes. */
.changing-emphasis-word {
--dur: 560ms;
--ease: cubic-bezier(0.22, 1, 0.36, 1);
--stagger: 60ms;
will-change: transform, opacity;
}
.changing-emphasis-word > * {
opacity: 0;
transform: translateY(14px);
animation: changing-emphasis-word-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* the first word visible, the rest stacked below in a clipped slot -> translating the stack up one slot with a short blur on exit */
@keyframes changing-emphasis-word-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.changing-emphasis-word > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Changing Emphasis Word — trigger: a 2.8 second interval while in view */
export function ChangingEmphasisWord({ 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="changing-emphasis-word" data-state="out">
{children}
</div>
);
}The hero headline arrives line by line from behind its own masks.
A precise 2px rule draws itself under the headline.
Oversized type scrolls sideways in a continuous loop.
The headline scales up slightly as the section takes focus.