'use client'; import { cn } from '@workspace/airo-ui/lib/utils'; import { motion, stagger, useAnimate } from 'framer-motion'; import { useEffect } from 'react'; export const TextGenerateEffect = ({ words, className, filter = true, duration = 0.5, }: { words: string; className?: string; filter?: boolean; duration?: number; }) => { const [scope, animate] = useAnimate(); const wordsArray = words.split(' '); useEffect(() => { animate( 'span', { opacity: 1, filter: filter ? 'blur(0px)' : 'none', }, { duration: duration ? duration : 1, delay: stagger(0.2), }, ); // eslint-disable-next-line react-hooks/exhaustive-deps }, [scope.current]); const renderWords = () => { return ( {wordsArray.map((word, idx) => { return ( {word}{' '} ); })} ); }; return (
{renderWords()}
); };