swirl

Animated bands of colour twisting around a centre — pie-slice sectors at zero twist, full spirals at one. Drop bandCount to zero for concentric ripples.

Preview

live

Install

npm
npm i @devmischief/shaders-svelte

Code

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

<Swirl
  width={1280}
  height={720}
  colors={['#ff006e', '#fb5607', '#ffbe0b', '#06d6a0']}
  colorBack="#330000"
  bandCount={4}
  twist={0.1}
  center={0.2}
  proportion={0.5}
  softness={0}
  noise={0.2}
  noiseFrequency={0.4}
  scale={1}
  rotation={0}
  offsetX={0}
  offsetY={0}
  speed={0.32}
  fit="contain"
/>
			
			

Shader Props

11
namedescriptiontypevalues
colorsStripe colors of the swirl (up to 10).string[]hex / rgb
colorBackBackground color shown behind the swirl.stringhex / rgba
bandCountNumber of color bands. 0 = concentric ripples instead of bands.number0 → 15
twistVortex power. 0 = straight pie-slice sectors, 1 = full spiral.number0 → 1
centerHow far from the center the swirl colors begin to appear. Higher values leave a hole in the middle.number0 → 1
proportionBlend point between colors. 0.5 = equal distribution.number0 → 1
softnessColor transition sharpness. 0 = hard edge, 1 = smooth gradient.number0 → 1
noiseNoise distortion strength. No effect when noiseFrequency = 0.number0 → 1
noiseFrequencyFrequency of the noise distortion. No effect when noise = 0.number0 → 1
speedAnimation speed of the swirling motion.number0 → 3
fitHow the swirl 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