Backgrounds Fancy Stable

FlickeringGrid

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

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 />

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"#000000"Color of the squares (hex format)
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)