Effects Fancy Stable

FluidCursor

Full Navier-Stokes fluid simulation that swirls color in response to cursor and touch movement, running on WebGL2 with a WebGL1 fallback and an optional WebGPU HDR path for wide-gamut, brighter-than-white glow

Preview

Installation

pnpm add fancy-ui-svelte
import { FluidCursor } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { FluidCursor } from 'fancy-ui-svelte';
</script>

<FluidCursor />

Examples

Basic Usage

Custom Colors

Fixed teal fluid color.

HDR Mode

WebGPU engine with extended tone mapping — glows brighter than white on HDR displays. Requires a WebGPU browser (Chrome/Edge 129+, Safari 26+) plus an HDR screen for the full glow; otherwise falls back to wide-gamut WebGL (Chrome 104+, Safari 16.4+, Firefox 132+), then to standard rendering.

Bitmap Dithering

Retro ordered-dither rendering — the fluid is snapped to a chunky pixel grid and each color channel is quantized with a 4x4 Bayer threshold, so dot density encodes brightness. Forces the WebGL renderer (hdr is ignored).

Props

PropTypeDefaultDescription
simResolution number128Simulation grid resolution
dyeResolution number1440Dye/color buffer resolution
captureResolution number512Capture buffer resolution
densityDissipation number3.5Rate at which density fades
velocityDissipation number2Rate at which velocity fades
pressure number0.1Pressure solver strength
pressureIterations number20Number of pressure solver iterations
curl number3Amount of curl/vorticity
splatRadius number0.2Radius of fluid splats
splatForce number6000Force of fluid splats
shading booleantrueEnable fluid shading
colorUpdateSpeed number10Speed of color changes
backColor ColorRGB | string{ r: 0.5, g: 0, b: 0 }Background color
transparent booleantrueTransparent background
fluidColor string-Override all fluid with a single color
fluidColors string[]-Array of colors to cycle through for fluid splats
colorIntensity number0.15Intensity of color mixing
autoSplat booleanfalseAutomatically create random splats
autoSplatInterval number1500Interval between auto-splats in ms
interactive booleantrueReact to mouse/touch input
pauseWhenHidden booleantruePause simulation when tab is hidden
splatOnMount booleanfalseCreate a splat on mount
allowMultiple booleanfalseAllow multiple instances simultaneously
contained booleantrueConfine simulation to parent container
hdr booleanfalseRender via the WebGPU HDR engine — wide gamut + brighter-than-white glow on HDR displays. Needs Chrome/Edge 129+ or Safari 26+; falls back to wide-gamut WebGL (Chrome 104+, Safari 16.4+, Firefox 132+), then to standard rendering
hdrBoost number1.5Display exposure multiplier in HDR mode, clamped to [1, 4]
dither booleanfalseExperimental retro bitmap dithering — pixelates the fluid to a chunky grid and quantizes color with an ordered 4x4 Bayer threshold. Forces the WebGL renderer; hdr is ignored while set
ditherPixelSize number3Size of one dithered pixel in CSS pixels, minimum 1
ditherLevels number4Color levels per channel in dither mode, clamped to [2, 16]