This is my last latest code update: import React, { useEffect } from 'react'; import {…
- User
This is my last latest code update: import React, { useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Home, ArrowLeft } from 'lucide-react';
// --- SVG for Paper Plane --- const PaperPlaneSvg: React.FC<{ className?: string }> = ({ className }) => ( <svg width="24" // Default size, can be overridden by className height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" // Inherits color via className strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className} > {/* Main wing /} {/ Body and tail */} );
const MailboxAnimation: React.FC = () => {
// Define timings const totalDuration = 5; // seconds for one loop cycle const loopDelay = 1.5; // seconds delay between loops const animationPartDuration = totalDuration * 0.7; // Animation takes 70% of the cycle const repeatDelayTotal = loopDelay + (totalDuration * 0.3); // Wait for fade out + loop delay
// Mailbox animation (simple fade-in) const mailboxVariants = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { duration: 0.5 } }, };
// Envelope animation: Try to reach slot, get blown away, then fade out const letterVariants = { initial: { x: -100, y: 80, opacity: 0, rotate: -10, scale: 0.8 }, animate: { x: [-100, 80, 90, 150], // Move towards slot, hesitate, start getting blown right y: [80, 85, 70, 40], // Slight dip, then blown upwards rotate: [-10, 0, 15, 45], // Straighten, then start tumbling scale: [0.8, 1, 1.05, 0.9], // Grow slightly, then shrink a bit opacity: [0, 1, 1, 0], // Fade in, stay visible, fade out before end of path transition: { duration: animationPartDuration, delay: 0.5, ease: ["circOut", "easeIn", "easeOut"] as any, times: [0, 0.4, 0.55, 0.8], // Fade out starts at 55% mark, completes by 80% repeat: Infinity, repeatDelay: repeatDelayTotal, repeatType: "loop" as const, }, }, };
// Paper Plane animation: Fades in where envelope fades out, continues flight const paperPlaneVariants = { initial: { x: 150, y: 40, opacity: 0, rotate: 45, scale: 0.9 }, // Start where envelope fades out animate: { x: [150, 250, 300], // Continue flight path off screen y: [40, 30, 25], rotate: [45, 60, 70], // Continue tumbling/orienting like a plane scale: [0.9, 0.7, 0.6], // Continue shrinking opacity: [0, 1, 0], // Fade in, then fade out at the very end transition: { duration: animationPartDuration * 0.45, // Takes over the last 45% (from 55% to 100%) delay: 0.5 + animationPartDuration * 0.55, // Start exactly when envelope starts fading out ease: ["easeOut", "linear"] as any, times: [0, 0.8, 1], // Fade out in the last 20% of its own animation repeat: Infinity, repeatDelay: repeatDelayTotal + (animationPartDuration * 0.55), // Adjust delay accounting for its start time repeatType: "loop" as const, } } };
// Flag animation: React to the letter's approach and departure const flagVariants = { initial: { rotate: 0 }, animate: { rotate: [0, 0, -45, -45, 0, 0], transition: { duration: animationPartDuration, // Sync with letter duration delay: 0.5, times: [0, 0.35, 0.45, 0.7, 0.8, 1], // Timing matches letter keyframes repeat: Infinity, repeatDelay: repeatDelayTotal, repeatType: "loop" as const, } } };
return ( {/* Mailbox Group /} <motion.g variants={mailboxVariants} initial="hidden" animate="visible"> {/ Mailbox Body /} {/ Mailbox Door /} {/ Mailbox Slot /} {/ Mailbox Stand /} {/ Mailbox Flag */} <motion.g style={{ originX: "155px", originY: "95px" }} variants={flagVariants} initial="initial" animate="animate"> </motion.g> </motion.g>
{/* Animated Letter (Fades out) */} <motion.g variants={letterVariants} initial="initial" animate="animate"> <rect x="0" y="0" width="30" height="20" fill="#FFF" stroke="#CBD5E0" strokeWidth="1" rx="1"/> <path d="M0 0 L 15 10 L 30 0" stroke="#CBD5E0" strokeWidth="1" /> </motion.g> {/* Animated Paper Plane (Fades in) */} <motion.g variants={paperPlaneVariants} initial="initial" animate="animate"> <PaperPlaneSvg className="w-6 h-6 text-gray-600" /> {/* Use SVG component */} </motion.g> {/* SVG Gradient Definition */} <defs> <linearGradient id="mailboxGradient" x1="0%" y1="0%" x2="0%" y2="100%"> <stop offset="0%" style={{stopColor: "#818CF8", stopOpacity: 1}} /> <stop offset="100%" style={{stopColor: "#6366F1", stopOpacity: 1}} /> </linearGradient> </defs> </svg>); };
// --- Background Paper Plane Animation Component --- const BackgroundPlanes: React.FC = () => { // Renamed from BackgroundLetters const numPlanes = 10; // Number of planes floating
return ( <div className="absolute inset-0 w-full h-full overflow-hidden pointer-events-none -z-10"> {Array.from({ length: numPlanes }).map((_, i) => { const duration = Math.random() * 10 + 10; // 10-20 seconds duration const delay = Math.random() * 15; // Start at different times const startY = Math.random() * 100; // Start at random height % const startX = -10; // Start off-screen left const endX = 110; // End off-screen right const driftY = (Math.random() - 0.5) * 30; // Random vertical drift +/- 15% const randomScale = Math.random() * 0.6 + 0.4; // Scale between 0.4 and 1.0 return ( <motion.div key={i} className="absolute text-indigo-200/60" // Slightly more opaque style={{ scale: randomScale }} // Apply random scale directly initial={{ x: `${startX}%`, y: `${startY}%`, opacity: 0, rotate: Math.random() * 20 - 10 }} // Slight initial rotation animate={{ x: `${endX}%`, y: `${startY + driftY}%`, opacity: [0, 1, 1, 0], // Fade in and out rotate: Math.random() * 30 - 15, // Slight rotation change during flight }} transition={{ duration: duration, delay: delay, ease: "linear", repeat: Infinity, repeatDelay: 1 }} > {/* Use Paper Plane SVG */} <PaperPlaneSvg className="w-full h-full" /> </motion.div> ); })} </div> );};
// --- Main Page Component --- const NotFoundPage: React.FC = () => { useEffect(() => { document.title = '404 - Page Not Found'; }, []); return ( {/* Background Animation /} {/ Use renamed component */}
<motion.div initial={{ opacity: 0, scale: 0.9 }} animate={{ opacity: 1, scale: 1 }} transition={{ duration: 0.6, ease: "backOut" }} // Changed background: slightly off-white using slate-50 className="relative z-10 bg-slate-50/90 backdrop-blur-lg rounded-2xl shadow-2xl p-8 md:p-12 max-w-xl w-full text-center border border-gray-200/30 overflow-hidden" > {/* Animated SVG Illustration */} <div className="flex justify-center mb-6 h-[180px]"> <MailboxAnimation /> {/* Use renamed component */} </div> {/* Title */} <motion.h1 className="text-4xl md:text-5xl font-bold mb-3 text-transparent bg-clip-text bg-gradient-to-r from-indigo-600 to-blue-500" initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.5, delay: 0.3 }} > Oops! Lost in Transit </motion.h1> {/* Message */} <motion.p className="text-gray-700 mb-10 text-lg" initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.5, delay: 0.5 }} > It looks like the page you requested took a wrong turn. Let's get you back on track. </motion.p> {/* Action Buttons - Styled directly with Tailwind */} <motion.div className="flex flex-col sm:flex-row gap-4 justify-center" initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.5, delay: 0.7 }} > <a href="/" className="inline-flex items-center justify-center px-6 py-3 text-base font-medium text-white bg-gradient-to-r from-blue-600 to-indigo-600 rounded-lg shadow-md hover:shadow-lg hover:from-blue-700 hover:to-indigo-700 transition-all duration-300 ease-in-out transform hover:-translate-y-0.5 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" > <Home className="mr-2 h-5 w-5" /> Go to Dashboard </a> <button onClick={() => window.history.back()} className="inline-flex items-center justify-center px-6 py-3 text-base font-medium text-gray-700 bg-white rounded-lg border border-gray-300 shadow-sm hover:bg-gray-100 hover:shadow-md transition-all duration-300 ease-in-out transform hover:-translate-y-0.5 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" > <ArrowLeft className="mr-2 h-5 w-5" /> Go Back </button> </motion.div> </motion.div> </div>); };
export default NotFoundPage;
This tsx page needs fewer improvements they are: the paper plane background planes are not visible to me is they were going very too back or anything check them and they should be on top like very small looks like a sky view point they should move like migration formations.
- Assistant
To enhance the visibility and behavior of the background paper planes in your
NotFoundPagecomponent, consider the following adjustments:-
Ensure Background Planes Are Visible:
- Z-Index Adjustment: The
BackgroundPlanescomponent currently has a class-z-10, which places it behind other elements. To bring it to the forefront, change this toz-10. - Opacity Enhancement: Increase the opacity of the planes to make them more noticeable.
Updated
BackgroundPlanesComponent:const BackgroundPlanes: React.FC = () => { const numPlanes = 10; // Number of planes floating return ( <div classname="absolute inset-0 w-full h-full overflow-hidden pointer-events-none z-10"> {Array.from({ length: numPlanes }).map((_, i) => { const duration = Math.random() * 10 + 10; // 10-20 seconds duration const delay = Math.random() * 15; // Start at different times const startY = Math.random() * 100; // Start at random height % const startX = -10; // Start off-screen left const endX = 110; // End off-screen right const driftY = (Math.random() - 0.5) * 30; // Random vertical drift +/- 15% const randomScale = Math.random() * 0.6 + 0.4; // Scale between 0.4 and 1.0 return ( <motion.div "linear",="" *="" +="" -="" 0,="" 0],="" 1="" 1,="" 10="" 15,="" 20="" 30="" [0,="" `${endx}%`,="" `${startx}%`,="" `${starty="" `${starty}%`,="" adjusted="" and="" animate="{{" classname="absolute text-indigo-200" delay,="" delay:="" drifty}%`,="" duration,="" duration:="" ease:="" fade="" in="" infinity,="" initial="{{" key="{i}" math.random()="" opacity="" opacity:="" out="" randomscale="" repeat:="" repeatdelay:="" rotate:="" scale:="" style="{{" transition="{{" x:="" y:="" }}=""> - Z-Index Adjustment: The
</motion.div> ); })} ); };
2. **Simulate Migration Formations:** - **Formation Patterns:** To mimic bird migration formations, adjust the starting positions (`startX`, `startY`) and paths (`endX`, `driftY`) of the planes to create V-shaped or staggered formations. - **Synchronized Movements:** Group planes into formations and synchronize their animations to move cohesively. **Example Adjustments:** ```tsx const BackgroundPlanes: React.FC = () => { const formations = [ { startX: -10, startY: 20, endX: 110, driftY: 10 }, { startX: -15, startY: 25, endX: 105, driftY: 15 }, // Add more formations as needed ]; return ( <div classname="absolute inset-0 w-full h-full overflow-hidden pointer-events-none z-10"> {formations.map((formation, i) => ( <motion.div "linear",="" *="" +="" -="" 0,="" 0],="" 1="" 1,="" 10="" 10,="" 15,="" 20="" 30="" [0,="" `${formation.endx}%`,="" `${formation.startx}%`,="" `${formation.starty="" `${formation.starty}%`,="" animate="{{" classname="absolute text-indigo-200" delay:="" duration:="" ease:="" formation.drifty}%`,="" infinity,="" initial="{{" key="{i}" math.random()="" opacity:="" repeat:="" repeatdelay:="" rotate:="" transition="{{" x:="" y:="" }}=""> <paperplanesvg classname="w-full h-full"></paperplanesvg> </motion.div> ))} </div> ); };By defining specific formations and synchronizing their movements, the background planes will resemble migration patterns, enhancing the visual appeal of your
NotFoundPage. -
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.