Adjusted the horizontal spread of emojis in the MemeAnimation component to utilize the full width of the container, ensuring a more dynamic and visually appealing distribution.
[skip gpt_engineer]
Этот коммит содержится в:
gpt-engineer-app[bot] 2024-12-15 13:18:21 +00:00
родитель f6589b4276
Коммит eaa8767e91

Просмотреть файл

@ -13,13 +13,13 @@ export const MemeAnimation = ({ className = '' }: { className?: string }) => {
useEffect(() => { useEffect(() => {
const interval = setInterval(() => { const interval = setInterval(() => {
// Add new emoji with better horizontal distribution // Add new emoji with wider horizontal distribution
setEmojis(current => { setEmojis(current => {
const newEmoji = { const newEmoji = {
id: Date.now(), id: Date.now(),
symbol: symbols[Math.floor(Math.random() * symbols.length)], symbol: symbols[Math.floor(Math.random() * symbols.length)],
// Spread more widely across the container width (from 5% to 95%) // Use full width (0 to 100%) for positioning
x: Math.random() * 90 + 5, x: Math.random() * 100,
}; };
return [...current, newEmoji]; return [...current, newEmoji];
}); });
@ -34,7 +34,7 @@ export const MemeAnimation = ({ className = '' }: { className?: string }) => {
return ( return (
<div className={`relative w-full h-40 overflow-hidden bg-black/20 rounded-lg ${className}`}> <div className={`relative w-full h-40 overflow-hidden bg-black/20 rounded-lg ${className}`}>
{/* Background network effect */} {/* Background network effect */}
<div className="absolute inset-0 opacity-20"> <div className="absolute inset-0 w-full opacity-20">
{[...Array(20)].map((_, i) => ( {[...Array(20)].map((_, i) => (
<div <div
key={`line-${i}`} key={`line-${i}`}
@ -59,41 +59,43 @@ export const MemeAnimation = ({ className = '' }: { className?: string }) => {
🌟 🌟
</motion.div> </motion.div>
{/* Floating emojis */} {/* Floating emojis with full width container */}
<AnimatePresence> <div className="absolute inset-0 w-full">
{emojis.map((emoji) => ( <AnimatePresence>
<motion.div {emojis.map((emoji) => (
key={emoji.id} <motion.div
className="absolute text-2xl" key={emoji.id}
initial={{ className="absolute text-2xl"
y: '100%', initial={{
x: `${emoji.x}%`, y: '100%',
opacity: 0, x: `${emoji.x}%`,
scale: 0.5 opacity: 0,
}} scale: 0.5
animate={{ }}
y: '-100%', animate={{
opacity: [0, 1, 1, 0], y: '-100%',
scale: [0.5, 1, 1, 0.8] opacity: [0, 1, 1, 0],
}} scale: [0.5, 1, 1, 0.8]
exit={{ opacity: 0 }} }}
transition={{ exit={{ opacity: 0 }}
duration: 3, transition={{
ease: "easeOut",
opacity: {
duration: 3, duration: 3,
times: [0, 0.1, 0.8, 1] ease: "easeOut",
}, opacity: {
scale: { duration: 3,
duration: 3, times: [0, 0.1, 0.8, 1]
times: [0, 0.1, 0.8, 1] },
} scale: {
}} duration: 3,
> times: [0, 0.1, 0.8, 1]
{emoji.symbol} }
</motion.div> }}
))} >
</AnimatePresence> {emoji.symbol}
</motion.div>
))}
</AnimatePresence>
</div>
</div> </div>
); );
}; };