Fireworks, muzzle flashes, snow, spell trails, that fountain of confetti when you
beat your high score — under the hood they are all the same three lines,
run on thousands of dots at once. You're about to own a AAA particle editor,
and understand every slider in it.
press play — 90 seconds ↓
The lesson · a 90-second movie you can touch
Press play. It explains itself.
Plays like the video — one caption at a time, the picture animating under it —
and it pauses when it's your turn. Skip around with the dots or arrow keys.
The full lab comes after.
Forget "physics engine" as a scary phrase. Per frame, per particle,
a game does exactly this: add up the pushes, let the pushes change the speed,
let the speed change the place. That's it. That's the chapter.
particle.js — the update loop
force=gravity+wind+…// decide the pushesvelocity=velocity+force·dt// pushes change speedposition=position+velocity·dt// speed changes place
↑ this is literally F = m·a rearranged (m = 1, so a = F)every physics engine ever, simplified — Unity, Unreal, the lot
click to launch the ball →
F = (0.0, 9.8)← gravity never stops pushing
v = (0.0, 0.0)
position = (46, 274) · 1 unit = 60 px
Step 2 · The playground
Your particle editor
Click or hold anywhere in the box to spray particles.
Every dot in there is running the three lines above, nothing more. The sliders
aren't magic — each one is just a constant in that loop:
v += (wind, gravity)·dt, v *= (1−drag), p += v·dt.
click / hold to emit ✨
Forces
Emitter
particles: 0 / 3500
live: v += (0.0, 9.8)·dt
v *= 0.980 · p += v·dt
Step 3 · Same math, different constants
Same three lines, four "effects"
Here's the secret nobody tells you: an artist's fancy "particle editor"
is just sliders over these constants. A firework and a snowfall run
identical code — different gravity, different spawn rule. Click one; watch it
set the sliders above and take over the playground. Click again to stop it.
Step 4 · Spot it in the wild
where these three lines ship in real games —
Muzzle flashes & impact sparks. A 20-particle spark burst
with strong drag and a 0.2s lifetime. The whole "gunfeel" industry is tuned
constants on the loop you just played with.
Rain, snow & falling leaves. Spawn at the top, weak gravity,
wobbly sin() wind. Ambience is an emitter that never stops.
Spell VFX & trails. Emit from the projectile's position every
frame with zero start speed — the trail is just particles left behind, fading out.
Confetti in UI. That celebration burst in your banking app?
Gravity + drag + random spin. The three lines escaped games years ago.
GPUs simulate millions of these in parallel — chapter 04 explains why it's cheap.
See it in 3D · orbit it like Blender
Fireworks with a z-axis
The same three lines — v += F·dt; p += v·dt; life −= dt — now pushing four thousand points through real 3D space with additive glow. Rockets launch themselves; orbit underneath a burst and look up.