# Perpetual Motion — `perpetual-motion@1.0.0`

The overbalanced wheel, the oldest perpetual motion machine: hinged weights swing out on the falling side and fold in on the rising side. Loops perfectly.

The overbalanced wheel: the oldest design for a perpetual motion machine, drawn by Villard de Honnecourt in the 1200s and reinvented ever since. A wheel carries hinged arms, each ending in a heavy weight. On the way down the arms swing out so their weights hang far from the axle; on the way up they fold in close, so the wheel always seems heavier on the falling side and should turn for ever. (It does not: a machine like this cannot work, which is the whole fascination.) Choose the number of arms, the metal (brass, steel, copper or bronze), the wood of the stand, the whole turns per loop, the backdrop colour and whether the camera sways.

- Kind: object; status: published; digest sha256:06a2d08206b82a817e197774e46e15eb851b35cdfb0fddb27837dbea527d3f63
- Role: Object (3D, three.js): a classic curiosity of engineering history that turns for ever, for science, history and design content.
- Implementation: three; entry `src/perpetual-motion.js`
- Files: https://aipixelwizard.com/registry/perpetual-motion/1.0.0/<path> (`LICENSE`, `asset.json`, `demo.js`, `index.html`, `src/perpetual-motion.js`)
- Manifest JSON: https://aipixelwizard.com/api/v1/visuals/perpetual-motion/versions/1.0.0
- Runnable demo: https://aipixelwizard.com/registry/perpetual-motion/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
- `createOverbalancedWheel({ arms?, metal?, wood?, turns? }) => { group, setProgress(progress), dispose() }` — The wheel on its stand, about 9 across and 11 tall, standing on y = 0; needs an environment map.
- `METALS: { brass, steel, copper, bronze }` — Metal finishes with colour and roughness.

## Parameters
- `arms` (integer 8–20, default 12) — Arms
- `metal` (select one of brass | steel | copper | bronze, default "brass") — Metal
- `wood` (select one of oak | walnut | pine, default "oak") — Wood
- `turns` (integer 1–3, default 1) — Turns per loop
- `background` (color, default "#1c1814") — Backdrop
- `orbit` (boolean, default true) — Camera sway

## Composition
- Inputs: Time within the loop; the arms, metal, wood, turns, backdrop and camera sway.
- Outputs: A full frame rendered in 3D with a studio environment.
- Coordinates: The axle is at y = 6 on the z axis; the wheel (rim radius 3.2) turns clockwise seen from +z; each arm is 1.7 long and swings out to a radius of about 5.
- Lighting: A warm key light with a shadow map, a shadow-catching floor and the studio environment.
- Timing: setProgress(progress) sets the wheel angle and every arm's fold from its position; frames render in any order.
- Works with: chrome-material, orbit-camera, kinetic-title, number-reveal
- The arms are fully out when the spoke points to the right-hand side and folded in on the left; the fold blends smoothly through the top and bottom.

## Output and loop
- 1080×1080, 30 fps, 16 s, procedural
- Seamless loop: yes — The wheel turns a whole number of times per loop and each arm's fold is a function of where it is on the wheel, which repeats exactly, 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 createOverbalancedWheel().group and call wheel.setProgress(progress) each frame.

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

Reuse ideas:
- History explainer: Brass, twelve arms.
- Cool: Steel, many arms.
- Warm: Copper, eight arms.

## Limitations
- It is a picture of an impossible machine: it moves by formula, not by its own weight.
- The folded arms pass through the rim at some wheel angles.

## 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/perpetual-motion (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original studio object: an overbalanced wheel with hinged weighted arms folded by position on the wheel, turning by whole turns on a wooden stand, on an exact loop.

