Fusion of Pixel Art and Meditation -- relax and unplug.
Go to file
Brian Fertig 4d9ccbe3e5 Add per-frame gain to cues and maglev train sounds to Cyberpunk City
- Extend `Cue` with an optional `gain(t)` so a cue's volume can be rescaled every frame while it plays (e.g. by source distance), updated live in `CueTrack`.
- Play each maglev train's `fx-train.mp3` as it slides into view, swelling with the drone's proximity via `TRAIN_PASSES` distance data in `traffic.ts`.
- Rework flyby selection to avoid reusing a file still playing for an earlier car instead of just skipping close passes.
- Fix train window shading to be relative to each car's own end so windows ride along with it.
- Update README cue docs and swap the `fx-city.mp3` ambience loop.
2026-10-31 20:06:49 -06:00
docker
…
public/audio Add per-frame gain to cues and maglev train sounds to Cyberpunk City 2026-10-31 20:06:49 -06:00
scripts
…
src Add per-frame gain to cues and maglev train sounds to Cyberpunk City 2026-10-31 20:06:49 -06:00
.dockerignore Add sample.env template and ignore .env 2026-10-29 21:21:37 -06:00
.gitignore Add sample.env template and ignore .env 2026-10-29 21:21:37 -06:00
Dockerfile
…
README.md Add per-frame gain to cues and maglev train sounds to Cyberpunk City 2026-10-31 20:06:49 -06:00
docker-check.png
…
docker-compose.yml
…
index.html
…
package-lock.json
…
package.json
…
sample.env Add sample.env template and ignore .env 2026-10-29 21:21:37 -06:00
tsconfig.json
…
vite.config.ts
…

README.md

Pixeltation

Calm pixel art meditations for the browser. Pick a journey from the main menu, settle in, and watch.

Run

With Node (local)

npm install
npm run dev        # http://localhost:5173
npm run build      # static site in dist/

With Docker Compose

docker compose up --build -d              # production build served by nginx → http://localhost:8080
docker compose --profile dev up --build dev   # Vite dev server with hot reload → http://localhost:5173
docker compose down                       # stop

Change the host ports with PIXELTATION_PORT / PIXELTATION_DEV_PORT, either inline (e.g. PIXELTATION_PORT=3000 docker compose up -d) or by copying sample.env to .env and editing it. The dev service bind-mounts the project, so edits on the host reload in the browser; don't run it and npm run dev on the same port at once.

File Purpose
Dockerfile Multi-stage: deps → dev (Vite) / build (typecheck + bundle) → runtime (nginx)
docker-compose.yml web service (default) and dev service (dev profile)
docker/nginx.conf Static serving, gzip, long-cache for fingerprinted /assets

Meditations

id Title Length
northern-cabin Northern Cabin — winter sunset by a quiet lake 5 min
mediterranean-coast Mediterranean Coast — clearing skies over a jungle cove 5 min
the-reef The Reef — drifting along a sunlit coral reef 5 min
ringed-planet The Ringed Planet — drifting in high orbit above a ringed giant 5 min
desert-sunrise Desert Sunrise — dawn breaks over a canyon stream 5 min
tibetan-monastery Monastery Above the Clouds — prayer flags and snowfall on a high summit 5 min
cyberpunk-city Cyberpunk City — drifting over a neon city in the rain 5 min

Each meditation lives in src/meditations/<id>/ and is registered in src/meditations/registry.ts. A scene is a pure function of time (render(surface, t)), drawn pixel by pixel into a 320×180 buffer that is scaled up crisply, so all art is generated in code.

Music and ambience

Audio lives in public/audio/ and is configured per meditation in its index.ts:

  • music: 'audio/<file>.mp3' — background track; fades in at the start and out over the last 10 seconds.
  • ambience: { src: 'audio/<file>.mp3', volume, from, fadeIn } — a seamless loop (Web Audio) locked to the scene clock, so visuals keyed to it stay in sync, including after pause and skip. With from it stays silent until that second and fades in over fadeIn (Monastery Above the Clouds uses this for wind.mp3 over its last 90 s). Mediterranean Coast uses fx-waves.mp3; its wave crashes are timed to the peaks listed in mediterranean-coast/waves.ts (re-measure them if the file changes).
  • ambience: [{ … }, { … }] — a list layers several loops at once (Cyberpunk City plays fx-rain.mp3 and fx-city.mp3 together).
  • cues: [{ t, src, volume, pan, gain }] — one-shot sound effects starting at scene time t, also kept in sync after pause and skip. An optional gain(t) rescales the volume every frame while it plays. Cyberpunk City plays a random fx-flyby-1…5.mp3 whenever a hover car passes close under the drone, timed so the middle of the file (FLYBY_MID in its index.ts) lands as the car crosses the bottom edge of the frame; the crossings are worked out from the traffic in cyberpunk-city/traffic.ts (PASSES). Each maglev train plays fx-train.mp3 as it comes into view, its gain following the drone's distance to the train (TRAIN_PASSES).

With Docker, rebuild the web image (docker compose up --build -d) after adding audio so it's included.

Dev tools

  • #/m/northern-cabin?t=150&speed=10 starts at 150 s and plays at 10× (dev server only).
  • [ / ] skip back/forward 10 s while playing (dev server only).
  • npm run snapshot -- northern-cabin 0 120 200 renders frames to snapshots/ as PNGs without a browser.