Kinetic UI
Back to Introduction
Cursor Effects

Fluid Cursor Trail

A lightweight, performant HTML5 canvas fluid/smoke particle simulation that tracks your cursor velocity.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add fluid-cursor-trail
Fluid Cursor Trail

Fluid Cursor

Move your mouse around to generate a beautiful, performant HTML5 canvas smoke trail.

Installation

npx kinetic-ui-cli@latest add fluid-cursor-trail

How It Works

Instead of using an incredibly heavy WebGL Navier-Stokes fluid simulation solver (which can kill battery life and framerates), this component achieves a near-identical aesthetic using the native HTML5 Canvas 2D API. It spawns soft-edged radial gradients that inherit cursor momentum. By overlapping these gradients with globalCompositeOperation = "screen", they optically blend together to create the illusion of illuminated smoke.

Usage Guide

1. Import the Component

Import the component into your React or Next.js page:

import { FluidCursorTrail } from "@/components/creative/fluid-cursor-trail";

2. Implementation Example

Render the component and customize its behavior by passing props:

import { FluidCursorTrail } from "@/components/creative/fluid-cursor-trail";

export default function Example() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <FluidCursorTrail
        particleColors="example"
      />
    </div>
  );
}
Performance Notes
  • Uses CSS hardware acceleration via GPU transform-binds.
  • Damped interpolation minimizes paint-redraw flashes.
  • Tree-shakable import: only compiles elements requested.
Accessibility Notes
  • Full keyboard focus-ring navigation support (`Tab`/`Shift+Tab`).
  • ARIA roles mapped correctly for assistive screen readers.
  • Respects `prefers-reduced-motion` system toggles.