mesh gradient

A flowing composition of color spots moving along distinct trajectories, transformed by organic distortion and optional swirl.

Preview

live

Install

npm
npm i @devmischief/shaders-svelte

Code

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

<MeshGradient
  width={1280}
  height={720}
  colors={['#ff6b9d', '#ff9966', '#ffd06b', '#a8e6cf', '#7eb6ff']}
  distortion={0.8}
  swirl={0.1}
  grainMixer={0}
  grainOverlay={0}
  scale={1}
  rotation={0}
  offsetX={0}
  offsetY={0}
  speed={1}
  fit="contain"
/>
			
			

Shader Props

7
namedescriptiontypevalues
colorsMesh gradient color spots (up to 10).string[]hex / rgb
distortionPower of organic noise distortion.number0 → 1
swirlPower of vortex distortion around the canvas center.number0 → 1
grainMixerGrain distortion applied to color edges.number0 → 1
grainOverlayPost-process black/white grain overlay.number0 → 1
speedAnimation speed of the flowing colors.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