StealThis .dev

Flickering Grid

A canvas-based animated grid where cells randomly flicker and pulse their opacity, creating a living, breathing background texture.

Open in Lab
css javascript vue svelte
Targets: TS JS HTML React Vue Svelte

Code

Flickering Grid

A canvas-based animated grid where individual cells randomly pulse and flicker their opacity, producing a mesmerizing, living background texture.

How it works

  1. A <canvas> element fills its container.
  2. On each animation frame, each cell has a small random chance of beginning a flicker transition.
  3. Cells lerp their opacity toward a random target, then fade back, creating an organic breathing rhythm.
  4. requestAnimationFrame keeps the animation smooth and battery-friendly.

Performance

The animation uses a cell-based approach rather than per-pixel rendering, keeping the draw count low. Each frame only redraws cells whose opacity has changed, making it lightweight even on large screens.

When to use it

  • Background for hero sections or dashboards
  • Decorative layer behind modals or panels
  • Ambient texture for creative portfolios
  • Generative art experiments