hash(x: number, y: number, salt: number) → number
A cheap, repeatable value hash — the wear, the speckle and the grain all come
from this, so a rebuild paints the same toy every time.
| arg | type | description |
|---|
| x | number | |
| y | number | |
| salt | number | |
smoothNoise(x: number, y: number, cell: number, salt: number) → number
Smooth value noise over a grid `cell` pixels across — the large, soft variation
that keeps a flat paint from reading as a printed swatch. Speckle answers the
close look; this answers the silhouette.
| arg | type | description |
|---|
| x | number | |
| y | number | |
| cell | number | |
| salt | number | |
px(self: any, x: number, y: number, c: RGB, a: number?) → void
| arg | type | description |
|---|
| self | any | |
| x | number | |
| y | number | |
| c | RGB | |
| a | number? | |
rect(self: any, ax: number, ay: number, bx: number, by: number, c: RGB, a: number?) → void
The mirrored halves of the fuselage wrap are painted by walking outward from
each flank, so one of the two passes hands its edges in the other order. The
rectangle sorts them rather than painting nothing, which is how the left side
of the toy lost its cheatline the first time round.
| arg | type | description |
|---|
| self | any | |
| ax | number | |
| ay | number | |
| bx | number | |
| by | number | |
| c | RGB | |
| a | number? | |
round(self: any, ax: number, ay: number, bx: number, by: number, r: number, c: RGB, a: number?) → void
A rectangle with rounded corners — the shape of every cabin window here.
| arg | type | description |
|---|
| self | any | |
| ax | number | |
| ay | number | |
| bx | number | |
| by | number | |
| r | number | |
| c | RGB | |
| a | number? | |
wear(self: any, x0: number, y0: number, x1: number, y1: number, c: RGB, amount: number, salt: number) → void
Speckled wear over a band: paint that has been landed on a carpet a few times.
| arg | type | description |
|---|
| self | any | |
| x0 | number | |
| y0 | number | |
| x1 | number | |
| y1 | number | |
| c | RGB | |
| amount | number | |
| salt | number | |
rub(self: any, cx: number, cy: number, rx: number, ry: number, c: RGB, strength: number, salt: number) → void
A rubbed patch: paint worn back over a soft-edged blob, hardest in the middle.
The nose of a toy aeroplane that has been flown into things looks like this.
| arg | type | description |
|---|
| self | any | |
| cx | number | |
| cy | number | |
| rx | number | |
| ry | number | |
| c | RGB | |
| strength | number | |
| salt | number | |
streaks(self: any, x0: number, y0: number, x1: number, y1: number, c: RGB, count: number, salt: number) → void
Streaks along a band: the drag marks a belly picks up sliding across a table.
| arg | type | description |
|---|
| self | any | |
| x0 | number | |
| y0 | number | |
| x1 | number | |
| y1 | number | |
| c | RGB | |
| count | number | |
| salt | number | |
chips(self: any, x0: number, x1: number, edge: number, inward: number, c: RGB, count: number, salt: number) → void
Chips out of a painted edge: the coloured band breaks and the plastic under it
shows through. `edge` is the row the band ends on; chips bite inward from it.
| arg | type | description |
|---|
| self | any | |
| x0 | number | |
| x1 | number | |
| edge | number | |
| inward | number | |
| c | RGB | |
| count | number | |
| salt | number | |
shadeRows(self: any, x0: number, x1: number, y0: number, y1: number, top: number, bottom: number) → void
A soft vertical gradient, used to shade a wrap so the crown reads lighter than
the flanks even before a light touches it.
| arg | type | description |
|---|
| self | any | |
| x0 | number | |
| x1 | number | |
| y0 | number | |
| y1 | number | |
| top | number | |
| bottom | number | |
grime(self: any, x0: number, y0: number, x1: number, y1: number, cell: number, strength: number, salt: number) → void
Grime settled into a whole rectangle: a large soft mottle that darkens the
paint by a few percent where it lands. Painted last over a finished surface.
| arg | type | description |
|---|
| self | any | |
| x0 | number | |
| y0 | number | |
| x1 | number | |
| y1 | number | |
| cell | number | |
| strength | number | |
| salt | number | |
rectPx(r: { number }) → void
| arg | type | description |
|---|
| r | { number } | |
paintFuselage(c: any) → void
paintNacelle(c: any) → void
paintKey(c: any) → void
The wind-up key's own paint. `toy767_metal` is gold, and this rectangle is the
amount of that gold each part of the key shows: the shaft plain, a shadow in
the collar's groove, and the bow bright where thumb and finger have polished
it. The bow's outer circumference is the top AND bottom edge of its band —
`Geo.KEY_V` maps the ring's minor angle across the band and the angle closes
on itself — so the rubbed ring is painted at both.
band(v: { number }) → void
| arg | type | description |
|---|
| v | { number } | |
paintFlats(c: any) → void
pixels( ) → void
Paint the atlas. Returns the raw RGBA bytes plus the size they describe.