07.07 · Ambient & Background

Starfield / Space Particles

Stars stream toward you out of the dark. Best for space themes.

Watch it

It moves by itself. Pause it to look closely, or turn on slow motion to see each part of the movement.

Starfield
Infinite depth from a single point
Small, slow stars in the middle grow and speed up toward the edge.

Try it

Change a setting and see the difference as it moves.

Direction

Outward flies through space; sideways looks out a window.

Speed

Keep it slow for a calm background.

Number of stars

More stars feel deeper; phones show at most 300.

More optionsFewer options

Star color

The color of the stars.

Each star gently brightens and dims.

A faint purple and blue haze behind the stars.

Copy the prompt

Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.

Add a starfield background to [the dark section you want it behind]. Draw many small stars on a canvas and move them out from the center, or sideways past the viewer, so it feels like flying through space. Tie each star's size, brightness and speed to its distance from the center: small, dim and slow near the middle, bigger, brighter and faster toward the edge, which is what creates the depth. A slow speed keeps it calm. Draw fewer stars on phones. If the visitor has reduced motion turned on, show the stars still. Match the settings listed below.

Replace the words in brackets with your own element. Your settings are added at the end.

Free and open source. If this helped, a star on GitHub helps other people find it.

Star on GitHub

What it is

The full explanation is in README.md.

Good for

  • Space and science themes
  • Hero sections
  • Screensavers and kiosks
  • Launch pages

Avoid on

  • Light pages
  • Long reading pages