Particle System

First appeared 1983 · William Reeves — William Reeves, "Particle Systems" (SIGGRAPH 1983). · timeline ↗

inventor-coined Name · coined by William Reeves (1983) — Descriptive name coined by its author: Reeves titled the 1983 SIGGRAPH paper "Particle Systems".

In one line A general framework that simulates many small particles, each with properties like position, velocity and lifespan, updated together each frame. It is the umbrella under which flow fields, boids, and physics sketches sit.

Particle System · Open in new tab ↗ · Motion begins only when you press Run.

The code

The actual sketch behind the demo above — sandboxed and reproducible. This is the whole thing.

particle-system/index.html
const SEED = Math.floor(Math.random()*1e9);

let particles = [];
let attractors = [];

function setup() {
  randomSeed(SEED);
  const s = Math.min(windowWidth, windowHeight);
  createCanvas(s, s);
  background('#0a0a0a');

  // Particles with velocity/lifetime, pulled toward a few attractor points.
  const N_ATTR = 3 + Math.floor(random(3));
  for (let i = 0; i < N_ATTR; i++) {
    attractors.push({ x: random(width * 0.2, width * 0.8), y: random(height * 0.2, height * 0.8) });
  }
  for (let i = 0; i < 1200; i++) {
    particles.push({
      x: random(width), y: random(height),
      vx: 0, vy: 0,
      life: random(150, 350),
      hue: random(360),
    });
  }
  colorMode(HSB, 360, 100, 100, 100);
  noStroke();
}

function draw() {
  // Faint trails by drawing a translucent black rectangle each frame.
  fill(0, 0, 0, 8);
  rect(0, 0, width, height);

  for (const p of particles) {
    for (const a of attractors) {
      const dx = a.x - p.x;
      const dy = a.y - p.y;
      const d2 = dx * dx + dy * dy + 50;
      const f = 24 / d2;
      p.vx += dx * f;
      p.vy += dy * f;
    }
    p.vx *= 0.98; p.vy *= 0.98;
    p.x += p.vx; p.y += p.vy;
    p.life--;
    if (p.life <= 0 || p.x < 0 || p.y < 0 || p.x >= width || p.y >= height) {
      p.x = random(width); p.y = random(height);
      p.vx = 0; p.vy = 0;
      p.life = random(150, 350);
    }
    fill(p.hue, 80, 95, 75);
    circle(p.x, p.y, 1.6);
  }
  // Hide attractors for cleaner look (uncomment to see):
  // fill(0,0,100); for (const a of attractors) circle(a.x, a.y, 6);
}

Open the demo source ↗

How it works

Maintain an array of particles, each holding state (position, velocity, age, colour, size…). Each frame: 1. Emit: spawn new particles from one or more sources, with initial values (often randomised within ranges). 2. Update: for every particle, accumulate forces (gravity, drag, a flow field, attraction/repulsion), integrate velocity then position, and age it. 3. Cull: remove particles past their lifespan or out of bounds. 4. Render: draw each particle (point, sprite, or a trail of past positions). The visual character comes entirely from the forces and emission rules; swapping the force function turns the same engine into smoke, sparks, flocking or flow-field art.

Parameters

Lineage

Precedents
Karl Sims
Related
Boids / Flocking, Physics Simulation, Spring-Mass / Verlet

Frequently combined with

Works using this algorithm (63)

36 Points
sage-jenson
Aether
mfx
Agenda Circling Forth
fairlight
Amoeba
last-even
Asterisms
falko
Attraction
jos-vromans
Axo
jiwa
Blitzgewitter
titan
Blóm
lucas-swick
Blooms
cory-haber
Bubble Chamber
jared-tarbell
Chain
leander-herzog
Cyber Cities
pxlq
D-D-Dots
tuplart
Democracity
generative-artworks
Drift
paolo-ceric
Electriz
che-yu-wu
Essenza
stefano-contiero
Fantasía
alejandro-campos
Fleur
anapet
Flows
ryley-o-eth
Gen 2
dca
Gravilux
scott-snibbe
Gravity 12
jimmy-herdberg
Gravity 16
jimmy-herdberg
hälo
p1xelfool
Hōrō
makio135
HyperHash
beervangeer
Lacunae
james-dalessandro
Latent Spirits
robert-hodgin
Letters to My Future Self
ryan-struhl
Low Tide
artem-verkhovskiy-x-andy-shaw
Magnetosphere
robert-hodgin
marfaMESH
harvey-rayner
Memories of Qilin
emily-xie
Mycelia
jmy
Naïve
olga-fradina
Non Either
rafael-rozendaal
Octo Garden
rich-lord
Organized Disruption
joshua-davis
Panspermia
karl-sims
Phototaxis
casey-reas
Pixel Noir
antoine-schmitt
Polychrome Music
rafael-rozendaal-danny-wolfers-legowelt
Pre-Process
casey-reas
PrimiDance
wuwa
PrimiEnd
wuwa
Process 18 (Software 3)
casey-reas
send/receive
snowfro
Space Debris [m'aider]
whalestreet-x-pxlq
Space Debris [ravaged]
whalestreet-x-pxlq
Space Debris [warning]
whalestreet-x-pxlq
Star Flower
ruben-alexander
Subscapes
matt-deslauriers
Synapses
chaosconstruct
Through Curved Air
jacob-gold
UltraWave 369
beervangeer
undead wyverns
hideo
Universe of Water Particles
teamlab
Valence
ben-fry

References

Last updated 2026-07-16