# Firmament — WebGL Background for React

> A cold night sky: three parallax layers of stars in icy white, pale blue, and rare cool violet over a blue-violet nebula lit from below, crossed by occasional downward-falling shooting stars with gravity-bent trails. Mouse and scroll parallax, offscreen-paused, reduced-motion-safe.

- Page: https://crucibleui.com/components/backgrounds/firmament
- Category: [backgrounds](https://crucibleui.com/backgrounds)
- Tier: pro (one-time purchase, see https://crucibleui.com/pricing)
- Engine: ogl
- npm dependencies: ogl

## Install

```bash
npx shadcn@latest add @crucible/firmament
```

Pro install requires adding the token-bearing `@crucible` registry to components.json (issued at https://crucibleui.com/account after purchase).

Import from `@/components/crucible/firmament`.

Backgrounds render `absolute inset-0 -z-10`. Their parent must be a stacking context — wrap in `relative isolate` and put your content in a `relative z-10` child, or the background disappears behind an opaque ancestor.

## Props (`FirmamentProps`)

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `colors?` | `[string, string]` | `a cold night palette: ice blue over blue-violet` | Nebula tones: `[horizonGlow, zenithSmoke]`. The first lights the nebula from below; the second takes over as it climbs. Any hex strings. |
| `density?` | `number` | `0.45` | Star population, 0–1. 1 fills the sky; 0.3 is sparse. |
| `speed?` | `number` | `1` | Twinkle and smoke-drift speed multiplier. 1 = default. |
| `heat?` | `number` | `0.4` | Heat, 0–1. Scales star brightness, nebula glow, and drift energy together: 0 is a banked, dying sky; 1 blazes. |
| `parallax?` | `number` | `0.6` | Mouse + scroll parallax strength, 0–1. Near star layers shift more than far ones as the pointer moves or the page scrolls. 0 locks the sky. |
| `shootingStars?` | `number` | `3` | Average shooting stars per minute — each falls DOWNWARD with a gravity-bent trail. 0 disables. |
| `paused?` | `boolean` | — | Freeze the animation, holding the current frame. |
| `idle?` | `boolean` | `true` | Idle autoplay: after ~1.5s with no pointer present, a seeded ghost drifts slowly across the field and tilts the parallax sky, so thumbnails and heroes never look still; a real pointer takes over instantly. Never runs under reduced motion. |
| `className?` | `string` | — | Extra classes for the wrapper. Positioned `absolute inset-0 -z-10`. |

## Usage example

`DemoScene` is a site-only preview harness, not part of the component — replace it with your own layout.

```tsx
import { Firmament } from "@/components/crucible/firmament";
import { DemoScene } from "@/components/registry/demo-scene";

export default function FirmamentDemo() {
  return (
    <DemoScene
      background={<Firmament />}
      headline="Built for the dark"
      subhead="A parallax night sky — move your cursor to tilt it."
    />
  );
}
```

## Accessibility & performance

Honors `prefers-reduced-motion` with a designed static frame or fade (never a blank box) and passes `className` through. Pauses offscreen and on hidden tabs, clamps device pixel ratio, and tears down its GL/canvas context on unmount.
