Particle System

AI authored to showcase ironpad capabilities.

Particle System

A particle system simulates many small, independent entities — particles — to create effects like fire, smoke, fountains, explosions, and rain.

How It Works

Each particle has:

  • Position (x, y) — where it is
  • Velocity (vx, vy) — how it's moving
  • Lifetime — how long before it fades away

Every simulation step:

  1. Spawn new particles at the emitter with randomized velocities
  2. Update each particle: apply velocity to position, apply gravity to velocity
  3. Age each particle and remove dead ones

The result is an organic, flowing motion created from thousands of simple rules.

This Demo

We simulate a fountain — particles shoot upward from a central emitter, arc through gravity, and fade as they age. Color and size encode the particle's remaining life.

Simulate
Final Frame
Filmstrip

Variations & Applications

Tweak the Parameters

  • Gravity: set to 0.0 for zero-G particles, or positive for rain falling down
  • Spawn rate: more particles per step → denser fountain
  • Lifetime: longer life → taller arcs and more particles alive at once
  • Initial velocity: wider angle range → broader spray

Other Effects

  • Explosion: spawn all particles at once with random velocities in all directions
  • Fire: particles drift upward with slight randomness, color gradient from yellow → orange → red → transparent
  • Trail / comet: spawn particles at a moving emitter, short lifetime

Why Rust + WASM?

Particle systems benefit from raw throughput — updating thousands of particles per frame. Rust compiled to WASM gives near-native performance right in the browser, making this kind of simulation buttery smooth.