"use client";
import { motion, useReducedMotion } from "motion/react";
type BlurCascadeProps = {
text: string;
className?: string;
/** Seconds between one word and the next. */
stagger?: number;
/** Starting blur, in pixels. */
blur?: number;
/** Play only the first time it scrolls into view. */
once?: boolean;
};
/* BlurCascade: words drift up out of a blur one after another, like a lens finding focus. */
export function BlurCascade({ text, className = "", stagger = 0.08, blur = 12, once = true }: BlurCascadeProps) {
const reduce = useReducedMotion();
if (reduce) return {text};
const words = text.split(" ");
return (
{text}
{words.map((word, i) => (
({
opacity: 1,
y: 0,
filter: "blur(0px)",
transition: { duration: 0.8, delay: n * stagger, ease: [0.22, 1, 0.36, 1] },
}),
}}
>
{word}
{i < words.length - 1 && " "}
))}
);
}