Skip to content
Backgrounds Fancy Stable

FlickeringGrid

.md

Canvas grid of squares that flicker in and out of opacity at random each frame, pausing automatically via IntersectionObserver when scrolled off-screen and resizing to fit its container via ResizeObserver

Available for Svelte 5, React, and Vue 3.

Preview

Installation

pnpm add fancy-ui-svelte
import { FlickeringGrid } from "fancy-ui-svelte";

Usage

svelte
<script lang="ts">
  import { FlickeringGrid } from 'fancy-ui-svelte';
</script>

<FlickeringGrid color="#6366f1" maxOpacity={0.2} squareSize={4} gridGap={6} />

Examples

Basic Usage

Custom Colors

Grid Size Variations

Interactive Playground

Props

PropTypeDefaultDescription
squareSize number4Size of each grid square in pixels
gridGap number6Gap between squares in pixels
flickerChance number0.3Probability of a square changing opacity each second (0-1)
color string"currentColor"Color of the squares: a hex string, or currentColor to follow the text colour
maxOpacity number0.3Maximum opacity of squares (0-1)
width number-Fixed width in pixels (defaults to container width)
height number-Fixed height in pixels (defaults to container height)