Installation
- Tab Title
- Tab Title
Usage
Props
The interactive element(s) that will trigger particle effects.
Configuration object for customizing particle behavior.
CoolParticleOptions
The particle type to display. Can be:
'circle'- Colored circles- Emoji string (e.g.,
'🎉','⭐','❤️') - Image URL (starts with
httpor/)
Maximum number of particles that can exist at once.
Size of each particle in pixels. If not specified, randomly chosen from [15, 20, 25, 35, 45].
Horizontal speed multiplier for particle movement.
Vertical speed for particles moving upward.
Examples
With Emoji Particles
With Custom Image
Custom Particle Settings
Multiple Elements
Circle Particles (Default)
How It Works
The component creates a fixed overlay container where particles are rendered. When you click and drag (or touch and drag on mobile) over the wrapped element:- Particles are generated at the cursor position
- Each particle has random horizontal direction, rotation, and speed
- Particles animate upward with decreasing speed (gravity simulation)
- Particles are automatically removed when they fall off-screen
- The overlay container is removed when no instances remain
Features
- Works with both mouse and touch events
- Supports multiple particle types (circles, emojis, images)
- Automatic cleanup when particles leave viewport
- Performance-optimized with RAF (requestAnimationFrame)
- Global particle container shared across instances
- Throttled particle generation to prevent performance issues
- Customizable particle physics (speed, direction, rotation)
Touch Support
The component automatically detects touch-capable devices and uses the appropriate event listeners (touchstart, touchmove, touchend instead of mousedown, mousemove, mouseup).