import { useState, useEffect } from "react"; const GlitchText = () => { const originalText = 'Error 404'; const [characters, setCharacters] = useState( originalText.split("").map(char => ({ char, isGlitched: false })) ); const glitchChars = "!<>-_\\/[]{}—=+*^?#________"; useEffect(() => { const glitchInterval = setInterval(() => { if (Math.random() < 0.2) { // 20% chance to trigger glitch setCharacters(prev => { return originalText.split('').map((originalChar, index) => { if (Math.random() < 0.3) { // 30% chance to glitch each character return { char: glitchChars[Math.floor(Math.random() * glitchChars.length)], isGlitched: true }; } return { char: originalChar, isGlitched: false }; }); }); // Reset after short delay setTimeout(() => { setCharacters(originalText.split('').map(char => ({ char, isGlitched: false }))); }, 100); } }, 50); return () => clearInterval(glitchInterval); }, []); return (