FluidCursor

A WebGL fluid simulation that follows your cursor. Move your mouse around to see the effect.

Usage

The FluidCursor component renders a full-screen WebGL canvas that creates fluid effects following mouse movement. It's typically used as a background effect.

<script>
  import { FluidCursor } from '$lib/fancy-ui/fluid-cursor';
</script>

<FluidCursor />

Move your cursor here

Props

PropTypeDefaultDescription
simResolutionnumber128Simulation resolution
dyeResolutionnumber1440Dye resolution for color rendering
densityDissipationnumber3.5How quickly the dye fades
velocityDissipationnumber2How quickly the velocity dissipates
pressurenumber0.1Pressure value for simulation
curlnumber3Curl/vorticity strength
splatRadiusnumber0.2Size of the splat effect
splatForcenumber6000Force of the splat effect
shadingbooleantrueEnable lighting/shading effect
colorUpdateSpeednumber10Speed of color cycling
transparentbooleantrueEnable transparent background

Notes

  • The component uses WebGL2 with fallback to WebGL1
  • Click to create a color splat effect
  • Move your mouse to create flowing fluid trails
  • Touch events are supported for mobile devices
  • The canvas automatically resizes with the window