Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import './globals.css';
import { Inter } from 'next/font/google';
import { Analytics } from '@vercel/analytics/next';
import Navbar from './components/navbar';
import CherryBlossom from '@/components/CherryBlossom';
import BrandParticles from '@/components/BrandParticles';
import type { Metadata } from 'next';

const inter = Inter({ subsets: ['latin'] });
Expand Down Expand Up @@ -66,7 +66,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
return (
<html lang="en">
<body className={`${inter.className} bg-black`}>
<CherryBlossom />
<BrandParticles />
<Navbar />
<div className="pt-24 sm:pt-28 relative z-10">{children}</div>
<Analytics />
Expand Down
82 changes: 82 additions & 0 deletions components/BrandParticles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
'use client';

import { motion } from 'framer-motion';
import { useEffect, useState } from 'react';

// Generates an array of particles
const generateParticles = (count: number) => {
const colors = ['#10b981', '#8b5cf6', '#06b6d4', '#f59e0b', '#3b82f6'];
return Array.from({ length: count }).map((_, i) => ({
id: i,
x: Math.random() * 100, // starting X position %
y: Math.random() * 100, // starting Y position %
size: Math.random() * 15 + 5, // size between 5 and 20
color: colors[Math.floor(Math.random() * colors.length)],
duration: Math.random() * 30 + 30, // 30s to 60s duration
delay: Math.random() * -60, // Negative delay so they start already moving
rotateDirection: Math.random() > 0.5 ? 1 : -1,
opacity: 0.1 + Math.random() * 0.15, // subtle opacity (0.1 to 0.25)
borderRadius: Math.random() > 0.5 ? '2px' : '50%', // Mix of squares and circles
xAnimStart: Math.random() * 100 - 50,
xAnimEnd: Math.random() * -100 + 50,
}));
};

interface Particle {
id: number;
x: number;
y: number;
size: number;
color: string;
duration: number;
delay: number;
rotateDirection: number;
opacity: number;
borderRadius: string;
xAnimStart: number;
xAnimEnd: number;
}

export default function BrandParticles() {
const [particles] = useState<Particle[]>(() => generateParticles(40));
const [mounted, setMounted] = useState(false);

useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
setMounted(true);
}, []);

if (!mounted) return null;

return (
<div className="fixed inset-0 pointer-events-none z-[-1] overflow-hidden">
{particles.map((particle) => (
<motion.div
key={particle.id}
className="absolute"
style={{
width: particle.size,
height: particle.size,
backgroundColor: particle.color,
left: `${particle.x}vw`,
top: `${particle.y}vh`,
opacity: particle.opacity,
boxShadow: `0 0 ${particle.size * 2}px ${particle.color}`,
borderRadius: particle.borderRadius,
}}
animate={{
y: [0, -150, 150, 0], // Float up and around
x: [0, particle.xAnimStart, particle.xAnimEnd, 0],
rotate: [0, 360 * particle.rotateDirection],
}}
transition={{
duration: particle.duration,
delay: particle.delay,
repeat: Infinity,
ease: 'linear',
}}
/>
))}
</div>
);
}
Loading