Small python script to render a background mood animation to-be-shown by a projector.
Find a file
Andras Schmelczer 734d51bee3 Replace video embed with plain mp4 links
The host's markdown renderer doesn't support <video> tags, so the
embed rendered blank. Linking directly works in every viewer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 15:20:39 +01:00
animation-day.mp4 Initial 2026-05-03 15:03:33 +01:00
animation-night.mp4 Initial 2026-05-03 15:03:33 +01:00
animation.mp4 Initial 2026-05-03 15:03:33 +01:00
config.py Initial 2026-05-03 15:03:33 +01:00
ember.py Initial 2026-05-03 15:03:33 +01:00
main.py Initial 2026-05-03 15:03:33 +01:00
README.md Replace video embed with plain mp4 links 2026-05-03 15:20:39 +01:00
utils.py Initial 2026-05-03 15:03:33 +01:00
wind.py Initial 2026-05-03 15:03:33 +01:00

Ember

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

Sample output: animation.mp4 (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.