{
  "schemaVersion": 1,
  "id": "ratchet-escapement",
  "version": "1.0.0",
  "status": "published",
  "kind": "object",
  "title": "Ratchet Escapement",
  "summary": "The escapement of a mechanical watch, enlarged: a ratchet wheel, a rocking anchor with ruby pallets, a swinging balance and a following gear, ticking in sharp steps. Loops perfectly.",
  "description": "The heart of a mechanical watch, enlarged and laid bare. A sixteen-toothed escape wheel is held by the two jewelled pallets of an anchor; the anchor rocks to and fro, letting one tooth escape at every tick, and the wheel advances in a sharp little step each time. A balance wheel with a hairspring swings steadily above it, setting the pace, and a larger gear turned by the wheel follows at half its speed. Choose the metal (brass, steel, rose or blue steel), the whole turns of the escape wheel per loop, whether a dark bridge plate sits behind, the backdrop colour and whether the camera sways.",
  "role": "Object (3D, three.js): a precise, hypnotic mechanical showpiece for watch, engineering and time-themed content.",
  "collections": [
    "satisfying",
    "hypnotic-loops",
    "product-reveals"
  ],
  "tags": [
    "escapement",
    "ratchet",
    "watch movement",
    "anchor",
    "balance wheel",
    "ticking",
    "clockwork",
    "brass",
    "jewels",
    "studio",
    "loop",
    "3d"
  ],
  "synonyms": [
    "watch escapement",
    "anchor escapement",
    "escape wheel",
    "clock mechanism",
    "ticking mechanism",
    "horology"
  ],
  "useCases": [
    "A watch, clock or luxury timepiece scene",
    "A time, precision or engineering explainer",
    "A hypnotic ticking loop"
  ],
  "featured": null,
  "publishedAt": "2026-10-06",
  "implementation": {
    "target": "three",
    "runtime": "browser",
    "language": "javascript",
    "module": "esm",
    "entry": "src/ratchet-escapement.js",
    "exports": [
      {
        "name": "createEscapement",
        "signature": "createEscapement({ metal?, turns?, plate? }) => { group, ticks, setProgress(progress), dispose() }",
        "description": "The escape wheel, anchor, balance wheel with hairspring and follower gear, about 9 across, in the xy plane facing +z; `ticks` is the number of ticks per loop; needs an environment map."
      },
      {
        "name": "METALS",
        "signature": "METALS: { brass, steel, rose, blue }",
        "description": "Metal finishes with colour and roughness."
      }
    ],
    "reusable": [
      "src/ratchet-escapement.js"
    ],
    "demo": "demo.js",
    "harness": "index.html"
  },
  "dependencies": [
    {
      "id": "three",
      "version": "0.185.1",
      "reason": "Renderer, geometry and shader materials."
    },
    {
      "id": "chrome-material",
      "version": "1.1.0",
      "scope": "demo",
      "reason": "Studio environment light, backdrop and contact shadow."
    },
    {
      "id": "apw-runtime",
      "version": "1.0.0",
      "scope": "demo",
      "reason": "Demo harness."
    }
  ],
  "params": [
    {
      "key": "metal",
      "label": "Metal",
      "type": "select",
      "default": "brass",
      "options": [
        {
          "value": "brass",
          "label": "Brass"
        },
        {
          "value": "steel",
          "label": "Steel"
        },
        {
          "value": "rose",
          "label": "Rose gold"
        },
        {
          "value": "blue",
          "label": "Blue steel"
        }
      ]
    },
    {
      "key": "turns",
      "label": "Wheel turns per loop",
      "help": "Whole turns of the escape wheel per loop, sixteen ticks each.",
      "type": "integer",
      "min": 1,
      "max": 3,
      "step": 1,
      "default": 1
    },
    {
      "key": "plate",
      "label": "Bridge plate",
      "type": "boolean",
      "default": true
    },
    {
      "key": "background",
      "label": "Backdrop",
      "type": "color",
      "default": "#1a1612"
    },
    {
      "key": "orbit",
      "label": "Camera sway",
      "type": "boolean",
      "default": true
    }
  ],
  "presets": [
    {
      "id": "default",
      "label": "Brass, one turn",
      "params": {}
    },
    {
      "id": "steel",
      "label": "Steel, three turns",
      "params": {
        "metal": "steel",
        "turns": 3,
        "background": "#12161c"
      }
    },
    {
      "id": "rose",
      "label": "Rose gold, no plate",
      "params": {
        "metal": "rose",
        "plate": false,
        "background": "#1c1216"
      }
    },
    {
      "id": "blue",
      "label": "Blue steel",
      "params": {
        "metal": "blue",
        "turns": 2,
        "background": "#10141c"
      }
    }
  ],
  "output": {
    "width": 1080,
    "height": 1080,
    "fps": 30,
    "durationSeconds": 16,
    "posterSeconds": 3,
    "alpha": false,
    "motion": "procedural",
    "loop": {
      "seamless": true,
      "cycleSeconds": 16,
      "method": "The wheel advances a whole number of teeth per loop (sixteen ticks per turn, an even number so the anchor is back where it started), the balance swings in a sine of the ticks and the camera sway is a sine of the loop, so the last frame meets the first."
    },
    "seed": null
  },
  "composition": {
    "inputs": "Time within the loop; the metal, turns, plate, backdrop and camera sway.",
    "outputs": "A full frame rendered in 3D with a studio environment.",
    "coordinates": "The escape wheel (radius 2.05) is at the origin of the group; the anchor pivots 3.5 above it and the balance wheel sits 6 above it; the follower gear is 4.75 to the right.",
    "lighting": "A warm key light with a shadow map and the studio environment on the metal.",
    "timing": "setProgress(progress) sets every part's angle in closed form from the tick count; frames render in any order.",
    "compatibleWith": [
      "chrome-material",
      "orbit-camera",
      "kinetic-title",
      "number-reveal"
    ],
    "notes": [
      "The wheel waits then steps in the second half of every tick; the anchor flips between its stops."
    ]
  },
  "reuse": [
    "Watch brand: Brass, one turn.",
    "Cool engineering: Steel, three turns.",
    "Luxury: Rose gold, no plate."
  ],
  "integration": {
    "newProject": "Create a WebGLRenderer with a studio environment and a shadow-casting light, add createEscapement().group and call mech.setProgress(progress) each frame.",
    "existingProject": "Copy src/ratchet-escapement.js; add the group to your scene with an environment map."
  },
  "performance": {
    "notes": "A few thousand triangles and a shadow map: about a millisecond a frame on an integrated Intel GPU.",
    "limits": "Software WebGL renders in about a second a frame."
  },
  "limitations": [
    "The pallets do not truly lock against the teeth: the motion is timed by formula, not simulated.",
    "The follower gear's teeth only roughly mesh with the escape wheel."
  ],
  "license": {
    "spdx": "MIT",
    "notice": "Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder.",
    "thirdParty": []
  },
  "provenance": "Adapted from the owner's threejs-sketches/objects-scenes/ratchet-escapement (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original studio object: an extruded sawtooth escape wheel, a ruby-pallet anchor, a balance wheel with hairspring and a follower gear, all timed from a whole tick count on an exact loop.",
  "changelog": [
    {
      "version": "1.0.0",
      "date": "2026-10-05",
      "notes": "Initial release."
    }
  ]
}
