dithering

A two-colour dither over seven procedurally generated patterns. Animated by default — pick a shape, pick an algorithm, dial in the pixel size.

Preview

live

Install

npm
npm i @devmischief/shaders-svelte

Code

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

<Dithering
  width={1280}
  height={720}
  colorBack="#191919"
  colorFront="#56ae6c"
  shape="warp"
  type="4x4"
  size={1}
  speed={1}
  scale={1}
  rotation={0}
  offsetX={0}
  offsetY={0}
  fit="none"
/>
			
			

Shader Props

7
namedescriptiontypevalues
colorBackBackground color of the dither.stringhex / rgba
colorFrontForeground (ink) color of the dither.stringhex / rgb
shapeProcedural pattern source.stringsimplex · warp · dots · wave · ripple · swirl · sphere
typeDithering algorithm.stringrandom · 2x2 · 4x4 · 8x8
sizePixel size of the dithering grid.number0.5 → 20
speedAnimation speed of the underlying pattern.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