VAULT
INTERACTION_062CSS + JS
Letter Explosion And Assembly
Characters burst outward then reassemble into the word.
Letters / MediumView
Characters skew and wobble like type on a moving surface. Unskewed characters before the trigger; applying alternating skewY and translateY offsets along the word once hover, or a slow ambient loop while in view.
/* Liquid Letter Distortion — Characters skew and wobble like type on a moving surface. */
.liquid-letter-distortion {
--dur: 3s;
--ease: ease-in-out;
--stagger: 60ms;
will-change: transform, opacity;
}
.liquid-letter-distortion > * {
opacity: 0;
transform: translateY(14px);
animation: liquid-letter-distortion-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* unskewed characters -> applying alternating skewY and translateY offsets along the word */
@keyframes liquid-letter-distortion-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.liquid-letter-distortion > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Liquid Letter Distortion — trigger: hover, or a slow ambient loop while in view */
export function LiquidLetterDistortion({ 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="liquid-letter-distortion" data-state="out">
{children}
</div>
);
}Characters burst outward then reassemble into the word.
Characters fade in one by one to draw the eye across the word.
Characters flip on the X axis like a departure board.
Characters sharpen from a heavy blur into crisp type.