Particle Background Animation
Interactive particle system with mouse tracking, gravity effects, and customizable configurations. Perfect for hero sections and landing pages.
Responsive Design
Yes
Dark Mode Support
No
lines
270
Browser Compatibility
No
Live Preview
Interact with the component without leaving the page.
Particle Background Animation
An interactive particle system with mouse tracking, gravity effects, and customizable color schemes. Perfect for creating engaging hero sections and dynamic backgrounds.
Features
- Mouse Interaction: Particles respond to mouse movement with realistic physics
- Gravity Toggle: Switch between floating and gravity-affected particle behavior
- Color Schemes: Multiple predefined color palettes for different moods
- Connection Lines: Dynamic lines connect nearby particles
- Responsive Design: Adapts to different screen sizes
- Performance Optimized: Efficient rendering with requestAnimationFrame
Usage
The particle system automatically initializes when the page loads. Use the control buttons to:
- Reset: Regenerate all particles with new positions
- Toggle Gravity: Enable/disable gravitational pull
- Change Colors: Cycle through different color schemes
Customization
You can customize the particle system by modifying:
particleCount: Number of particles (calculated based on canvas size)mouse.radius: Interaction radius around the mouse cursorcolorSchemes: Array of color palettes- Connection distance threshold for drawing lines between particles
Perfect for modern websites, landing pages, and interactive backgrounds that need a touch of dynamic visual appeal.
HTML
12
lines
CSS
95
lines
JavaScript
163
lines
<div class="particle-demo">
<canvas id="particleCanvas"></canvas>
<div class="particle-overlay">
<h1>Interactive Particle System</h1>
<p>Move your mouse to interact with particles</p>
<div class="particle-controls">
<button id="resetBtn">Reset</button>
<button id="gravityBtn">Toggle Gravity</button>
<button id="colorBtn">Change Colors</button>
</div>
</div>
</div>