Skip to content
VenusUI
Get started

Particle Galaxy

A WebGL spiral galaxy of glowing particles that turns and leans toward the pointer.

Preview

Installation

npx shadcn@latest add @venusui/particle-galaxy

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/hooks/use-scene-state.tsfrom use-scene-state
  • @/components/ui/particle-galaxy.tsx

Usage

The code behind the preview above.

particle-galaxy-demo.tsx

import { ParticleGalaxy } from "@/components/ui/particle-galaxy"

export default function ParticleGalaxyDemo() {
  return (
    <div className="dark w-full overflow-hidden rounded-xl border bg-background">
      <ParticleGalaxy className="h-80" count={30000} />
    </div>
  )
}

API reference

PropTypeDefaultDescription
countnumber40000Number of particles.
armsnumber4Number of spiral arms.
colors[string, string, string]peach, violet, skyCore, middle and rim colors (hex, rgb() or hsl()).
speednumber0.06Turning speed in radians per second.
followPointerbooleantrueLean the camera toward the pointer.
labelstring"Spiral galaxy of glowing particles"Accessible description.

Only the props above, plus className (set the height, e.g. h-96).

Requirements

  • three and @react-three/fiber (React 19). The CLI installs both, plus @types/three as a dev dependency.
  • A browser with WebGL. Without it, a short text fallback is shown.

Customization

  • Made for dark backgrounds: its glow adds light.
  • Lower count (around 15000) for low-end phones.

Accessibility

  • Exposed as a labelled image.
  • Pauses off screen and holds still with reduced motion.

Troubleshooting

A color looks black.
three.js can’t parse oklch(); use hex, rgb() or hsl().
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A dotted 3D Earth with glowing routes between cities; pulses travel each arc and ripple where they land.

Loading preview

A WebGL sphere of evenly spaced dots that slowly turns; drag or use the arrow keys to spin it.

Loading preview

A WebGL field of points rolling like a wave, for hero and section backgrounds.