# Chocolate Pour — `chocolate-pour@1.0.0`

A thick rope of glossy chocolate coils onto a white plate, folding into a spiralling heap. Loops perfectly.

Thick, glossy chocolate falling from a spout in one heavy rope onto a white plate, where it coils over and over as viscous liquids do, laying down a heap with a rotating spiral of folds and a scalloped skirt at its foot, shining in the studio light. Choose the chocolate (dark, milk, white or ruby), how many coils the rope makes in a loop, how tall the heap grows, how deep the folds are, the backdrop and whether the camera drifts.

- Kind: object; status: published; digest sha256:bba3b37a7410a39f34b09beb1574b39014b8a1b3d1f108051d2366e153daec00
- Role: Object (3D, three.js): a rich, mouth-watering hero object for food, dessert, confectionery and indulgence content.
- Implementation: three; entry `src/chocolate-pour.js`
- Files: https://aipixelwizard.com/registry/chocolate-pour/1.0.0/<path> (`LICENSE`, `asset.json`, `demo.js`, `index.html`, `src/chocolate-pour.js`)
- Manifest JSON: https://aipixelwizard.com/api/v1/visuals/chocolate-pour/versions/1.0.0
- Runnable demo: https://aipixelwizard.com/registry/chocolate-pour/1.0.0/index.html (open over http; it imports sibling packages by relative path)
- Dependencies (exact): `three@0.185.1` (source) — Renderer, geometry and shader materials.; `chrome-material@1.1.0` (demo) — Studio environment light, backdrop and contact shadow.; `apw-runtime@1.0.0` (demo) — Demo harness.

## Exports
- `createChocolatePour({ kind?, coils?, heap?, ridges? }) => { group, setProgress(progress), dispose() }` — The plate, heap, rope and spout as a group (plate 5 across on y = 0); add it with an environment map and a shadow-casting light.
- `KINDS: { dark, milk, white, ruby }` — Chocolate colours and roughness.

## Parameters
- `kind` (select one of dark | milk | white | ruby, default "dark") — Chocolate
- `coils` (integer 2–12, default 6) — Coils per loop
- `heap` (number 0.6–1.5, default 1) — Heap height
- `ridges` (number 0–2, default 1) — Folds
- `background` (color, default "#d8c8a8") — Backdrop
- `orbit` (boolean, default true) — Camera drift

## Composition
- Inputs: Time within the loop; the chocolate, coils, heap, folds, backdrop and camera drift.
- Outputs: A full frame rendered in 3D with soft shadows and a studio environment.
- Coordinates: The plate is centred on the origin on y = 0 (radius 2.65); the spout is at y = 6.55; the heap peaks at about 0.75.
- Lighting: A warm key light with a shadow map and the studio environment on the clear-coated chocolate.
- Timing: setProgress(progress) rewrites the heap's heights and the rope's curve; frames render in any order.
- Works with: chrome-material, orbit-camera, kinetic-title, number-reveal
- The heap is a polar grid of 70 × 160 vertices whose height is (1 − u²)^1.4 plus a spiral fold sin(5θ − 21.6u − phase) rotating with the loop and a scalloped edge; the rope is a tube along a curve that falls straight and bends into a circle at the apex.

## Output and loop
- 1080×1080, 30 fps, 12 s, procedural
- Seamless loop: yes — The rope's coil and the spiral folds of the heap turn a whole number of times per loop and the heap's skirt breathes in whole cycles, so the last frame meets the first.
- Verified 2026-10-06 in Chrome 154.0.8037.97 headless on Linux 7.0.0-38-generic (x64), Node 22.14.0 (WebGL 2 via SwiftShader (software)); deterministic: yes; loop check: Frame 0 vs end state (progress 1): mean |Δ| 0.0000, max |Δ| 0 of 255.

## Use it
New project: Create a WebGLRenderer with shadows and a studio environment (see chrome-material), add createChocolatePour().group and call choc.setProgress(progress) each frame.

Existing project: Copy src/chocolate-pour.js; add choc.group to your scene with an environment map and a shadow-casting light.

Reuse ideas:
- Dessert brand title: Dark chocolate.
- Soft bakery scene: Milk, slow coils.
- Luxury confectionery loop: Ruby, deep folds.

## Limitations
- The coiling is a formula, not a fluid simulation: the heap never grows or flows over the plate's rim.
- The rope does not thin as it falls and the folds are a regular spiral.

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

Provenance: Adapted from the owner's threejs-sketches/liquid-fluid/chocolate-pour (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original object: a coiling rope, a heap with rotating spiral folds, a clear-coated chocolate material and an exact loop.

