Skip to content

feat: add RainBackdrop animated rain background component - #33

Merged
nsollazzo merged 1 commit into
mainfrom
feat/rain-background
Jul 2, 2026
Merged

feat: add RainBackdrop animated rain background component#33
nsollazzo merged 1 commit into
mainfrom
feat/rain-background

Conversation

@nsollazzo

Copy link
Copy Markdown
Collaborator

What

A new RainBackdrop component — an animated, canvas-based rain background that drops in exactly where the graph-paper Backdrop goes (same wrapper contract; the grid is untouched, you pick per page).

  • Theme-following ink: rain strokes use --pn-ink (white on machine, black on samaritan) and recolor live when data-theme flips — a MutationObserver re-reads the tokens, no remount needed.
  • intensity (0–1, default 0.5): rain amount; 0 disables.
  • accentRatio (default 0.03): fraction of drops tinted --pn-accent red; 0 disables.
  • speed: fall multiplier (floored at 0.05).
  • splash (default true): drops hitting the bottom edge burst into 3–6 gravity-arc spray particles.
  • Reduced motion: prefers-reduced-motion renders a static sparse frame, no rAF loop (library pattern via reducedMotion).
  • Bounded on tall pages: backing-store scale and drop count are capped so a full-page-height canvas degrades in resolution instead of exceeding browser canvas limits (where drawing silently fails) or simulating thousands of offscreen drops.

Ships with browser-mode tests for both motion paths, Storybook stories (both themes + a live-controls Playground with an in-page ThemeToggle), the barrel export, and a minor changeset.

Why

A live rain alternative to the static grid backdrop: theme-aware (black rain in light mode, white in dark), with controllable amount, occasional red drops, and ground-impact "explosions".

Verification

  • pnpm check, pnpm lint clean; pnpm test 300/300 across all three vitest projects; coverage gates hold (component at 98% statements / 100% lines).
  • Runtime check in headless Chromium against Storybook: pixel sampling found only-white rain on machine (3598 light / 0 dark px), only-black on samaritan (0 / 3388), red accent pixels in both themes, bottom-edge splash activity, and consecutive frames differing (live animation). Screenshots visually confirmed.
  • Review pass (3 parallel reviewers): 4 findings fixed pre-PR (canvas-limit bound, drop-count cap, negative first-frame dt clamp, speed floor docs).

🤖 Generated with Claude Code

A canvas rAF rain layer as a drop-in sibling of Backdrop: theme-ink rain
(white on machine, black on samaritan) with live recolor on theme flip,
accent-red drop fraction (accentRatio, default 3%), intensity control,
and splash-particle bursts at the bottom edge. Reduced motion renders a
static sparse frame. Canvas backing store and drop count are bounded so
very tall pages degrade in resolution instead of silently not drawing.

Includes browser-mode tests (both motion paths), Storybook stories with
a live-controls Playground, barrel export, and a minor changeset.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nsollazzo
nsollazzo merged commit 9bf4929 into main Jul 2, 2026
11 checks passed
@nsollazzo
nsollazzo deleted the feat/rain-background branch July 2, 2026 13:50
@nsollazzo nsollazzo mentioned this pull request Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant