import React, { useEffect, useRef, useState } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; interface PortalAnimationProps { isVisible: boolean; onComplete: () => void; targetLink: string; } const PortalAnimation: React.FC = ({ isVisible, onComplete, targetLink }) => { const videoRef = useRef(null); const [statusText, setStatusText] = useState("Initializing Port..."); useEffect(() => { if (isVisible) { // Sequence of status texts for a more high-tech feel const statusInterval = setInterval(() => { const texts = ["Synchronizing...", "Establishing Link...", "Calibrating Vortex...", "Dimensional Drift...", "Transmitting..."]; setStatusText(prev => { const idx = texts.indexOf(prev); return texts[(idx + 1) % texts.length]; }); }, 1000); // 5-second delay for the high-quality transition const timer = setTimeout(() => { // Redirection logic starts - the page will unload // The overlay will naturally stay until the browser replaces the page window.location.href = targetLink; }, 5000); return () => { clearTimeout(timer); clearInterval(statusInterval); }; } }, [isVisible, targetLink]); useEffect(() => { if (isVisible && videoRef.current) { videoRef.current.play().catch(err => console.error("Video play failed:", err)); } }, [isVisible]); if (!isVisible) return null; return (
{/* High-Quality Native Video - Absolute Full Screen */}
); }; export default PortalAnimation;