spiral

An animated two-colour spiral with stroke taper, perspective falloff, and noise distortion. Goes from crisp geometry to flowing whirlpool to wavy rings.

Preview

live

Install

npm
npm i @devmischief/shaders-svelte

Code

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

<Spiral
  width={1280}
  height={720}
  colorBack="#001429"
  colorFront="#7ad1ff"
  density={1}
  distortion={0}
  strokeWidth={0.5}
  strokeTaper={0}
  strokeCap={0}
  noise={0}
  noiseFrequency={0}
  softness={0}
  scale={1}
  rotation={0}
  offsetX={0}
  offsetY={0}
  speed={1}
  fit="contain"
/>
			
			

Shader Props

12
namedescriptiontypevalues
colorBackBackground color shown behind the spiral.stringhex / rgba
colorFrontSpiral ink color.stringhex / rgb
densitySpacing falloff that simulates perspective. 0 = evenly-spaced flat spiral, 1 = full perspective.number0 → 1
distortionStrength of shape distortion along the spiral path.number0 → 1
strokeWidthThickness of the spiral curve.number0 → 1
strokeTaperStroke width loss away from center. 0 = full visibility everywhere.number0 → 1
strokeCapExtra stroke width at the center. No effect when strokeWidth = 0.5.number0 → 1
noiseNoise distortion strength. No effect when noiseFrequency = 0.number0 → 1
noiseFrequencyFrequency of the noise distortion. No effect when noise = 0.number0 → 1
softnessColor transition sharpness. 0 = hard edge, 1 = smooth gradient.number0 → 1
speedAnimation speed of the spinning spiral.number0 → 3
fitHow the spiral 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