BUILT FOR
FOUNDERSDESIGNERS
INTERACTION_069CSS
Text Morphing
One phrase blurs and dissolves directly into the next.
Headlines / MediumView
One keyword grows and the rest of the line reflows around it. The keyword at the same size as the rest of the line before the trigger; scaling the keyword and widening its letter spacing once entry into view.
/* Expanding Keyword — One keyword grows and the rest of the line reflows around it. */
.expanding-keyword {
--dur: 640ms;
--ease: cubic-bezier(0.22, 1, 0.36, 1);
--stagger: 60ms;
will-change: transform, opacity;
}
.expanding-keyword > * {
opacity: 0;
transform: translateY(14px);
animation: expanding-keyword-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* the keyword at the same size as the rest of the line -> scaling the keyword and widening its letter spacing */
@keyframes expanding-keyword-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.expanding-keyword > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Expanding Keyword — trigger: entry into view */
export function ExpandingKeyword({ 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="expanding-keyword" data-state="out">
{children}
</div>
);
}One phrase blurs and dissolves directly into the next.
Giant type drifts slower than the content in front of it.
Outlined type with a light gradient travelling around the stroke.
The hero headline arrives line by line from behind its own masks.