Move your mouse to see the spark effect!
Installation
Props
Prop | Type | Default | Description |
---|---|---|---|
width | number | 800 | Canvas width in pixels |
height | number | 600 | Canvas height in pixels |
theme | "light" | "dark" | "light" | Color theme for particles and background |
Features
- Mouse Tracking: Particles spawn at mouse cursor position
- Smooth Animation: Particles fade out with physics-based movement
- Theme Support: Light and dark color schemes
- Performance Optimized: Automatic particle cleanup and efficient rendering
- Responsive: Adapts to any canvas size
Usage Examples
Basic Usage
import MouseSpark from "@/components/mouse-spark";
export default function App() {
return (
<div className="relative h-screen">
<MouseSpark />
<div className="relative z-10 p-8">
<h1>Your content here</h1>
</div>
</div>
);
}
Custom Size and Theme
import MouseSpark from "@/components/mouse-spark";
export default function App() {
return (
<div className="relative h-96 w-full">
<MouseSpark width={800} height={400} theme="dark" />
</div>
);
}