Particles
- Source
- Magic UI ↗
- Author
- Magic UI
- Licence
- MIT
Loading…
Drifting dots that lean gently toward the pointer.
Code
"use client";
import { Particles } from "@/lab/magicui/ui/particles";
export default function ParticlesDemo() {
return (
<div className="@container relative flex h-full w-full flex-col items-center justify-center overflow-hidden">
<span className="pointer-events-none z-10 text-center text-[clamp(3rem,12cqw,6rem)] leading-none font-semibold whitespace-pre-wrap text-neutral-950">
Particles
</span>
<Particles className="absolute inset-0 z-0" quantity={100} ease={80} color="#000000" refresh />
</div>
);
}
Prompt
Build "Particles", a canvas animation. What it does: Drifting dots that lean gently toward the pointer. Write it as a single self-contained React component in TypeScript that fills its parent (w-full h-full), styled with Tailwind CSS. Technique: an HTML canvas, a requestAnimationFrame loop, pointer tracking. It sits on a light background, in a 16:10 frame. Respect prefers-reduced-motion with a still state, pause work when the element is off screen, and keep it accessible. Original: https://magicui.design/docs/components/particles (Magic UI, MIT).