Text output (exactly what node cli.js prints)
Cloth designed in LOOM. Click a piece to load it into the editor and watch it weave.
LOOM in two minutes
A LOOM program sets up a loom and then weaves it one row at a time. The result is a grid of colour letters, the fabric.
- Warp.
Wvertical threads, one per column. Each has a colour and hangs on one of 8 shafts. - Pick. Each row lifts a set of shafts. Columns whose shaft is lifted are raised and show the warp colour; the others show the weft colour thrown across.
- Floats. A run of the same raised/lowered state is a float. Long floats make weak
cloth, so
maxfloatcan forbid them.
Statements
loom W H | First line. W columns, H rows (1–200). |
palette k=#rrggbb … | Name colours with single letters. |
warp <colours> | Colour of every column; the sequence repeats across. |
thread <shafts> | Shaft of every column (1–8); ranges like 1-4 allowed. |
treadle N <lift> | Remember a lift as treadle N (1–10). |
shuttle <colours> | Weft colours that cycle for picks with no colour. |
pick [colour] <lift> | Weave one row. |
cross I J | Swap the warp threads in columns I and J. |
drift N / drift -N | Rotate all warp threads right / left. |
maxfloat N | From now on, no float may be longer than N. |
repeat N { … } | Repeat the enclosed lines N times (1–1000). |
Sequences
a b c | one after another |
a*3 | a a a |
(a b)*2 | a b a b |
mirror(a b c) | a b c b a |
1-4, 4-2 | 1 2 3 4, 4 3 2 (shafts only) |
Lifts
13 | shafts 1 and 3 |
- / * | no shafts / all shafts |
!12 | every shaft except 1 and 2 |
t2 | whatever treadle 2 lifts (in pick) |
Reading the draft
The Loom tab draws a classic weaving draft: the threading on top (one mark per column, on its shaft; shaft 1 is the bottom row), the lift plan on the right (one row per pick, a mark for each lifted shaft, then the weft colour), and the drawdown — the cloth — in the middle.
Errors
The first problem stops the program with a single line such as
error line 5: unknown color 'q'. Structural problems (a missing loom header,
unbalanced { }) are found before anything runs; everything else is found when its line runs.
Full details: LOOM_SPEC.md next to this file.