Floating Particles
Floating emerald particles rising with staggered CSS animation on dark zinc gradient. Elegant ambient motion for fintech, AI, and premium SaaS full-page backgrounds. Accepts children for overlay content.
Dependencies
react
npm install react react-domconst PARTICLES = Array.from({ length: 24 }, (_, i) => ({
id: i,
left: `${(i * 13 + 5) % 95}%`,
size: 4 + (i % 4) * 2,
delay: `${(i % 8) * 0.6}s`,
duration: `${4 + (i % 5)}s`,
}));
export function FloatingParticlesBackground({ children }: { children?: React.ReactNode }) {
return (
<div className="relative min-h-screen overflow-hidden bg-gradient-to-b from-zinc-900 to-zinc-950">
{PARTICLES.map((p) => (
<span
key={p.id}
className="pointer-events-none absolute bottom-0 rounded-full bg-emerald-400/40 blur-[1px]"
style={{
left: p.left, width: p.size, height: p.size,
animation: `float ${p.duration} ease-in-out ${p.delay} infinite`,
}}
aria-hidden
/>
))}
<style>{`@keyframes float{0%,100%{transform:translateY(0);opacity:0}10%{opacity:.8}90%{opacity:.3}100%{transform:translateY(-100vh);opacity:0}}`}</style>
{children && <div className="relative z-10">{children}</div>}
</div>
);
}
Please implement this code in the current project and add it to (Your Desired Section, e.g. homepage hero, pricing page, dashboard). Change the primary accent color to (YOUR HEX CODE COLOR, e.g. #6366F1).
Requirements:
- Use React + Tailwind CSS (match the project's existing setup)
- Install dependencies if needed: npm install react react-dom
- Keep the layout responsive on mobile and desktop
- Replace placeholder copy with content that fits the project
The UI code:
const PARTICLES = Array.from({ length: 24 }, (_, i) => ({
id: i,
left: `${(i * 13 + 5) % 95}%`,
size: 4 + (i % 4) * 2,
delay: `${(i % 8) * 0.6}s`,
duration: `${4 + (i % 5)}s`,
}));
export function FloatingParticlesBackground({ children }: { children?: React.ReactNode }) {
return (
<div className="relative min-h-screen overflow-hidden bg-gradient-to-b from-zinc-900 to-zinc-950">
{PARTICLES.map((p) => (
<span
key={p.id}
className="pointer-events-none absolute bottom-0 rounded-full bg-emerald-400/40 blur-[1px]"
style={{
left: p.left, width: p.size, height: p.size,
animation: `float ${p.duration} ease-in-out ${p.delay} infinite`,
}}
aria-hidden
/>
))}
<style>{`@keyframes float{0%,100%{transform:translateY(0);opacity:0}10%{opacity:.8}90%{opacity:.3}100%{transform:translateY(-100vh);opacity:0}}`}</style>
{children && <div className="relative z-10">{children}</div>}
</div>
);
}
Replace (Your Desired Section) and (YOUR HEX CODE COLOR) before pasting into Cursor, Copilot, or ChatGPT.