grain gradient

A multi-colour gradient with grainy texture, available in seven animated abstract forms — from soft blobs to sharp corners to ripples and spheres.

Preview

live

Install

npm
npm i @devmischief/shaders-svelte

Code

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

<GrainGradient
  width={1280}
  height={720}
  colors={['#3a86ff', '#06d6a0', '#ffd166', '#ef476f']}
  colorBack="#000000"
  shape="corners"
  softness={0.5}
  intensity={0.5}
  noise={0.25}
  scale={1}
  rotation={0}
  offsetX={0}
  offsetY={0}
  speed={1}
  fit="contain"
/>
			
			

Shader Props

8
namedescriptiontypevalues
colorsGradient colors (up to 7).string[]hex / rgb
colorBackBackground color shown beyond the gradient.stringhex / rgba
shapeUnderlying gradient shape.stringwave · dots · truchet · corners · ripple · blob · sphere
softnessColor transition sharpness. 0 = hard edge, 1 = smooth gradient.number0 → 1
intensityDistortion power between color bands.number0 → 1
noiseStrength of the grainy noise overlay.number0 → 1
speedAnimation speed of the gradient.number0 → 3
fitHow the gradient world 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