ember/README.md
Andras Schmelczer 7ed1f95566 Add README with project overview and embedded animation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 15:14:54 +01:00

1.3 KiB

Ember

A particle simulation that renders drifting embers carried by a Perlin-noise wind field, recorded to an MP4.

If your viewer doesn't render the embed inline, open animation.mp4 directly (variants: animation-day.mp4, animation-night.mp4).

How it works

  • ember.py — each Ember spawns at the bottom edge with a randomized size, color offset, lifespan, and updraft, then fades out as its time-to-live expires or it nears a screen border. Drawn as a soft anti-aliased circle blended into the previous frame's trail.
  • wind.pyWindField samples 3D Perlin noise (x, y, time) on a downscaled grid for each axis, with bilinear interpolation back up to pixel coordinates.
  • main.py — drives the loop: fades the previous frame slightly each tick (the trail effect), advances the wind field, updates and draws every ember, and writes each frame to an MP4 via imageio.

Run it

pip install pygame numpy imageio imageio-ffmpeg noise tqdm
python main.py

Tweak EMBER_COUNT, WIND_STRENTH, RUNNING_TIME_IN_SECONDS, or FRAME_RATE at the top of main.py. Set IS_DEVELOPMENT = True to watch the simulation in a window instead of writing to disk. Resolution lives in config.py.