static radial gradient

A radial gradient with up to ten colors, an off-center focal point, custom falloff curve, and optional radial distortion. Static by default.

Preview

live

Install

npm
npm i @devmischief/shaders-svelte

Code

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

<StaticRadialGradient
  width={1280}
  height={720}
  colors={['#00bbff', '#00ffe1', '#ffffff', '#6bd8ff', '#ffe77a']}
  colorBack="#191919"
  radius={0.8}
  focalDistance={0.99}
  focalAngle={0}
  falloff={0.24}
  mixing={0.5}
  distortion={0}
  distortionShift={0}
  distortionFreq={12}
  grainMixer={0}
  grainOverlay={0}
  scale={1}
  rotation={0}
  offsetX={0}
  offsetY={0}
  speed={0}
  fit="contain"
/>
			
			

Shader Props

14
namedescriptiontypevalues
colorsRadial gradient colors (up to 10).string[]hex / rgb
colorBackBackground color shown beyond the gradient.stringhex / rgba
radiusSize of the radial gradient shape.number0 → 3
focalDistanceDistance of the focal point from canvas center.number0 → 3
focalAngleDirection of the focal point. Effective when focalDistance > 0.number0 → 360°
falloffGradient decay curve. 0 = linear, negative compresses toward the rim, positive stretches outward.number−1 → 1
mixingBlend sharpness. 0 = hard stripes, 1 = smooth gradient.number0 → 1
distortionStrength of radial distortion.number0 → 1
distortionShiftRadial distortion phase offset. Effective when distortion > 0.number−1 → 1
distortionFreqRadial distortion frequency. Higher values produce tighter wrinkles.number0 → 20
grainMixerGrain distortion applied to color edges.number0 → 1
grainOverlayPost-process black/white grain overlay.number0 → 1
speedAnimation speed. Default 0 — the gradient 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