# Snowfall — `snowfall@1.0.0`

Snow falling in three depths: big soft flakes in front, tiny slow ones behind, drifting on the wind. Loops perfectly.

Snow falling in three depths. Near flakes are big, soft and fast, middle ones medium, far ones tiny and slow, so the scene has depth; each drifts sideways on its own slow sine and the near flakes are slightly blurred as if out of focus. Every flake falls a whole number of screen heights per loop, so the loop is exact. It draws over whatever is on the canvas. Choose the number of flakes, the wind, the sky colours and the seed.

- Kind: effect; status: published; digest sha256:00d166a92caa7f42d0e1f9dfc4d83cb365f578a2b90cae241601acbd05264104
- Role: Particle overlay (Canvas 2D): winter, holiday and calm-night atmosphere.
- Implementation: canvas2d; entry `src/snowfall.js`
- Files: https://aipixelwizard.com/registry/snowfall/1.0.0/<path> (`LICENSE`, `asset.json`, `demo.js`, `index.html`, `src/snowfall.js`)
- Manifest JSON: https://aipixelwizard.com/api/v1/visuals/snowfall/versions/1.0.0
- Runnable demo: https://aipixelwizard.com/registry/snowfall/1.0.0/index.html (open over http; it imports sibling packages by relative path)
- Dependencies (exact): `apw-runtime@1.0.0` (demo) — Demo harness. The reusable source has no dependencies.

## Exports
- `createSnowfall({ flakes?, wind?, colour?, seed? }) => { draw(ctx, info, width, height) }` — Canvas 2D snow layer; info.progress (0 to 1 over the loop) sets the place in the loop; draws on top of the canvas.

## Parameters
- `flakes` (integer 60–600, default 220) — Flakes
- `wind` (number 0–1.5, default 0.4) — Wind
- `skyTop` (color, default "#0b1530") — Sky top
- `skyBottom` (color, default "#3a5a8a") — Sky bottom
- `seed` (integer 1–999, default 6) — Seed

## Composition
- Inputs: Canvas 2D context, info.progress (0 to 1 over the loop), width, height.
- Outputs: Draws snow on top of the canvas; does not clear it.
- Coordinates: Flakes are placed in fractions of the canvas; sizes scale with the smaller side.
- Lighting: None; near flakes are soft radial gradients.
- Timing: Pure function of info.progress.
- Works with: kinetic-title, gradient-background
- Flakes are drawn far to near so nearer flakes cover farther ones.

## Output and loop
- 1080×1080, 30 fps, 10 s, procedural
- Seamless loop: yes — Every flake falls a whole number of screen heights per loop and sways in whole cycles, so the last frame meets the first.
- Verified 2026-10-08 in Chrome 154.0.8037.97 headless on Linux 7.0.0-38-generic (x64), Node 22.14.0 (Canvas 2D); deterministic: yes; loop check: Frame 0 vs end state (progress 1): mean |Δ| 0.0000, max |Δ| 0 of 255.

## Use it
New project: Create it once, then each frame draw your backdrop and call draw(ctx, { progress }, width, height).

Existing project: Copy src/snowfall.js. Call draw on your existing 2D canvas.

Reuse ideas:
- Winter title: Winter night.
- Storm: Blizzard.
- Soft greeting: Gentle, dusk.

## Limitations
- Flakes do not collide or settle; they leave the bottom and re-enter at the top.
- The backdrop in the demo is not part of the reusable code.

## License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder.

Provenance: Original code written for AI Pixel Wizard in October 2026, to the catalog quality bar (docs/QUALITY.md).

