FluidCursorAdvanced

WebGL fluid simulation confined to a parent container. Unlike FluidCursor, it fills its parent element instead of covering the full viewport.

Preview

Move your cursor here

Pick a container

Click any card to activate the fluid inside it — the simulation stays confined to that container. Click again to deactivate.

Autonomous mode

Combine autoSplat with interactive={false} for a fluid background that animates without any cursor interaction — great for mobile and above-the-fold heroes.

No cursor needed — works on mobile too

Splat on mount

splatOnMount fires 3–5 random splats the moment the component mounts — useful for an immediate "alive" feeling.

Move your cursor to interact

Usage

<script>
  import { FluidCursorAdvanced } from 'fancy-ui';
</script>

<!-- Parent must be relative + overflow-hidden -->
<div class="relative h-64 overflow-hidden rounded-xl">
  <FluidCursorAdvanced
    fluidColors={["#6366f1", "#ec4899", "#06b6d4"]}
    colorIntensity={0.5}
    backColor={{ r: 0.04, g: 0.04, b: 0.08 }}
  />
</div>

Props

PropTypeDefaultDescription
fluidColorstringFixed fluid color (hex). Disables random cycling.
fluidColorsstring[]Palette of hex colors to cycle through on each splat.
colorIntensitynumber0.15Intensity multiplier applied to fluid colors (0–1).
backColor{ r, g, b } | string{ r: 0.5, g: 0, b: 0 }Background color — RGB object or hex string.
densityDissipationnumber3.5How quickly the dye fades.
velocityDissipationnumber2How quickly the velocity dissipates.
curlnumber3Curl/vorticity strength.
splatRadiusnumber0.2Size of the splat effect.
splatForcenumber6000Force of the splat effect.
shadingbooleantrueEnable lighting/shading effect.
transparentbooleantrueEnable transparent background.
interactivebooleantrueWhen false, removes all mouse/touch listeners. Combine with autoSplat for ambient animations.
autoSplatbooleanfalseFires random splats at a fixed interval without user interaction.
autoSplatIntervalnumber1500Interval in ms between auto splats.
splatOnMountbooleanfalseFires 3–5 random splats when the component mounts.
pauseWhenHiddenbooleantruePauses the animation loop when the canvas is scrolled out of view.

Credits