"use client"; import { useEffect, useState } from "react"; interface GlitchTextProps { text: string; className?: string; speed?: number; glitchColors?: [string, string]; } const GlitchText = ({ text, className = "", speed = 1, glitchColors = ["#00ff99", "#ff0099"], }: GlitchTextProps) => { const [isGlitching, setIsGlitching] = useState(false); useEffect(() => { const interval = setInterval(() => { setIsGlitching(true); setTimeout(() => setIsGlitching(false), 200 / speed); }, 3000 / speed); return () => clearInterval(interval); }, [speed]); return ( {/* Main text */} {text} {/* Glitch layers */} {isGlitching && ( <> {text} {text} )} ); }; export default GlitchText;