webgl-atmosfera

Builds a lazy-loaded full-screen WebGL2 fragment-shader hero background on Astro and Cloudflare.

Updated Jun 17, 2026
One-click install
npx skills add https://github.com/ccediland/web-stack-skills --skill webgl-atmosfera-ccediland
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: webgl-atmosfera
Source: https://github.com/ccediland/web-stack-skills/tree/main/plugin/skills/webgl-atmosfera
Command: npx skills add https://github.com/ccediland/web-stack-skills --skill webgl-atmosfera-ccediland

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Adding an animated shader background behind a hero section often breaks Core Web Vitals, violates a hash-based Content Security Policy, and fails WCAG motion requirements. This Skill encodes the renderer choice, shader pattern, lazy-loading path, accessibility controls, and runtime cost caps so the atmosphere survives performance budgets and audits. ## Core Features & Use Cases - Renderer decision with vendored helper: Defaults to a zero-dependency raw WebGL2 helper, with OGL and twgl as documented alternatives and WebGPU ruled out for a single decorative draw call. - Copy-ready fbm domain-warp shader: A GLSL ES 3.0 flow-field shader with declared precision, bounded loops, and token-driven colors, plus the boundary where a CSS gradient is the better choice. - LCP/CLS-safe lazy init and CSP parity: Initializes via requestIdleCallback plus IntersectionObserver, reserves the canvas box, and relies on Astro's hash-emitted script-src with shaders as template literals. - Accessibility and fallback: A mandatory keyboard-operable pause control (WCAG SC 2.2.2), reduced-motion static fallback, context-loss handling, and a software-GL guard that refuses SwiftShader rendering. - Use Case: You want an animated gradient-mesh atmosphere behind your Astro hero. The Skill gives you the vendored helper, the shader, the lazy-init wiring, the pause button, and the scroll-to-uniform driver without adding any dependency. ## Quick Start Use the webgl-atmosfera skill to add a lazy-loaded WebGL2 shader atmosphere behind my Astro hero with a pause control and static fallback.

Frequently Asked Questions about webgl-atmosfera

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a WebGL shader background to an Astro hero?▼

Render the canvas in a static .astro component with a reserved CSS box, then initialize WebGL2 from a first-party script using requestIdleCallback plus IntersectionObserver. Author the shader as a JS template literal so Astro bundles and hash-emits it into script-src.

Raw WebGL2 vs OGL vs twgl for a full-screen shader?▼

A vendored raw WebGL2 helper is the default for a single decorative pass since it adds zero dependency bytes. Choose OGL 1.0.11 when a second render pass or texture is likely, or twgl 7.0.0 when you prefer a maintained helper over first-party WebGL code.

Does a WebGL canvas hurt LCP and CLS scores?▼

A canvas is never the LCP element, so the hero headline or image must render from static HTML independently. CLS stays at zero by giving the canvas an explicit CSS size before the context initializes and never resizing the laid-out box afterward.

Is a pause button required for an animated website background?▼

Yes. WCAG SC 2.2.2 (Level A) requires a pause, stop, or hide mechanism for auto-starting motion over five seconds that sits alongside content. prefers-reduced-motion and aria-hidden alone do not satisfy it, so a visible keyboard-operable pause control is mandatory.

Why does my shader animation fail in headless CI or on some machines?▼

GPU-less environments render the shader on the CPU via SwiftShader, which can produce extreme main-thread blocking. Set failIfMajorPerformanceCaveat, probe WEBGL_debug_renderer_info for software renderers, and watchdog early frames, falling back to a static image.

When should I use a CSS gradient instead of WebGL?▼

Use a CSS animated gradient when the design is a slow drift of two or three colors without per-pixel detail. WebGL is justified only for per-pixel noise, turbulence, or domain-warped flow at 60 fps that CSS cannot achieve efficiently.