← All components
Atmospheres / background

Galaxy

A layered star field with twinkling light and gentle pointer repulsion.

Open in studio ↗
PLAYGROUND
Live preview
Preparing preview…

Take it with you.

SOURCE ACCESS

Preview freely. Unlock the files.

Enter the shared password to copy the complete source, download every file, and install components in your app.

Access lasts 24 hours. Your preview settings stay with you.

Component notes

  • Give the background an explicitly sized parent. Demo.tsx contains the complete composition.
  • Reduced motion renders a static state. Paused, hidden and offscreen instances stop requesting animation frames.
  • Original shader equations retained. A CSS fallback appears without WebGL2. Canvas dimensions are capped at 2048 pixels.
  • Speed controls shader drift; rotationSpeed independently controls rotation. disableAnimation freezes pointer interpolation as well as time.
React 19WebGL2OGL 1.0.11

React Bits · MIT with Commons Clause. Used with explicit project permission; see bundled notice.

Props

PropTypeDefaultDescription
starSpeednumber0.5Star speed
densitynumber1Density
hueShiftnumber140Hue
speednumber1Drift speed
glowIntensitynumber0.3Glow
saturationnumber0Saturation
repulsionStrengthnumber2Repulsion
twinkleIntensitynumber0.3Twinkle
rotationSpeednumber0.1Rotation
autoCenterRepulsionnumber0Center repulsion
mouseInteractionbooleantruePointer response
mouseRepulsionbooleantrueRepel stars
transparentbooleantrueTransparent
lightModebooleanfalseLight mode
focal[number, number][0.5, 0.5]Normalized focal point.
rotation[number, number][1, 0]Cosine and sine of the fixed rotation angle.
disableAnimationbooleanfalseAlias for full pause, including pointer interpolation.
timenumberundefinedExplicit shader time in seconds; stops automatic frames. Reduced motion takes precedence.
pausedbooleanfalseFreeze decorative motion; controls remain usable.
replayTokennumber0Change to reset decorative motion.
classNamestring''Additional outer classes.