static mesh gradient

A multi-point mesh gradient driven by two perpendicular sine waves. Static by default — flip a layout seed, or animate by setting speed above zero.

Preview

live

Install

npm
npm i @devmischief/shaders-svelte

Code

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

<StaticMeshGradient
  width={1280}
  height={720}
  colors={['#3a86ff', '#8338ec', '#ff006e', '#fb5607', '#ffbe0b']}
  positions={2}
  waveX={1}
  waveXShift={0.6}
  waveY={1}
  waveYShift={0.21}
  mixing={0.93}
  grainMixer={0}
  grainOverlay={0}
  scale={1}
  rotation={270}
  offsetX={0}
  offsetY={0}
  speed={0}
  fit="contain"
/>
			
			

Shader Props

11
namedescriptiontypevalues
colorsMesh gradient color spots (up to 10).string[]hex / rgb
positionsSeed for color-spot placement. Each integer produces a different layout.number0 → 100
waveXStrength of the X-axis sine wave distortion.number0 → 1
waveXShiftPhase offset of the X-axis wave.number0 → 1
waveYStrength of the Y-axis sine wave distortion.number0 → 1
waveYShiftPhase offset of the Y-axis wave.number0 → 1
mixingBlend sharpness. 0 = hard stripes, 0.5 = smooth bands, 1 = gradual blend.number0 → 1
grainMixerGrain distortion applied to color edges.number0 → 1
grainOverlayPost-process black/white grain overlay.number0 → 1
speedAnimation speed. Default 0 — the mesh is static unless you set this above zero.number0 → 3
fitHow the gradient world is fit into the canvas.stringcover · 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