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 | name | description | type | values |
|---|
| colors | Mesh gradient color spots (up to 10). | string[] | hex / rgb |
| distortion | Power of organic noise distortion. | number | 0 → 1 |
| swirl | Power of vortex distortion around the canvas center. | number | 0 → 1 |
| grainMixer | Grain distortion applied to color edges. | number | 0 → 1 |
| grainOverlay | Post-process black/white grain overlay. | number | 0 → 1 |
| speed | Animation speed of the flowing colors. | number | 0 → 3 |
| fit | How the gradient world is fit into the canvas. | string | cover · contain |
Common Props
6 | name | description | type | values |
|---|
| originX | Reference point for positioning width in the canvas. | number | 0 → 1 |
| originY | Reference point for positioning height in the canvas. | number | 0 → 1 |
| worldWidth | Virtual width of the graphic before it's scaled to fit the canvas. | number | — |
| worldHeight | Virtual height of the graphic before it's scaled to fit the canvas. | number | — |
| minPixelRatio | Minimum pixel ratio used when rendering the shader (default 2). | number | — |
| maxPixelCount | Maximum pixel count the shader may process. | number | — |