Skip to content

Add WebGL lightning background animation#12

Merged
stefan-burke merged 2 commits into
mainfrom
claude/add-animated-background-nS3vu
Apr 24, 2026
Merged

Add WebGL lightning background animation#12
stefan-burke merged 2 commits into
mainfrom
claude/add-animated-background-nS3vu

Conversation

@stefan-burke
Copy link
Copy Markdown
Member

Summary

  • Adds a full-screen neon lightning background rendered with a single WebGL fragment shader — no three.js dependency (kept the bundle tiny; the whole animation is ~7 KB of JS plus a single <canvas>).
  • Three layered bolts use fbm domain warping and stacked sines to produce swooshing electric arcs tinted green / cyan / hot-white, with a rare brighter flash pulse.
  • Canvas sits at z-index: 10 with mix-blend-mode: screen, so only bright pixels add glow to content — text, nav, images, and the existing video backgrounds all stay readable on top.

Performance

  • Rendered at min(devicePixelRatio, 1.0) — half-res on retina, upscaled. The soft glow hides pixelation.
  • requestAnimationFrame, pauses via document.visibilitychange.
  • prefers-reduced-motion → draws one static frame and stops.
  • Graceful fallback: if WebGL is unavailable the canvas stays empty and nothing breaks.

Test plan

  • Open the site locally and scroll through — lightning should be visible and animating behind every section
  • Nav bar, buttons, links remain readable/clickable
  • Video background blocks on home still play on top of the canvas
  • Toggle "reduce motion" in OS/browser settings → animation should freeze
  • Hide tab for ~30s, restore → animation picks back up without hogging CPU
  • Check on a low-powered device (e.g. older Android) — should render smoothly

https://claude.ai/code/session_01W7B4JkZktZyNdyAf7BZthU


Generated by Claude Code

claude added 2 commits April 24, 2026 15:39
Adds a full-screen neon lightning background rendered with a single
WebGL fragment shader. Three layered bolts use fbm domain warping and
stacked sines to produce swooshing electric arcs tinted green / cyan /
hot-white. The canvas sits at z-index 10 with mix-blend-mode: screen
so only the bright pixels show and text / nav / video backgrounds stay
readable on top.

Half-resolution rendering (dpr capped at 1), rAF-driven, pauses on tab
hide, degrades gracefully on no-WebGL, and drops to a single static
frame when prefers-reduced-motion is set.

https://claude.ai/code/session_01W7B4JkZktZyNdyAf7BZthU
- Canvas moves to z-index: -1 with no mix-blend-mode, so it reads as
  part of the page's background rather than an overlay. Cards, image /
  video backgrounds and the nav all sit in front of it.
- Body and section surfaces become transparent (via --body-background
  and --body-background-alt) so the canvas shows through the gaps.
- Base palette darkened: --color-bg, --color-card-bg and --color-accent
  all drop a couple of stops. html is given a near-black fallback
  colour in case WebGL fails.
- Shader dimmed and given a dark base tone so the viewport doesn't
  flash pure black between strokes now that we're no longer screening
  the glow on top of existing colour.

https://claude.ai/code/session_01W7B4JkZktZyNdyAf7BZthU
@stefan-burke stefan-burke merged commit 3368dcd into main Apr 24, 2026
4 checks passed
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.

2 participants