'use client'; import React from 'react'; import { motion, Variants } from 'framer-motion'; interface MotionTextRevealProps { text: string; className?: string; highlightWords?: string[]; highlightClassName?: string; delay?: number; stagger?: number; as?: 'h1' | 'h2' | 'h3' | 'h4' | 'p' | 'span'; } /** * Animate UI - Motion Text Reveal * Staggered word-by-word 3D kinetic entrance animation with blur-to-sharp physics. * Reference: https://animate-ui.com/docs */ export function MotionTextReveal({ text, className = '', highlightWords = [], highlightClassName = 'text-transparent bg-clip-text bg-gradient-to-r from-blue-700 via-indigo-600 to-purple-600', delay = 0.1, stagger = 0.045, as: Component = 'span', }: MotionTextRevealProps) { const words = text.split(' '); const containerVariants: Variants = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { staggerChildren: stagger, delayChildren: delay, }, }, }; const wordVariants: Variants = { hidden: { opacity: 0, y: 28, rotateX: -35, filter: 'blur(8px)', scale: 0.94, }, visible: { opacity: 1, y: 0, rotateX: 0, filter: 'blur(0px)', scale: 1, transition: { type: 'spring', damping: 18, stiffness: 140, mass: 0.8, }, }, }; return ( {words.map((word, idx) => { const isHighlight = highlightWords.some( (hw) => word.toLowerCase().includes(hw.toLowerCase()) ); return ( {word} ); })} ); }