Skip to content

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
View the source Spec sheet as Markdown

Install

Install
pnpm dlx shadcn@4.21.1 add @frictionborn/lantern-sky

Playground

Palette
Your code
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

PropTypeDefaultWhat it does
childrenReact.ReactNodenoneContent shown over the sky.
densitynumber1.1Lanterns per 10,000 px² of sky.
showPauseButtonbooleantrueA 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.
pausedbooleanfalseUniversal pause prop: the effect stops drawing; the control keeps working.
maxTiernumber3Hard ceiling on the capability tier.
noncestringnoneCSP nonce for the component's <style> element.
classNamestring""Extra classes on the root.
styleReact.CSSPropertiesnoneInline styles on the root, merged after the palette variables.
refReact.Ref<HTMLDivElement>noneReceives 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.

MeasureResult
Size, gzip2.91 KB at load, 0.02 KB loaded later
Layout shift0
Frames when nothing should moveoff screen 0, hidden tab 0, reduced motion 0
axe accessibility scan0 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.

EnvironmentTierResultDateNotes
Chromium Desktop (SwiftShader)3pass2026-10-2116 passed, 0 failed
Chromium Mobile (Pixel 7 emulation)2pass2026-10-2115 passed, 0 failed
Firefox Desktop3pass2026-10-2114 passed, 0 failed
WebKit Desktop3pass2026-10-2114 passed, 0 failed, 1 flaky (passed on retry)
WebKit Mobile (iPhone 14 emulation)2pass2026-10-2114 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.

TierWhat it does
T3 FullAnimated at DPR <= 2 with every lantern
T2 StandardAnimated at DPR <= 1.5 with 60 % of the lanterns
T1 LiteSame as tier 2
T0 StaticOne still frame of the sky (reduced motion, Save-Data, no WebGL2)

Content Security Policy

  • Works without 'unsafe-eval'.
  • Needs no reveal gate.
  • Sets inline style attributes, so allow style-src-attr 'unsafe-inline'.

Goes well with