water

A caustic water-surface distortion. Use it as an image filter for shimmering reflections, or run it standalone as an animated texture.

Preview

live
Click the preview to load a random sample image.

Install

npm
npm i @devmischief/shaders-svelte

Code

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

<Water
  width={1280}
  height={720}
  image="/assets/flowers.webp"
  colorBack="#8f8f8f"
  colorHighlight="#ffffff"
  highlights={0.07}
  layering={0.5}
  edges={0.8}
  waves={0.3}
  caustic={0.1}
  size={1}
  scale={0.8}
  rotation={0}
  offsetX={0}
  offsetY={0}
  speed={1}
  fit="contain"
/>
			
			

Shader Props

10
namedescriptiontypevalues
imageOptional source image. Without one, the shader renders a standalone water texture.stringurl
colorBackBackground color visible through transparent regions of the image.stringhex / rgba
colorHighlightColor of the caustic highlights and crests.stringhex / rgb
highlightsStrength of the highlight color overlaid along the caustic shape.number0 → 1
layeringStrength of the secondary caustic layer for added depth.number0 → 1
edgesCaustic distortion power along the image edges.number0 → 1
wavesAdditional simplex-noise distortion, independent of the caustic.number0 → 1
causticPower of the primary caustic distortion.number0 → 1
sizePattern scale of the water texture.number0.01 → 7
fitHow the source image is fit into the canvas.stringcover · contain

Common Props

9
namedescriptiontypevalues
scaleOverall zoom level of the graphics.number0.01 → 4
rotationOverall rotation angle of the graphics.number0 → 360
offsetXHorizontal offset of the graphics.number−1 → 1
offsetYVertical offset of the graphics.number−1 → 1
originXReference point for positioning width in the canvas.number0 → 1
originYReference point for positioning height in the canvas.number0 → 1
speedAnimation speed multiplier (default 1).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