VAULT
INTERACTION_050CSS + JS
Scattered Letters Assemble
Characters fly in from random offsets and lock into the word.
Letters / LightView
Characters lift and brighten as the pointer passes over them. Flat baseline, uniform weight before the trigger; lifting and brightening characters by falloff distance from the pointer once pointer movement within 120px of a character.
/* Cursor Reactive Letters — Characters lift and brighten as the pointer passes over them. */
.cursor-reactive-letters {
--dur: 260ms;
--ease: cubic-bezier(0.22, 1, 0.36, 1);
--stagger: 60ms;
will-change: transform, opacity;
}
.cursor-reactive-letters > * {
opacity: 0;
transform: translateY(14px);
animation: cursor-reactive-letters-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* flat baseline, uniform weight -> lifting and brightening characters by falloff distance from the pointer */
@keyframes cursor-reactive-letters-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.cursor-reactive-letters > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Cursor Reactive Letters — trigger: pointer movement within 120px of a character */
export function CursorReactiveLetters({ 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="cursor-reactive-letters" data-state="out">
{children}
</div>
);
}Characters fly in from random offsets and lock into the word.
Characters flip on the X axis like a departure board.
Each character rolls up inside its own clipped slot.
Characters are pulled toward the cursor then spring back.