For Tailwind CSS v3 docs, click here.

Fluid Cursor

A GPU-accelerated animated cursor trail that simulates fluid motion.

API

Prop NameTypeDefaultDescription
simResolutionnumber128Resolution for the simulation grid affecting fluid detail and performance.
dyeResolutionnumber1440Resolution for the fluid dye (color) texture.
captureResolutionnumber512Resolution for capturing input events.
densityDissipationnumber3.5Rate at which color density dissipates over time.
velocityDissipationnumber2Rate at which velocity dissipates over time, affecting fluid momentum persistence.
pressurenumber0.1Pressure factor used in fluid physics calculations.
pressureIterationsnumber20Number of iterations for pressure solver accuracy.
curlnumber3Intensity of curl/vorticity effect to enhance swirling motions.
splatRadiusnumber0.2Radius of the pointer's splat effect in the fluid.
splatForcenumber6000Force applied by the pointer to the fluid on interaction.
shadingbooleantrueEnable or disable shading effects for depth and light on fluid colors.
colorUpdateSpeednumber10Speed at which pointer colors update dynamically.
backColorobject{ r: 0.5, g: 0, b: 0 }Background color of the fluid in RGB format.
transparentbooleantrueWhether the canvas background is transparent.
classstringundefinedAdditional CSS classes for the outer container div.

Install using CLI

npm
pnpm
bun
yarn
npx shadcn-vue@latest add "https://registry.inspira-ui.com/fluid-cursor.json"

Install Manually

Copy and paste the following code:

FluidCursor.vue

Features

  • GPU-powered fluid simulation: Smooth and performant fluid dynamics using WebGL shaders.
  • Pointer interaction: Fluid responds dynamically to mouse and touch input with colorful splats.
  • Customizable physics: Adjustable simulation resolution, pressure, curl, and dissipation parameters.
  • Shading effects: Optional lighting/shading for enhanced 3D fluid appearance.
  • Responsive canvas: Automatically resizes and adapts to device pixel ratio for crisp visuals.
  • Background control: Support for transparent or solid colored backgrounds.

Credits

  • Inspired from Fluid Cursor by Cursify
  • Utilizes WebGL 1/2 context and custom GLSL shaders for fluid physics and rendering.