MAKE IT
FEEL PREMIUM.
INTERACTION_036CSS
Clip Path Heading Reveal
A heading wipes into view as its clip rectangle opens left to right.
Text / LightView
Characters cycle through symbols before locking into the real word. The final string replaced by random glyphs before the trigger; resolving characters left to right, three random glyphs per character once the element enters view or is hovered.
/* Decoding Text — Characters cycle through symbols before locking into the real word. */
.decoding-text {
--dur: 900ms;
--ease: cubic-bezier(0.22, 1, 0.36, 1);
--stagger: 60ms;
will-change: transform, opacity;
}
.decoding-text > * {
opacity: 0;
transform: translateY(14px);
animation: decoding-text-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* the final string replaced by random glyphs -> resolving characters left to right, three random glyphs per character */
@keyframes decoding-text-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.decoding-text > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Decoding Text — trigger: the element enters view or is hovered */
export function DecodingText({ 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="decoding-text" data-state="out">
{children}
</div>
);
}A heading wipes into view as its clip rectangle opens left to right.
One word in a sentence rolls over like a split-flap counter.
Oversized type scales and drifts in opposing directions for a poster feel.
The whole string shuffles and settles like a mechanical board.