StealThis .dev

Particles System

Interactive canvas particle system with connected lines between nearby particles and mouse-driven attraction and repulsion.

Open in Lab
css javascript canvas vue svelte
Targets: TS JS HTML React Vue Svelte

Code

Particles System

An interactive canvas particle system where floating particles are connected by delicate lines when they drift close together. The mouse cursor acts as a force field, attracting or repelling particles on hover.

How it works

  1. A full-screen HTML Canvas renders particles with random positions and velocities
  2. Each frame, particles update positions, bounce off edges, and draw connecting lines to nearby neighbors
  3. Mouse movement creates an attraction/repulsion force that influences particle velocity
  4. requestAnimationFrame drives the render loop at native refresh rate

Customization

  • count — number of particles
  • color — particle and connection line color
  • connectionDistance — maximum distance for lines between particles
  • particleSize — radius range for particles
  • speed — velocity multiplier
  • Mouse interaction mode: attraction vs repulsion

When to use it

  • Hero section animated backgrounds
  • Landing page ambient effects
  • Network or connection visualization metaphors
  • Interactive decorative overlays