import { useEffect, useState, useMemo } from 'react'; const TOTAL_DURATION = 2300; // Total animation duration in ms (tightened from 4000) const LOGO_ENTER_DURATION = 500; // Tightened from 1200 const PARTICLES_ENTER_DELAY = 100; // Tightened from 400 const EXIT_START = 1800; // Adjusted for shorter duration interface Particle { id: number; x: number; y: number; size: number; delay: number; angle: number; distance: number; opacity: number; floatDuration: number; } function generateParticles(count: number): Particle[] { return Array.from({ length: count }, (_, i) => { const angle = (i / count) * 360 + Math.random() * 30; const distance = 60 + Math.random() * 80; // Increased spread return { id: i, x: Math.cos((angle * Math.PI) / 180) * distance, y: Math.sin((angle * Math.PI) / 180) * distance, size: 3 + Math.random() * 6, // Slightly smaller range for more subtle look delay: Math.random() * 400, angle, distance: 300 + Math.random() * 200, opacity: 0.4 + Math.random() * 0.6, floatDuration: 3000 + Math.random() * 4000, }; }); } export function SplashScreen({ onComplete }: { onComplete: () => void }) { const [phase, setPhase] = useState<'enter' | 'hold' | 'exit' | 'done'>('enter'); const particles = useMemo(() => generateParticles(50), []); useEffect(() => { const timers: NodeJS.Timeout[] = []; // Phase transitions timers.push(setTimeout(() => setPhase('hold'), LOGO_ENTER_DURATION)); timers.push(setTimeout(() => setPhase('exit'), EXIT_START)); timers.push( setTimeout(() => { setPhase('done'); onComplete(); }, TOTAL_DURATION) ); return () => timers.forEach(clearTimeout); }, [onComplete]); if (phase === 'done') return null; return (