Mouse Animations

A lightweight, framework-agnostic JavaScript library for cursor and mouse effects: trail, ripple, custom cursor, magnetic, particles, parallax, and tilt.
TypeScript support with full type definitions.
Also available as a jQuery plugin.

Zero dependencies.

Under 5 kB gzipped.

Trail

Fading dots that follow the cursor on a full-page canvas overlay.

Move your mouse anywhere on the page

#a78bfa
Usage

Ripple

Expanding circle animation at each click position.

Click anywhere to trigger

#a78bfa
Usage

Custom Cursor

Replaces the native cursor with a dot and a smoothly lagging outer ring.

Move your mouse โ€” cursor applies to the whole page

#a78bfa
#a78bfa
Usage

Magnetic

Elements are pulled toward the cursor as it approaches within the activation radius.

Usage

Particles

Coloured canvas particles burst from each click position with gravity and air resistance.

Click anywhere to burst

Usage

Parallax

Elements float and shift based on mouse position across the viewport โ€” great for depth-layered hero sections.

Move your mouse across the page
Usage

Tilt

3D perspective tilt that follows the cursor within each element, with an optional glare highlight.

Card A
Card B
Card C
Usage

jQuery Plugin

All effects are available as jQuery methods. Import the plugin once โ€” it extends $.fn automatically.

Installation
npm install mouse-animations jquery
Import
import 'mouse-animations/jquery';

// extends $.fn โ€” no return value needed
Usage
// Global effects
$('body').trail({ color: '#a78bfa', size: 8 });
$('body').ripple({ duration: 700, maxSize: 120 });
$('body').customCursor({ innerColor: '#a78bfa', smoothness: 0.12 });
$('body').particles({ count: 24 });

// Magnetic โ€” selector auto-derived from the jQuery set
$('.btn').magnetic({ strength: 0.4, radius: 120 });

// Parallax โ€” elements shift on mouse move
$('.layer').parallax({ depth: 20, ease: 0.1 });

// Tilt โ€” 3D perspective tilt with optional glare
$('.card').tilt({ maxTilt: 15, perspective: 800, glare: true });

// enable / disable / destroy on any plugin
$('body').trail('disable');
$('body').trail('enable');
$('body').trail('destroy');