dot grid

A static grid of geometric shapes — circles, diamonds, squares, or triangles — with independent X/Y spacing, fill, stroke, and randomization controls.

Preview

live

Install

npm
npm i @devmischief/shaders-svelte

Code

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

<DotGrid
  width={1280}
  height={720}
  colorBack="#000000"
  colorFill="#ffffff"
  colorStroke="#ffaa00"
  shape="circle"
  size={2}
  gapX={32}
  gapY={32}
  strokeWidth={0}
  sizeRange={0}
  opacityRange={0}
  scale={1}
  rotation={0}
  offsetX={0}
  offsetY={0}
  fit="none"
/>
			
			

Shader Props

11
namedescriptiontypevalues
colorBackBackground color shown behind the dots.stringhex / rgba
colorFillFill color of each shape.stringhex / rgb
colorStrokeStroke (outline) color of each shape. Visible when strokeWidth > 0.stringhex / rgb
shapeShape rendered at every grid cell.stringcircle · diamond · square · triangle
sizeBase size of each shape in pixels.number1 → 100
gapXHorizontal spacing between cell centers in pixels.number2 → 500
gapYVertical spacing between cell centers in pixels.number2 → 500
strokeWidthOutline stroke width in pixels.number0 → 50
sizeRangeRandom per-dot size variation. 0 = uniform, higher = more variation up to base size.number0 → 1
opacityRangeRandom per-dot opacity variation. 0 = fully opaque, higher = more transparency.number0 → 1
fitHow the dot grid 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