Voronoi
Installation
npm i @paper-design/shaders-react
Code
import { Voronoi } from '@paper-design/shaders-react'; <Voronoi height={500} colors={["#cc3333", "#cc9933"]} colorGlow="#ffffff" colorGap="#2e0000" stepsPerColor={3} distortion={0.4} gap={0.04} glow={0} scale={0.5} rotation={0} speed={0.5} />
Props
Name | Description | Type | Values |
---|---|---|---|
colors | Base cell colors (up to 10) | string[] | Hex, RGB, or HSL color |
colorGlow | Color tint for the radial inner shadow effect inside cells (effective with glow > 0) | string | Hex, RGB, or HSL color |
colorGap | Color used for cell borders/gaps | string | Hex, RGB, or HSL color |
stepsPerColor | Number of extra colors between base colors (1 = N color palette, 2 = 2×N color palette, 3 = 3×N color palette, etc) | number | 1 to 3 (integer) |
distortion | Strength of noise-driven displacement of cell centers | number | 0 to 0.5 |
gap | Width of the border/gap between cells | number | 0 to 0.1 |
glow | Strength of the radial inner shadow inside cells | number | 0 to 1 |
width | CSS width style of the shader element | number | string | — |
height | CSS height style of the shader element | number | string | — |
scale | Overall zoom level of the graphics | number | 0.01 to 4 |
rotation | Overall rotation angle of the graphics | number | 0 to 360 |
speed | Animation speed | number | 0 to 1 |
Description
Anti-aliased animated Voronoi pattern with smooth and customizable edges.
Notes
Thanks to Inigo Quilez for the amazing solution on Voronoi cell boundaries.