voronoi

An animated Voronoi cell pattern with smooth, anti-aliased borders. Up to five base colours plus dedicated controls for cell gaps and inner glow.

Preview

live

Install

npm
npm i @devmischief/shaders-svelte

Code

import { Voronoi } from '@devmischief/shaders-svelte';

<Voronoi
  width={1280}
  height={720}
  colors={['#ff006e', '#ffbe0b', '#06d6a0']}
  colorGap="#2e0000"
  colorGlow="#ffffff"
  stepsPerColor={3}
  distortion={0.4}
  gap={0.04}
  glow={0}
  scale={0.5}
  rotation={0}
  offsetX={0}
  offsetY={0}
  speed={0.5}
  fit="none"
/>
			
			

Shader Props

9
namedescriptiontypevalues
colorsCell colors (up to 5).string[]hex / rgb
colorGapColor used for the gap between cells.stringhex / rgb
colorGlowColor tint of the radial inner shadow inside cells. Effective when glow > 0.stringhex / rgb
stepsPerColorExtra interpolated colors generated between each pair of base colors.number1 → 3
distortionStrength of noise-driven displacement of cell centers.number0 → 0.5
gapWidth of the border/gap between cells. Cannot be removed completely due to natural Voronoi border artifacts.number0 → 0.1
glowStrength of the radial inner shadow inside cells.number0 → 1
speedAnimation speed of the cell drift.number0 → 3
fitHow the pattern is fit into the canvas.stringnone · cover · contain

Common Props

6
namedescriptiontypevalues
originXReference point for positioning width in the canvas.number0 → 1
originYReference point for positioning height in the canvas.number0 → 1
worldWidthVirtual width of the graphic before it's scaled to fit the canvas.number
worldHeightVirtual height of the graphic before it's scaled to fit the canvas.number
minPixelRatioMinimum pixel ratio used when rendering the shader (default 2).number
maxPixelCountMaximum pixel count the shader may process.number

built with mischief by devmischief

@devmischief/shaders-svelte