VAULT
INTERACTION_048CSS
Character Wave
A slow sine wave travels through the characters of a word.
Letters / LightView
Each character rolls up inside its own clipped slot. The original character visible, the duplicate one row below before the trigger; translating the pair up by one row height once hover on desktop, entry on touch.
/* Vertical Character Roll — Each character rolls up inside its own clipped slot. */
.vertical-character-roll {
--dur: 420ms;
--ease: cubic-bezier(0.22, 1, 0.36, 1);
--stagger: 22ms;
will-change: transform, opacity;
}
.vertical-character-roll > * {
opacity: 0;
transform: translateY(14px);
animation: vertical-character-roll-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* the original character visible, the duplicate one row below -> translating the pair up by one row height */
@keyframes vertical-character-roll-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.vertical-character-roll > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Vertical Character Roll — trigger: hover on desktop, entry on touch */
export function VerticalCharacterRoll({ 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="vertical-character-roll" data-state="out">
{children}
</div>
);
}A slow sine wave travels through the characters of a word.
Characters fly in from random offsets and lock into the word.
Characters flip on the X axis like a departure board.
Characters lift and brighten as the pointer passes over them.