background · Canvas 2D
LanternSky
A calm night sky of paper lanterns rising behind your content; your pointer is a warm breeze.
Night sky of paper lanterns rising at different depths; the pointer is a warm breeze
- Canvas 2D
- Reduced motion: still-frame
- 2.91 KB gzip
- Layout shift 0
Install
pnpm dlx shadcn@4.21.1 add @frictionborn/lantern-sky
Playground
import { LanternSky } from "@/components/ui/lantern-sky";
<LanternSky>
{children}
</LanternSky>In a full example
The full example loads as you scroll to it.
Accessibility
- The canvas is aria-hidden; your children stay real content above it on a dark ground. The sky moves while it is visible, so a visible Pause / Play button is built in (showPauseButton) and the runtime's pauseAll stops it too.
- Keyboard: The Pause / Play button
- Touch: None
- WCAG criteria it is built for: 1.4.3, 2.2.2
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
children | React.ReactNode | none | Content shown over the sky. |
density | number | 1.1 | Lanterns per 10,000 px² of sky. |
showPauseButton | boolean | true | A visible Pause / Play button (WCAG 2.2.2). |
palette | "fire" | "ice" | "neon" | "mono" | "custom" | "fire" | Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page. |
paused | boolean | false | Universal pause prop: the effect stops drawing; the control keeps working. |
maxTier | number | 3 | Hard ceiling on the capability tier. |
nonce | string | none | CSP nonce for the component's <style> element. |
className | string | "" | Extra classes on the root. |
style | React.CSSProperties | none | Inline styles on the root, merged after the palette variables. |
ref | React.Ref<HTMLDivElement> | none | Receives the root element. |
Measured on the bench
Measured by the automated bench at commit 801163e on 2026-10-21. These numbers are written by the bench, never by hand.
| Measure | Result |
|---|---|
| Size, gzip | 2.91 KB at load, 0.02 KB loaded later |
| Layout shift | 0 |
| Frames when nothing should move | off screen 0, hidden tab 0, reduced motion 0 |
| axe accessibility scan | 0 serious, 0 critical |
Browsers it ran in
Automated Playwright runs, some with device emulation. Results from physical phones and tablets are still pending, so none are listed.
| Environment | Tier | Result | Date | Notes |
|---|---|---|---|---|
| Chromium Desktop (SwiftShader) | 3 | pass | 2026-10-21 | 16 passed, 0 failed |
| Chromium Mobile (Pixel 7 emulation) | 2 | pass | 2026-10-21 | 15 passed, 0 failed |
| Firefox Desktop | 3 | pass | 2026-10-21 | 14 passed, 0 failed |
| WebKit Desktop | 3 | pass | 2026-10-21 | 14 passed, 0 failed, 1 flaky (passed on retry) |
| WebKit Mobile (iPhone 14 emulation) | 2 | pass | 2026-10-21 | 14 passed, 0 failed, 1 flaky (passed on retry) |
On different devices
Reduced motion (still-frame): One still frame of the sky with its lanterns; nothing moves and no pause button is needed.
| Tier | What it does |
|---|---|
| T3 Full | Animated at DPR <= 2 with every lantern |
| T2 Standard | Animated at DPR <= 1.5 with 60 % of the lanterns |
| T1 Lite | Same as tier 2 |
| T0 Static | One still frame of the sky (reduced motion, Save-Data, no WebGL2) |
Content Security Policy
- Works without
'unsafe-eval'. - Needs no reveal gate.
- Sets inline
styleattributes, so allowstyle-src-attr 'unsafe-inline'.