VAULT
INTERACTION_048CSS
Character Wave
A slow sine wave travels through the characters of a word.
Letters / LightView
Characters stretch vertically on entry then relax. Scaled 0.4 on the Y axis with 0 opacity before the trigger; scaling Y back to 1 while fading in once entry into view.
/* Character Stretch — Characters stretch vertically on entry then relax. */
.character-stretch {
--dur: 620ms;
--ease: cubic-bezier(0.22, 1, 0.36, 1);
--stagger: 38ms;
will-change: transform, opacity;
}
.character-stretch > * {
opacity: 0;
transform: translateY(14px);
animation: character-stretch-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* scaled 0.4 on the Y axis with 0 opacity -> scaling Y back to 1 while fading in */
@keyframes character-stretch-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.character-stretch > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Character Stretch — trigger: entry into view */
export function CharacterStretch({ 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="character-stretch" data-state="out">
{children}
</div>
);
}A slow sine wave travels through the characters of a word.
Characters fade in one by one to draw the eye across the word.
Characters overshoot their final position then settle.
Characters sharpen from a heavy blur into crisp type.