# Cable Knit — `cable-knit@1.0.1`

Chunky wool knits itself row by row, with a braided cable down the middle, then draws back into the needles. Loops perfectly.

Chunky wool knitting itself: two bright needles click along the top of a growing piece of fabric while, row after row, stitches appear behind them, each a V of plump yarn with a twist of its own, the edges in rib and the middle braided into a rope of cables that cross every twelve rows. When the piece is finished the yarn relaxes and draws back into the needles to begin again. Choose the yarn (cream, crimson, teal, mustard or charcoal), the number of rows, how many cables, how fuzzy the wool looks, the seed, the backdrop and whether the camera drifts.

- Kind: object; status: published; digest sha256:a097ac31fe11403ed6f6c77bc3e861cddfe05684dbbb4440a69873db86be780a
- Role: Object (3D, three.js): a cosy, tactile hero object for craft, winter, fashion and handmade content.
- Implementation: three; entry `src/cable-knit.js`
- Files: https://aipixelwizard.com/registry/cable-knit/1.0.1/<path> (`LICENSE`, `asset.json`, `demo.js`, `index.html`, `src/cable-knit.js`)
- Manifest JSON: https://aipixelwizard.com/api/v1/visuals/cable-knit/versions/1.0.1
- Runnable demo: https://aipixelwizard.com/registry/cable-knit/1.0.1/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
- `createCableKnit({ yarn?, rows?, cables?, fuzz?, seed? }) => { group, setProgress(progress), dispose() }` — The fabric (one instanced mesh of stitches) and two needles as a group, hanging down from y = 0; add it with an environment map and a shadow-casting light.
- `YARNS: { cream, crimson, teal, mustard, charcoal }` — Yarn colours.

## Parameters
- `yarn` (select one of cream | crimson | teal | mustard | charcoal, default "cream") — Yarn
- `rows` (integer 14–40, default 26) — Rows
- `cables` (integer 0–2, default 1) — Cables: Braided cables in the middle (0 for plain knitting).
- `fuzz` (number 0–1.5, default 1) — Fuzz
- `seed` (integer 1–999, default 4) — Seed
- `background` (color, default "#3a3028") — Backdrop
- `orbit` (boolean, default true) — Camera drift

## Composition
- Inputs: Time within the loop; the yarn, rows, cables, fuzz, seed, backdrop and camera drift.
- Outputs: A full frame rendered in 3D with soft shadows and a studio environment.
- Coordinates: The fabric hangs from the needles at y = 0 down to about -9, 16 stitches (7 wide); the demo lifts it 8.6 above the floor.
- Lighting: A warm key light with a shadow map, the studio environment and sheen on the wool.
- Timing: setProgress(progress) sets every stitch's growth and the needles; frames render in any order.
- Works with: chrome-material, orbit-camera, kinetic-title, number-reveal
- A stitch is a tube bent into a V with a loop at its foot; 16 columns by up to 40 rows are one instanced mesh with per-stitch colour; the cables swap four columns over each other by a smooth shift every twelve rows.

## Output and loop
- 1080×1080, 30 fps, 16 s, procedural
- Seamless loop: yes — Each stitch appears at a fixed share of the loop (row by row, left to right) and the whole piece relaxes back into the needles before the end, so the first and last frames are identical; the needles' clicking is a sine of a whole number of cycles.
- Verified 2026-10-08 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 createCableKnit().group and call knit.setProgress(progress) each frame.

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

Reuse ideas:
- Winter-collection title: Cream, one cable.
- Warm brand scene: Crimson, two cables.
- Calm craft loop: Teal, plain knit.

## Limitations
- The stitches grow in place rather than being pulled through by the needles; the needles do not touch the yarn.
- The cables are a smooth column swap, not real crossing yarn.

## 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/cable-knit (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original object: V-shaped tube stitches on an instanced grid, a column-swapping cable, a row-by-row growth schedule and relaxing return for an exact loop.

