import { useEffect, useRef, useState } from 'react'; import { motion, AnimatePresence } from 'motion/react'; const GOLD = '#EFBF04'; const DARK = '#101828'; const SHARDS = [ { clip: 'polygon(0 0, 50% 0, 50% 50%, 0 50%)', tx: -60, ty: -60 }, { clip: 'polygon(50% 0, 100% 0, 100% 50%, 50% 50%)', tx: 60, ty: -60 }, { clip: 'polygon(0 50%, 50% 50%, 50% 100%, 0 100%)', tx: -60, ty: 60 }, { clip: 'polygon(50% 50%, 100% 50%, 100% 100%, 50% 100%)', tx: 60, ty: 60 }, ]; export default function LoadingScreen({ onDone }: { onDone: () => void }) { const [phase, setPhase] = useState<'logo' | 'progress' | 'shatter' | 'gone'>('logo'); const called = useRef(false); useEffect(() => { const t1 = setTimeout(() => setPhase('progress'), 300); const t2 = setTimeout(() => setPhase('shatter'), 1700); const t3 = setTimeout(() => { setPhase('gone'); if (!called.current) { called.current = true; onDone(); } }, 2500); return () => { clearTimeout(t1); clearTimeout(t2); clearTimeout(t3); }; }, [onDone]); if (phase === 'gone') return null; const isShatter = phase === 'shatter'; return (
{/* ── SOLID PHASE (logo + progress bar) ── */} {!isShatter && ( {/* Logo + bar centred */}
{/* Gold progress track */}
)}
{/* ── LIQUID GLASS SHATTER ── */} {isShatter && SHARDS.map((s, i) => ( {/* Ghost logo inside each shard */}
))}
{/* Central gold burst on shatter */} {isShatter && ( )}
); }