Particle Life Simulator
Watch particles attract and repel each other under a small force matrix, seeded so the same starting state can be replayed. Runs on a 2D canvas in your browser.
How this simulation works
Particle life gives every particle one of three species and a simple force: within a radius, two particles attract or repel each other according to a fixed three by three matrix, and their velocity is integrated with friction and clamped at the walls. The force control scales the whole matrix, the count sets how many particles exist, and the seed places them and sets their initial velocities. The count never changes during a run, and every position is clamped into the field, so a long run cannot drift particles off the canvas.
How to use it
Set the particle count and the force strength, then press Play. Reset rebuilds the same seeded configuration, Pause holds the frame, and Step advances one integration step so you can watch the field change slowly.
Why it runs in your browser
The simulation runs on this page with JavaScript and the canvas API. Nothing is uploaded, no account is needed, and the page works offline after it loads.
Three particle species attract and repel each other on a canvas, and you control the seed, the population and the force between them while the field keeps moving until you pause it.
The seed decides where every particle starts, so the same seed and the same step count always produce the same arrangement. Only the speed of watching depends on the clock, which is why Step and Play reach the same frame.
Nothing leaves the tab. The loop is a seeded simulation rather than a physical model, and the page says so: it is a picture of pairwise attraction, not a measurement of anything real.
The three controls
The seed field takes a whole number from 0 to 9999 and starts at 2718. The population slider runs from 200 to 1200 particles in steps of 50 and starts at 600. The force slider runs from 0 to 100 percent and starts at 35.
At zero force every particle drifts in a straight line. Higher values pull the three species into clumps, and the pattern that forms depends on both the force and the seeded starting positions.
- Seed 0 to 9999, default 2718
- Population 200 to 1200 in steps of 50, default 600
- Force 0 to 100 percent, default 35
Why it repeats
Every random placement comes from the seed, never from an unseeded source, so two visitors who use the same seed and population see the same first frame. Stepping forward is deterministic for the same reason.
Positions are clamped to the field, so the population never escapes and the particle count never changes. When reduced motion is requested the page starts paused.
How to use the three controls
Set the Seed from 0 to 9999, starting at 2718, the Particles slider from 200 to 1200 in steps of 50, starting at 600, and the Force slider from 0 to 100 percent, starting at 35, in the Controls panel. Press Play to run the field continuously, Step for one frame at a time, or Reset for the seeded first frame.
Every random placement comes from the seed, so the same seed and population always show the same first frame and stepping matches playing. At zero force every particle drifts straight; higher values clump the three species, and positions clamp to the field so the count never changes.
What to Expect
Best for
- A demonstration of seeded, deterministic motion
- A visual example of pairwise attraction and repulsion
- A looping animation for a page with a physics theme
Not ideal for
- Modelling any real physical or chemical system
- Measuring forces or predicting an outcome
- A long unattended animation on a low-power device
What this tool keeps
- The same first frame for the same seed and population
- The particle count, which the field never changes
- A paused start when reduced motion is requested
What may need cleanup
- A pattern you do not like, which changing the seed replaces
- A high population on a slow device, which lowers the frame rate
- A force setting that clumps too tightly to see structure
Common errors
- Reading the picture as a simulation of a real material
- Expecting a different arrangement from the same seed
- Wondering why the page starts paused with reduced motion on
Example use cases
- Teaching what a deterministic seed means
- A decorative background animation
- Exploring how pairwise forces form clumps
Sample input
Leave the seed at 2718, set 600 particles and a force of 35 percent, then press Play.
Sample output
Three species drifting into loose clumps, with the status line reporting the running step and the field holding all 600 particles.
Who this is for
- Teachers explaining seeded simulation
- Developers looking for a canvas animation
- Anyone curious about particle interaction
Frequently asked questions
What controls the particle life simulation?
The seed, the population and the force between three particle species, with a field that keeps moving until you pause it.
Does it model a real physical system?
No. It is a visual simulation of attraction and repulsion, not a physical or chemical model.
Why does a high population slow the animation?
A high population lowers the frame rate on a low-power device, so fewer particles can be smoother.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.