38 lines
1.8 KiB
Markdown
38 lines
1.8 KiB
Markdown
# Københavnerkuglen — Advent of AI Slop, Day 3 (Snow globe)
|
||
|
||
> https://pages.obahan.xyz/lullu/advent-of-slop-03-copenhagen-snow-globe/
|
||
|
||
A snow globe of Copenhagen that you can actually shake. Inside: a procedurally
|
||
generated Nyhavn — random gabled houses in the classic colours, roof cranes,
|
||
lit windows at dusk and night, the spiral spire of Our Saviour's Church, the
|
||
Round Tower, a Tivoli-ish tower, street lamps and bundled-up pedestrians
|
||
trudging through the accumulating drift.
|
||
|
||
## How to play
|
||
|
||
- **Shake it**: grab the globe and rattle it left-right, hit *Ryst den!*, or press `space`.
|
||
Snow explodes off the drift and settles again over time.
|
||
- **Click the drift** for a little snow puff.
|
||
- **Sne slider**: from light dusting to full blizzard (150–1300 flakes).
|
||
- **Dag / Aften / Nat**: winter day, sunset, or starry night with lit windows.
|
||
- **Fej snescooten**: shovel the drift away and start over.
|
||
|
||
Everything persists in `localStorage`: the drift you grew, the theme, the
|
||
density, and your total shake count (100 shakes earns a 💪).
|
||
|
||
## Under the hood
|
||
|
||
- Canvas 2D, no libraries. Vite + TypeScript.
|
||
- `src/snow.ts` — flake physics (gravity, drag, wobble, dome-wall collisions)
|
||
and a 72-column snowdrift that accumulates, slumps sideways, and gets
|
||
re-suspended on shakes.
|
||
- `src/scene.ts` — deterministic (seeded) Copenhagen skyline renderer with
|
||
three time-of-day palettes.
|
||
- `src/main.ts` — shake detection from pointer velocity reversals, controls,
|
||
persistence, the damped globe-oscillation animation.
|
||
- Smoke-tested with headless Chromium (shake via button/space/drag, drift
|
||
growth, persistence across reloads, zero page errors).
|
||
|
||
Built for [Advent of AI Slop Day 3](https://advent-of-slop.quesma.com/day/3/):
|
||
*"Make a snow globe of your hometown that you can shake."* — hometown: Copenhagen, and yes, Copenhagen gets snow.
|