| | 'use client'; |
| |
|
| | import { useEffect, useState } from 'react'; |
| | import { motion } from 'framer-motion'; |
| |
|
| | export function SplashScreen({ onComplete }: { onComplete: () => void }) { |
| | const [isVisible, setIsVisible] = useState(true); |
| |
|
| | useEffect(() => { |
| | const timer = setTimeout(() => { |
| | setIsVisible(false); |
| | setTimeout(onComplete, 500); |
| | }, 2500); |
| |
|
| | return () => clearTimeout(timer); |
| | }, [onComplete]); |
| |
|
| | if (!isVisible) return null; |
| |
|
| | return ( |
| | <motion.div |
| | initial={{ opacity: 1 }} |
| | animate={{ opacity: isVisible ? 1 : 0 }} |
| | exit={{ opacity: 0 }} |
| | transition={{ duration: 0.5 }} |
| | className="fixed inset-0 z-[100] bg-gradient-to-br from-blue-600 via-purple-600 to-pink-500 flex items-center justify-center" |
| | > |
| | <div className="text-center"> |
| | {/* Logo Animation */} |
| | <motion.div |
| | initial={{ scale: 0, rotate: -180 }} |
| | animate={{ scale: 1, rotate: 0 }} |
| | transition={{ |
| | type: 'spring', |
| | stiffness: 260, |
| | damping: 20, |
| | delay: 0.2, |
| | }} |
| | className="mb-8" |
| | > |
| | <div className="w-24 h-24 mx-auto bg-white rounded-3xl shadow-2xl flex items-center justify-center"> |
| | <span className="text-6xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-blue-600 to-purple-600"> |
| | ✓ |
| | </span> |
| | </div> |
| | </motion.div> |
| | |
| | {/* Title Animation */} |
| | <motion.h1 |
| | initial={{ y: 20, opacity: 0 }} |
| | animate={{ y: 0, opacity: 1 }} |
| | transition={{ delay: 0.5 }} |
| | className="text-5xl font-bold text-white mb-4" |
| | > |
| | Todo App |
| | </motion.h1> |
| | |
| | {/* Subtitle Animation */} |
| | <motion.p |
| | initial={{ y: 20, opacity: 0 }} |
| | animate={{ y: 0, opacity: 1 }} |
| | transition={{ delay: 0.7 }} |
| | className="text-xl text-white/80 mb-8" |
| | > |
| | Organize your life, achieve your goals |
| | </motion.p> |
| | |
| | {/* Loading Dots */} |
| | <motion.div |
| | initial={{ opacity: 0 }} |
| | animate={{ opacity: 1 }} |
| | transition={{ delay: 1 }} |
| | className="flex items-center justify-center gap-2" |
| | > |
| | {[0, 1, 2].map((i) => ( |
| | <motion.div |
| | key={i} |
| | animate={{ |
| | scale: [1, 1.2, 1], |
| | opacity: [0.5, 1, 0.5], |
| | }} |
| | transition={{ |
| | duration: 1.5, |
| | repeat: Infinity, |
| | delay: i * 0.2, |
| | }} |
| | className="w-3 h-3 bg-white rounded-full" |
| | /> |
| | ))} |
| | </motion.div> |
| | </div> |
| | </motion.div> |
| | ); |
| | } |
| |
|