# Prayer Wheel — `prayer-wheel@1.0.0`

A polished brass prayer wheel with embossed glyphs and turquoise studs spinning on its handle, a weighted chain swinging round it. Loops perfectly.

A hand-held prayer wheel: a drum of polished metal embossed all round with rows of script-like glyphs and lotus petals, studded with turquoise, crowned with a dome and finial and carried on a wooden handle. The drum turns steadily and a little weight on a chain swings out round it as it spins, so the embossing catches the light as it goes by. The glyphs are decorative and not any real script. Choose the metal (gold, brass, silver or copper), how many turns the drum makes per loop, how many turquoise studs, the seed that varies the glyphs, the backdrop colour and whether the camera sways.

- Kind: object; status: published; digest sha256:6a564015f59b0d57b2b1bef04ef32972b3cb73da468ddd2c8d59c3cfd1887c94
- Role: Object (3D, three.js): a serene, handcrafted showpiece for wellness, travel and heritage content.
- Implementation: three; entry `src/prayer-wheel.js`
- Files: https://aipixelwizard.com/registry/prayer-wheel/1.0.0/<path> (`LICENSE`, `asset.json`, `demo.js`, `index.html`, `src/prayer-wheel.js`)
- Manifest JSON: https://aipixelwizard.com/api/v1/visuals/prayer-wheel/versions/1.0.0
- Runnable demo: https://aipixelwizard.com/registry/prayer-wheel/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
- `createPrayerWheel({ metal?, spin?, stones?, seed? }) => { group, setProgress(progress), dispose() }` — The wheel on its handle with chain and weight, about 4 wide and 9 tall, resting on y = 0; needs an environment map.
- `METALS: { gold, brass, silver, copper }` — Metal finishes with colour and roughness.

## Parameters
- `metal` (select one of gold | brass | silver | copper, default "gold") — Metal
- `spin` (integer 1–6, default 2) — Turns per loop
- `stones` (number 0–1, default 1) — Turquoise studs
- `seed` (integer 1–999, default 13) — Seed
- `background` (color, default "#1c1612") — Backdrop
- `orbit` (boolean, default true) — Camera sway

## Composition
- Inputs: Time within the loop; the metal, turns, studs, seed, backdrop and camera sway.
- Outputs: A full frame rendered in 3D with a studio environment.
- Coordinates: The wheel's axis is vertical through the origin; the drum (radius 1.7, height 2.6) spins at y = 3.5; the handle runs down to y ≈ 0; the weight swings at radius 3.4–3.8.
- Lighting: A warm key light with a shadow map, a shadow-catching floor and the studio environment on the metal.
- Timing: setProgress(progress) sets the drum's angle and the chain; frames render in any order.
- Works with: chrome-material, orbit-camera, kinetic-title, number-reveal
- The relief is a 2048×512 bump map drawn once; it wraps exactly round the drum.

## Output and loop
- 1080×1080, 30 fps, 16 s, procedural
- Seamless loop: yes — The drum turns a whole number of times per loop, the weight's orbit follows the drum's turn with a lag that swings in sines of whole cycles, and the camera sway is a sine of the loop, 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 a studio environment and a shadow-casting light, add createPrayerWheel().group and call wheel.setProgress(progress) each frame.

Existing project: Copy src/prayer-wheel.js; add the group to your scene with an environment map.

Reuse ideas:
- Wellness title: Gold, two turns.
- Calm: Brass, slow.
- Cool: Silver, fast.

## Limitations
- The glyphs are decorative marks and not a real script or mantra.
- The chain is a straight line of links with a slight sag, not a simulated chain.

## 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/objects-scenes/prayer-wheel (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original studio object: a bump-mapped drum with petal bands and procedural decorative glyphs, a finial, studs and a hand-held spinning chain weight on an exact loop.

