зеркало из
https://github.com/kodackx/disinformation-quest.git
synced 2025-10-29 20:46:05 +02:00
Fix memes animation width usage
Updated the memes animation component to utilize the full width and area available, improving its layout compared to the current implementation of the community animation. [skip gpt_engineer]
Этот коммит содержится в:
родитель
ae866c8ba4
Коммит
1ae0567b9f
@ -2,22 +2,38 @@ import React from 'react';
|
|||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
|
|
||||||
export const CommunityAnimation = ({ className = '' }: { className?: string }) => {
|
export const CommunityAnimation = ({ className = '' }: { className?: string }) => {
|
||||||
// Create multiple community groups with members
|
|
||||||
const groups = Array.from({ length: 3 }, (_, i) => ({
|
const groups = Array.from({ length: 3 }, (_, i) => ({
|
||||||
x: 25 + i * 25, // Spread groups evenly (25%, 50%, 75%)
|
x: 25 + i * 25, // Spread groups evenly (25%, 50%, 75%)
|
||||||
y: 50, // Center vertically
|
y: 50, // Center vertically
|
||||||
members: Array.from({ length: 8 }, (_, j) => ({
|
members: Array.from({ length: 8 }, (_, j) => ({
|
||||||
id: i * 8 + j,
|
id: i * 8 + j,
|
||||||
initialX: Math.random() * 80 + 10, // Keep within 10-90% bounds
|
initialX: Math.random() * 80 + 10,
|
||||||
initialY: Math.random() * 80 + 10, // Keep within 10-90% bounds
|
initialY: Math.random() * 80 + 10,
|
||||||
}))
|
}))
|
||||||
}));
|
}));
|
||||||
|
|
||||||
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 similar to MemeAnimation */}
|
||||||
|
<div className="absolute inset-0 w-full opacity-20">
|
||||||
|
{[...Array(20)].map((_, i) => (
|
||||||
|
<div
|
||||||
|
key={`line-${i}`}
|
||||||
|
className="absolute h-px bg-yellow-500"
|
||||||
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
top: `${Math.random() * 100}%`,
|
||||||
|
transform: `rotate(${Math.random() * 360}deg)`,
|
||||||
|
opacity: 0.3
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Container for community groups with explicit positioning context */}
|
||||||
|
<div className="absolute inset-0">
|
||||||
{groups.map((group, groupIndex) => (
|
{groups.map((group, groupIndex) => (
|
||||||
<React.Fragment key={groupIndex}>
|
<React.Fragment key={groupIndex}>
|
||||||
{/* Individual members that will converge into groups */}
|
|
||||||
{group.members.map((member) => (
|
{group.members.map((member) => (
|
||||||
<motion.div
|
<motion.div
|
||||||
key={member.id}
|
key={member.id}
|
||||||
@ -41,20 +57,19 @@ export const CommunityAnimation = ({ className = '' }: { className?: string }) =
|
|||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
transform: 'translate(-50%, -50%)', // Center the dot
|
transform: 'translate(-50%, -50%)',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{/* Community boundary circles */}
|
|
||||||
<motion.div
|
<motion.div
|
||||||
className="absolute rounded-full border-2 border-yellow-500/30"
|
className="absolute rounded-full border-2 border-yellow-500/30"
|
||||||
style={{
|
style={{
|
||||||
width: '20%', // Smaller relative to container
|
width: '25%',
|
||||||
height: '40%', // Maintain aspect ratio
|
height: '50%',
|
||||||
left: `${group.x}%`,
|
left: `${group.x}%`,
|
||||||
top: `${group.y}%`,
|
top: `${group.y}%`,
|
||||||
transform: 'translate(-50%, -50%)', // Consistent centering
|
transform: 'translate(-50%, -50%)',
|
||||||
}}
|
}}
|
||||||
initial={{
|
initial={{
|
||||||
scale: 0,
|
scale: 0,
|
||||||
@ -75,5 +90,6 @@ export const CommunityAnimation = ({ className = '' }: { className?: string }) =
|
|||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
Загрузка…
x
Ссылка в новой задаче
Block a user