@logomarks/generate 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/README.md +40 -6
- package/package.json +1 -1
- package/src/finish.js +18 -10
- package/src/generate.js +9 -4
- package/src/index.d.ts +4 -2
- package/src/index.js +1 -1
- package/src/presets.js +9 -0
- package/src/primitives.js +2 -2
- package/src/recipes/bars.js +2 -0
- package/src/recipes/bubble.js +90 -0
- package/src/recipes/check.js +77 -0
- package/src/recipes/chevrons.js +11 -1
- package/src/recipes/cloud.js +98 -0
- package/src/recipes/counter.js +12 -2
- package/src/recipes/cut.js +5 -0
- package/src/recipes/halfsq.js +4 -1
- package/src/recipes/index.js +10 -0
- package/src/recipes/invert.js +6 -1
- package/src/recipes/layers.js +66 -0
- package/src/recipes/leaves.js +38 -3
- package/src/recipes/peak.js +91 -0
- package/src/recipes/ribbon.js +41 -6
- package/src/recipes/rings.js +6 -3
- package/src/recipes/seam.js +5 -2
- package/src/recipes/shear.js +4 -1
- package/src/recipes/split.js +4 -1
- package/src/recipes/tiles.js +8 -1
- package/src/recipes/trine.js +7 -2
- package/src/recipes/turns.js +7 -0
- package/src/tuning.js +30 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
## 0.5.0 (2026-11-28)
|
|
5
|
+
|
|
6
|
+
- **Five recipes after the commonest tech-brand marks** (the owner's audit of 623 tech-brand icons): `cloud`, `layers`,
|
|
7
|
+
`bubble`, `check` and `peak` (the letter A as a peak), 60 in all. Each makes one construction move, never the plain
|
|
8
|
+
icon, with its bad reads ruled out in the build: no rain, bolt or sun in a cloud; no level bars in layers; no eyes,
|
|
9
|
+
three dots, lines of text or a magnifier in a bubble; no checkbox or verified disc for a tick; no caret, arrow stem or
|
|
10
|
+
rounded apex for an A. The defaults and 200 shuffles of each stay under 0.72 against the brands' own icons by the house
|
|
11
|
+
outline measure (cloud 0.717, layers 0.699, bubble 0.711, check 0.622, peak 0.632); stacks of rhombus plates, a disc
|
|
12
|
+
pair of bubbles, a rounded or wide A and a slab-cut tick were steered off because they crowded a brand.
|
|
13
|
+
- **A speech-bubble container**: `container: 'bubble'` in the finish, as a badge, a clip or a frame.
|
|
14
|
+
- `TUNING`, `MAIN`, `TURNS` (a cloud, a bubble, an A and layers mirror only; a tick never turns), `HOLD` (each new
|
|
15
|
+
recipe's move, and the bubble's body) and `MIX_WEIGHT` for the five; eight presets (55).
|
|
16
|
+
|
|
17
|
+
## 0.4.2 (2026-11-27)
|
|
18
|
+
|
|
19
|
+
- **Mirror:** four-way emblems are now most of a shuffle (34 of 47, from 16): `shuffled()` holds a recipe's `HOLD` keys
|
|
20
|
+
(new export; Mirror's `symmetry`, Ribbon's `path`) from the first try across the rest, so the best-of picks within one
|
|
21
|
+
form instead of always picking the two-way emblem, which scores higher. Shuffles also leave the centre empty and cut
|
|
22
|
+
the bands out of the body more often. 22 distinct in 130 (from 15); every draw still under 0.65 against R19 (default
|
|
23
|
+
and 200 shuffles: 0.627).
|
|
24
|
+
- **Ribbon:** every figure can be drawn as two bands side by side (`lanes: 'two'`), their turns concentric, the gap
|
|
25
|
+
between them the line; round ends split into two rounded corners (never one hairpin end: a paperclip). Shuffles draw
|
|
26
|
+
two bands about half the time. 25 distinct in 130 (from 18). A twisted strap (`path: 'twist'`) is by hand only. Tried
|
|
27
|
+
and dropped: a loop round a square or a hexagon with its ends crossing over and under (an ð, a key ring).
|
|
28
|
+
- **Seam:** a corner joint in a disc is a pie chart at any turn; it draws in a rounded square instead.
|
|
29
|
+
- **Banned reads found in the mix:** Turns never draws six pointed units (triangles, kites, diamonds, chevrons, blades,
|
|
30
|
+
parallelograms, quarters) round a centre: they resolve into a hexagram, the Star of David; six becomes five, and pointed
|
|
31
|
+
units are never fused (a solid star). Cut never takes a wedge, a corner or a notch out of a circle (Pac-Man); it cuts
|
|
32
|
+
a slim slot, off centre. Chevrons: one hard chevron
|
|
33
|
+
alone is an arrow head, so it draws as two, a skip never leaves one, a lone soft chevron (R21) points up or down, and
|
|
34
|
+
shuffles point only up or down (sideways stacks are fast-forward).
|
|
35
|
+
- **A sweep of every recipe** (24 shuffles of each of the 55 and four mixes of 96, viewed): ruled out by construction —
|
|
36
|
+
Rings: the innermost ring never broken once in any body (©); in a round body it is left out, the centre open (broken,
|
|
37
|
+
two arcs chasing round a centre are the refresh icon; whole inside broken rings, a target). Leaves: any tiling whose gap reads as a plus (a cross) or whose points ring a
|
|
38
|
+
four-pointed star (the AI sparkle) is measured on the drawing (`plusRead`) and turned another way. Turns: four pills,
|
|
39
|
+
squares, circles, arches or halves meet on the axes in a plus, so four becomes five. Counter: a half or a quarter disc
|
|
40
|
+
(a lens) takes a square, quarter or half hole off its middle (an eye). Cut: a circle takes only a slot or an arc,
|
|
41
|
+
square to its side (Pac-Man, a pie, a knob). Invert: a circle swaps a band only, and shuffles draw no circle (no entry,
|
|
42
|
+
©, Pac-Man, a pie). Split: a disc is cut at least twice, the cuts kept inside (a slashed circle). Trine: in a disc the
|
|
43
|
+
slits stay near the centre and nearly even. Chevrons: no plain stack of fewer than three without a body (show more).
|
|
44
|
+
Bars: three bars arched are a plus; they rise. Halves: two by two never in facing rows (fast forward). Shear: two rows
|
|
45
|
+
never lean against each other (<< >>). Tiles: no three-by-three layout that is a plus or a face. Stack: a diamond or a
|
|
46
|
+
triangle on a square (a house), a diamond on a triangle (an arrow), a triangle on a half (a pin), a half over a leaf (a
|
|
47
|
+
person). Merge: a quarter with a half, a wedge or a leaf (a pie chart), a half with a leaf (Pac-Man); a half keeps a square, a
|
|
48
|
+
rounded square or a wedge.
|
|
49
|
+
|
|
3
50
|
## 0.4.1 (2026-11-27)
|
|
4
51
|
|
|
5
52
|
- **Safe turns.** `TURNS` gives each of the 55 recipes the turns and mirror a shuffle may apply, and about one shuffle in
|
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# @logomarks/generate
|
|
2
2
|
|
|
3
|
-
Abstract logomarks from rules and controls, no AI. Each recipe is one construction (
|
|
3
|
+
Abstract logomarks from rules and controls, no AI. Each recipe is one construction (60 of them: bars, bands, twin,
|
|
4
4
|
stack, shear, turns, burst, tiles, route, arcs, rings, stripes, chevrons, waves, cut, split, spiral, bloom, links,
|
|
5
5
|
horizon, steps, hex, iso and letter; fourteen after live house families: arcstep, halfsq, invert, leaves, lobes, loops,
|
|
6
6
|
trine, strips, bite, blades, wavecut, capsules, flare, seam; and seven that combine unlike shapes: merge, overlap,
|
|
7
|
-
counter, pair, corners, offset, quarters
|
|
7
|
+
counter, pair, corners, offset, quarters; ten after the owner's reference logos: mosaic, weave, notch, nodes, xband,
|
|
8
|
+
mirror, ribbon, field, zigzag, halfstripe; and five after the commonest tech-brand marks: cloud, layers, bubble, check,
|
|
9
|
+
peak) that lists its controls
|
|
8
10
|
and draws a mark from them, fitted to the Logomarks standard: a 512 canvas, the longest side 448, centred,
|
|
9
11
|
`currentColor`, the house gap. Every recipe also takes the finish controls (turn, mirror, round corners, outline, an
|
|
10
|
-
accent dot, a container: badge or
|
|
12
|
+
accent dot, a container: a circle, square, rounded square, hexagon or speech bubble, as a badge, a clip or a frame). Each mark comes with its `pieces`, and `svgOf()` draws them in two colours. A
|
|
11
13
|
quality guard skips draws with specks, slivers, thin necks, hairline holes, a bare primitive or too little ink. Runs in
|
|
12
14
|
the browser and in Node.
|
|
13
15
|
|
|
@@ -18,6 +20,8 @@ outline), and `mix()` weights the strongest recipes (`MIX_WEIGHT`). `MAIN` names
|
|
|
18
20
|
`TURNS` gives each recipe the turns and mirror that keep its marks what they are: about one shuffle in three turns or
|
|
19
21
|
mirrors a mark by it (`TURN_SHARE`), never outside it, and a locked Turn or Mirror stays. Letters, the sun, chevrons
|
|
20
22
|
(arrows), arcs (a magnet), bars and shear (a menu icon) and the styles already the same every quarter turn never turn.
|
|
23
|
+
`HOLD` names keys a shuffle draws once and holds across its tries, so its best-of picks within one form (Mirror's
|
|
24
|
+
symmetry: otherwise the higher-scoring two-way emblem always won; Ribbon's fold).
|
|
21
25
|
|
|
22
26
|
## Install
|
|
23
27
|
|
|
@@ -37,7 +41,7 @@ const badge = generate('letter', { char: 'K', build: 'slabs', container: 'circle
|
|
|
37
41
|
const twoTone = svgOf(mark.pieces, { colors: ['#0b0b0b', '#c8ff00'], pattern: 'rows' });
|
|
38
42
|
```
|
|
39
43
|
|
|
40
|
-
`PRESETS` lists
|
|
44
|
+
`PRESETS` lists 55 one-click starting points. `RECIPES[id].controls` describes every control (range, choice or toggle) so a UI can build its sliders from it.
|
|
41
45
|
|
|
42
46
|
## Playground
|
|
43
47
|
|
|
@@ -99,10 +103,12 @@ in the build (and tested on 200 shuffles):
|
|
|
99
103
|
one to three bands each side four ways, the bands as ink or cut out of a solid body with a rim; the body a hexagon on
|
|
100
104
|
its point, a rounded square, an octagon or (four ways) a disc. Two ways never takes a centre piece (between bands
|
|
101
105
|
above and below it is a face), loose arcs (lips) or a round body (the reference itself). Every setting scores under
|
|
102
|
-
0.65 against the R19 reference by the house outline measure (tests, `tests/fixtures/r19.json`).
|
|
106
|
+
0.65 against the R19 reference by the house outline measure (tests, `tests/fixtures/r19.json`). Shuffles are mostly
|
|
107
|
+
four-way.
|
|
103
108
|
- `ribbon`: one thick band folding back on itself: one, two or three steps or one wave swing, the turns round or creased
|
|
104
109
|
(folded flat: a mitre opened by the gap), none, one or two slots, ends cut by the box, rounded or angled, slanted. N, Z,
|
|
105
|
-
a hook and a
|
|
110
|
+
a hook, a hairpin and a twisted strap draw by hand; a shuffle never draws a figure that reads as a letter
|
|
111
|
+
(`SHUFFLE_FIGURES`). Any figure can be two bands side by side (`lanes: 'two'`), their turns concentric.
|
|
106
112
|
- `field`: upright bars broken by one stepped line, the lower parts jogged.
|
|
107
113
|
- `zigzag`: a striped shape broken by a zigzag, one side slid.
|
|
108
114
|
- `halfstripe`: a shape half solid, half bars stepping down; never a diamond (a speaker, a play button).
|
|
@@ -112,3 +118,31 @@ and off the axes); `chevrons` takes `body: 'hexagon'` and `soft` (round corners
|
|
|
112
118
|
be 1, a soft A); `route` takes `body: 'cube'` (an iso cube, its three faces engraved with short tracks ending in a
|
|
113
119
|
node); `letter` takes five more builds, `wedge`, `cut`, `rails`, `hexfold` and `quarter`; the finish takes
|
|
114
120
|
`containerMode: 'frame'` (the container as a heavy ring, the mark whole inside) and `accentShape: 'square'`.
|
|
121
|
+
|
|
122
|
+
## The tech-brand styles (0.5.0)
|
|
123
|
+
|
|
124
|
+
Five recipes after the archetypes the owner's audit of 623 tech-brand icons found thin or missing in the set
|
|
125
|
+
(`tools/logomarks/review/handoffs/tech-brands-audit.md` in the site repo). Every one makes a construction move; none
|
|
126
|
+
draws the plain icon, and none copies a brand: the default and 200 shuffles of each score under 0.72 against the brands'
|
|
127
|
+
own icons for that archetype by the house outline measure (cloud 0.717, layers 0.699, bubble 0.711, check 0.622,
|
|
128
|
+
peak 0.632).
|
|
129
|
+
|
|
130
|
+
- `cloud`: two to five round puffs on a flat or round base, with one move: lifted off a strip of its base by a gap
|
|
131
|
+
(`bands`), split by one slanted gap, a slot run in from one end, a heavy outline broken once, or stacked over a smaller
|
|
132
|
+
cloud. Never rain, a bolt or a sun (nothing under or behind it; no piece a whole disc). A plain cloud is by hand only.
|
|
133
|
+
- `layers`: two to four plates (rhombus, rounded, chevron or a slab with a thickness) stacked with the gap between,
|
|
134
|
+
apart, stepped aside or tapered. Never level bars (a menu icon). Plain flat plates stacked straight are the UI layers
|
|
135
|
+
icon and one company's mark, and slabs stacked straight or tapered outline two others': they taper or step aside.
|
|
136
|
+
- `bubble`: a speech bubble (a disc, a rounded or a soft block) with one move: the tail parted by the gap, a pair (the
|
|
137
|
+
back one cleared by the gap), bands, a bar run in from one side, or a quarter bitten from the far corner. Never two
|
|
138
|
+
holes (eyes) or three dots, never lines of text (a block takes one cut), never a disc pair (one brand's mark) or a
|
|
139
|
+
disc with a parted wedge (a magnifier).
|
|
140
|
+
- `check`: a heavy tick with one move: the legs parted at the heel, doubled or tripled, or cut out of a half disc (a
|
|
141
|
+
bowl) with the long leg running out over the rim. Never a hole (a checkbox, the verified disc); the slab cut-out (a
|
|
142
|
+
box with the tick running out of it) is by hand only; never turned or mirrored.
|
|
143
|
+
- `peak`: the letter A as a peak, two heavy legs and no crossbar, narrow, the apex pointed or flat, with one move: the
|
|
144
|
+
right leg parted, a slot up a leg, the feet cut off, a small triangle seated in the counter, or a second peak nested
|
|
145
|
+
under. Never wider than tall (a caret), nothing up the middle (an arrow), never rounded at the apex (one brand's A).
|
|
146
|
+
|
|
147
|
+
The finish's `container` takes `'bubble'`: the mark knocked out of, clipped to or framed by a speech bubble, set a
|
|
148
|
+
little above the middle to sit in the bubble's body.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logomarks/generate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Abstract logomarks from rules and controls, no AI: 34 recipes (bars, bands, twin, stack, shear, turns, burst, tiles, route, arcs, rings, stripes, dots, pixel, chevrons, waves, cut, split, venn, blobs, dashes, fan, fold, spiral, orbit, bloom, links, horizon, steps, hex, tri, iso, line, letter) that each list their controls and draw a mark from them and a seed, fitted to the Logomarks standard (512 canvas, 448 fit, the house gap), a shared finish (rounding, outline, an accent dot, a container), two-colour pieces, seeded variations and presets. Runs in the browser and in Node.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/finish.js
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* inner corners instead (a closing, kept under half the house gap so separate pieces never fuse), or each piece's own
|
|
6
6
|
* right end, top or outer corner (measured from the piece's own box). `accent` adds one accent dot, a house gap off the
|
|
7
7
|
* mark's right end or corner, or inside its biggest counter (never a round one: a ring with a dot is an eye).
|
|
8
|
-
* `container` puts the finished mark in a circle, square, rounded square or
|
|
8
|
+
* `container` puts the finished mark in a circle, square, rounded square, hexagon or speech bubble: clipped to it (`clip`: the mark
|
|
9
9
|
* zoomed by 1 / `containerSize` and cut at the shape's edge), knocked out of it (`badge`: the shape solid, the mark a
|
|
10
10
|
* house gap's worth of hole, sitting at `containerSize` of the shape) or framed by it (`frame`: the shape as a heavy
|
|
11
11
|
* ring, the mark whole inside). `accentShape` makes the accent a disc or a square (a square full stop).
|
|
12
12
|
*/
|
|
13
|
-
import { U, D, I, rect, rot, mapPts, grow, signedArea, perimeter, circle, rr, regular } from '@logomarks/core/geometry';
|
|
13
|
+
import { U, D, I, rect, rot, mapPts, grow, signedArea, perimeter, circle, rr, regular, poly } from '@logomarks/core/geometry';
|
|
14
14
|
import { BOX, GAP, tidy } from './draw.js';
|
|
15
15
|
|
|
16
16
|
/** @type {import('./index.js').Control[]} */
|
|
@@ -22,7 +22,7 @@ export const FINISH = [
|
|
|
22
22
|
{ key: 'outline', label: 'Outline', type: 'range', min: 0, max: 60, step: 1, value: 0, group: 'finish' },
|
|
23
23
|
{ key: 'accent', label: 'Accent dot', type: 'choice', options: ['none', 'end', 'corner', 'inside'], value: 'none', group: 'finish' },
|
|
24
24
|
{ key: 'accentSize', label: 'Dot size', type: 'range', min: 0.8, max: 1.4, step: 0.05, value: 1, group: 'finish' },
|
|
25
|
-
{ key: 'container', label: 'Container', type: 'choice', options: ['none', 'circle', 'square', 'rounded', 'hexagon'], value: 'none', group: 'finish' },
|
|
25
|
+
{ key: 'container', label: 'Container', type: 'choice', options: ['none', 'circle', 'square', 'rounded', 'hexagon', 'bubble'], value: 'none', group: 'finish' },
|
|
26
26
|
{ key: 'containerMode', label: 'Container mode', type: 'choice', options: ['badge', 'clip', 'frame'], value: 'badge', group: 'finish' },
|
|
27
27
|
{ key: 'containerSize', label: 'Mark size inside', type: 'range', min: 0.5, max: 0.9, step: 0.01, value: 0.78, group: 'finish' },
|
|
28
28
|
{ key: 'accentShape', label: 'Dot shape', type: 'choice', options: ['disc', 'square'], value: 'disc', group: 'finish' },
|
|
@@ -46,30 +46,38 @@ function containerShape(kind) {
|
|
|
46
46
|
if (kind === 'circle') return circle(cx, cy, size / 2, 160);
|
|
47
47
|
if (kind === 'rounded') return rr(x0, y0, size, size, size * 0.22);
|
|
48
48
|
if (kind === 'hexagon') return regular(cx, cy, size / 2, 6, -90);
|
|
49
|
+
if (kind === 'bubble') {
|
|
50
|
+
// a speech bubble: a rounded block with its lower-left corner sharp and run down into a tail
|
|
51
|
+
const h = size * 0.84, r = size * 0.22, t = size * 0.17;
|
|
52
|
+
return U(rr(x0, y0, size, h, [r, r, r, 0]), poly([[x0, y0 + h - t], [x0, y0 + size], [x0 + t * 1.5, y0 + h - 1]]));
|
|
53
|
+
}
|
|
49
54
|
return rect(x0, y0, size, size);
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
/** How much of a container's width a mark's box can take and still sit inside it with room round its corners. */
|
|
53
|
-
const INSCRIBE = { circle: 0.74, square: 1, rounded: 0.94, hexagon: 0.8 };
|
|
58
|
+
const INSCRIBE = { circle: 0.74, square: 1, rounded: 0.94, hexagon: 0.8, bubble: 0.8 };
|
|
59
|
+
/** Where a container's mark sits: its centre's drop from the box's (a bubble's body is above its tail). */
|
|
60
|
+
const LIFT = { bubble: -0.08 };
|
|
54
61
|
|
|
55
|
-
/** The mark scaled about the box's centre so its longest side is `side`, centred. */
|
|
56
|
-
function scaledTo(shape, side) {
|
|
62
|
+
/** The mark scaled about the box's centre so its longest side is `side`, centred (`dy` lower, in boxes). */
|
|
63
|
+
function scaledTo(shape, side, dy = 0) {
|
|
57
64
|
const polys = typeof shape[0][0][0] === 'number' ? [shape] : shape;
|
|
58
65
|
const [x0, y0, x1, y1] = boxOf(polys), k = side / Math.max(x1 - x0, y1 - y0, 1e-9);
|
|
59
66
|
const mx = (x0 + x1) / 2, my = (y0 + y1) / 2;
|
|
60
|
-
return mapPts(polys, ([x, y]) => [BOX.cx + (x - mx) * k, BOX.cy + (y - my) * k]);
|
|
67
|
+
return mapPts(polys, ([x, y]) => [BOX.cx + (x - mx) * k, BOX.cy + dy * BOX.size + (y - my) * k]);
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
/** The mark in a container: clipped to it, or knocked out of it as a badge. */
|
|
64
71
|
function contain(shape, kind, mode, size) {
|
|
65
72
|
if (!shape || !shape.length) return shape;
|
|
66
73
|
const box = containerShape(kind);
|
|
67
|
-
|
|
74
|
+
const dy = LIFT[kind] || 0;
|
|
75
|
+
if (mode === 'clip') return tidy(I(scaledTo(shape, (BOX.size * 0.9) / size, dy), box));
|
|
68
76
|
// frame: the container drawn as a heavy ring (its band about the house gap and a half), the mark whole inside it, a gap
|
|
69
77
|
// clear of the ring all round
|
|
70
78
|
if (mode === 'frame') {
|
|
71
79
|
const band = GAP * 1.7, ring = D(box, grow(box, -band));
|
|
72
|
-
const mark = scaledTo(shape, BOX.size * size * INSCRIBE[kind] * 0.86);
|
|
80
|
+
const mark = scaledTo(shape, BOX.size * size * INSCRIBE[kind] * 0.86, dy);
|
|
73
81
|
return tidy(U(ring, D(mark, grow(ring, GAP * 1.1))));
|
|
74
82
|
}
|
|
75
83
|
// badge: the mark sits at `size` of the shape, its pieces knocked out; a mark spilling past the shape's edge would cut
|
|
@@ -77,7 +85,7 @@ function contain(shape, kind, mode, size) {
|
|
|
77
85
|
// the holes, so each hole is shrunk by half of what the scale took off the gap (the bridges get it back). A mark too
|
|
78
86
|
// thin for this leaves hairline holes, which the guard turns away.
|
|
79
87
|
const k = (size * INSCRIBE[kind]);
|
|
80
|
-
const mark = I(scaledTo(shape, BOX.size * k), grow(box, -GAP));
|
|
88
|
+
const mark = I(scaledTo(shape, BOX.size * k, dy), grow(box, -GAP));
|
|
81
89
|
const back = (GAP * Math.max(0, 1 - k)) / 2;
|
|
82
90
|
return tidy(D(box, back > 0.5 ? grow(mark, -back) : mark));
|
|
83
91
|
}
|
package/src/generate.js
CHANGED
|
@@ -7,7 +7,7 @@ import { RECIPES } from './recipes/index.js';
|
|
|
7
7
|
import { resolve, randomValue } from './controls.js';
|
|
8
8
|
import { rng, seedOf } from './random.js';
|
|
9
9
|
import { problems } from './guard.js';
|
|
10
|
-
import { TURNS, TURN_SHARE } from './tuning.js';
|
|
10
|
+
import { TURNS, TURN_SHARE, HOLD } from './tuning.js';
|
|
11
11
|
import { fill, thinShareBits } from './raster.js';
|
|
12
12
|
|
|
13
13
|
robust();
|
|
@@ -91,10 +91,15 @@ export function qualityOf(shape) {
|
|
|
91
91
|
* passes. What a Shuffle button and a random grid should call, rather than taking the first draw that passes.
|
|
92
92
|
*/
|
|
93
93
|
export function shuffled(id, seed, { tries = 4, base = {}, locked = [], finish = false } = {}) {
|
|
94
|
-
let best = null;
|
|
94
|
+
let best = null, held = null;
|
|
95
|
+
const hold = (HOLD[id] || []).filter((k) => !locked.includes(k));
|
|
95
96
|
for (let i = 0, s = seedOf(seed); i < tries; i++, s = (s + 1) >>> 0) {
|
|
96
97
|
try {
|
|
97
|
-
|
|
98
|
+
// the recipe's held keys come from the first draw and stay for the rest, so the best of the tries is chosen
|
|
99
|
+
// within one form (Mirror's two- and four-way forms score differently, and the two-way would always win)
|
|
100
|
+
const params = randomParams(id, s, held ? { base: { ...base, ...held }, locked: [...locked, ...hold], finish } : { base, locked, finish });
|
|
101
|
+
if (!held && hold.length) held = Object.fromEntries(hold.map((k) => [k, params[k]]));
|
|
102
|
+
const { shape, g } = draw(id, params);
|
|
98
103
|
if (g.problems.length || !g.svg) continue;
|
|
99
104
|
const quality = qualityOf(shape).score;
|
|
100
105
|
if (!best || quality > best.quality) best = { ...g, seed: s, quality };
|
|
@@ -262,7 +267,7 @@ export function similar(id, params, { count = 12, seed = 1, amount = 0.15, locke
|
|
|
262
267
|
* How often each recipe comes up in `mix()`, relative to 1: the ones whose shuffles most often give a mark worth
|
|
263
268
|
* keeping lead; the textured ones (iso, hex, tiles) come up less.
|
|
264
269
|
*/
|
|
265
|
-
export const MIX_WEIGHT = { twin: 1.6, cut: 1.6, split: 1.4, chevrons: 1.3, spiral: 1.2, links: 1.2, arcs: 1.2, bands: 1.2, stripes: 1.2, rings: 0.8, turns: 1.1, bloom: 1, burst: 1, bars: 1, waves: 0.9, stack: 0.8, steps: 0.8, letter: 0.8, shear: 0.6, route: 0.5, horizon: 0.5, tiles: 0.6, hex: 0.5, iso: 0.5, arcstep: 1.4, leaves: 1.3, seam: 1.3, trine: 1.1, blades: 1.1, invert: 1, wavecut: 1, capsules: 1, bite: 0.9, loops: 0.8, strips: 0.7, flare: 0.8, lobes: 0.9, halfsq: 0.8, pixelarc: 0.4 , merge: 1.3, overlap: 1.3, counter: 1.2, pair: 1.3, corners: 1.2, offset: 1.1, quarters: 1.1 , mosaic: 0.8, weave: 0.8, notch: 1, nodes: 0.9, xband: 0.9, mirror: 0.8, ribbon: 1, field: 0.7, zigzag: 0.9, halfstripe: 0.9 };
|
|
270
|
+
export const MIX_WEIGHT = { twin: 1.6, cut: 1.6, split: 1.4, chevrons: 1.3, spiral: 1.2, links: 1.2, arcs: 1.2, bands: 1.2, stripes: 1.2, rings: 0.8, turns: 1.1, bloom: 1, burst: 1, bars: 1, waves: 0.9, stack: 0.8, steps: 0.8, letter: 0.8, shear: 0.6, route: 0.5, horizon: 0.5, tiles: 0.6, hex: 0.5, iso: 0.5, arcstep: 1.4, leaves: 1.3, seam: 1.3, trine: 1.1, blades: 1.1, invert: 1, wavecut: 1, capsules: 1, bite: 0.9, loops: 0.8, strips: 0.7, flare: 0.8, lobes: 0.9, halfsq: 0.8, pixelarc: 0.4 , merge: 1.3, overlap: 1.3, counter: 1.2, pair: 1.3, corners: 1.2, offset: 1.1, quarters: 1.1 , mosaic: 0.8, weave: 0.8, notch: 1, nodes: 0.9, xband: 0.9, mirror: 0.8, ribbon: 1, field: 0.7, zigzag: 0.9, halfstripe: 0.9, cloud: 0.9, layers: 0.9, bubble: 0.8, check: 0.7, peak: 0.8 };
|
|
266
271
|
|
|
267
272
|
/**
|
|
268
273
|
* `count` marks from ANY recipe: each slot picks a recipe by its seed (from `ids`, every recipe by default, weighted by
|
package/src/index.d.ts
CHANGED
|
@@ -44,10 +44,10 @@ export interface Generated {
|
|
|
44
44
|
seed?: number;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
/** Every recipe, by id (
|
|
47
|
+
/** Every recipe, by id (60): bars, bands, twin, stack, shear, turns, burst, tiles, route, arcs, rings, stripes, chevrons,
|
|
48
48
|
* waves, cut, split, spiral, bloom, links, horizon, steps, hex, iso, letter, arcstep, halfsq, invert, leaves, lobes, loops,
|
|
49
49
|
* trine, strips, bite, blades, wavecut, capsules, flare, merge, overlap, counter, pair, corners, offset, quarters, seam,
|
|
50
|
-
* mosaic, weave, notch, nodes, xband, mirror, ribbon, field, zigzag and
|
|
50
|
+
* mosaic, weave, notch, nodes, xband, mirror, ribbon, field, zigzag, halfstripe, cloud, layers, bubble, check and peak. */
|
|
51
51
|
export const RECIPES: Record<string, Recipe>;
|
|
52
52
|
/** A recipe by id; throws for an unknown one. */
|
|
53
53
|
export function recipe(id: string): Recipe;
|
|
@@ -78,6 +78,8 @@ export const MAIN: Record<string, string[]>;
|
|
|
78
78
|
export const TURNS: Record<string, { turns: ('0' | '90' | '180' | '270')[]; mirror: boolean }>;
|
|
79
79
|
/** The share of shuffles that turn or mirror a mark. */
|
|
80
80
|
export const TURN_SHARE: number;
|
|
81
|
+
/** Keys a shuffle draws once and holds across its tries, so its best-of is chosen within one form (Mirror's symmetry, Ribbon's fold). */
|
|
82
|
+
export const HOLD: Record<string, string[]>;
|
|
81
83
|
/** Every control's default. */
|
|
82
84
|
export function defaults(controls: Control[]): Params;
|
|
83
85
|
/** Every control's value from params, clamped, defaults for missing ones. */
|
package/src/index.js
CHANGED
|
@@ -6,6 +6,6 @@ export { recipe, generate, randomParams, variations, nearby, similar, mix, shuff
|
|
|
6
6
|
export { defaults, resolve, clampTo, randomValue } from './controls.js';
|
|
7
7
|
export { rng, seedOf } from './random.js';
|
|
8
8
|
export { GUARD, problems } from './guard.js';
|
|
9
|
-
export { TUNING, MAIN, TURNS, TURN_SHARE } from './tuning.js';
|
|
9
|
+
export { TUNING, MAIN, TURNS, TURN_SHARE, HOLD } from './tuning.js';
|
|
10
10
|
export { PRESETS } from './presets.js';
|
|
11
11
|
export { PRIMS, prim, alike, banned, unlike, unlikePair, unlikeTriple, BANNED } from './primitives.js';
|
package/src/presets.js
CHANGED
|
@@ -53,4 +53,13 @@ export const PRESETS = [
|
|
|
53
53
|
{ id: 'zigzag-disc', name: 'Zigzag disc', recipe: 'zigzag', params: { shape: 'circle', stripes: 5, teeth: 2 }, note: 'A striped disc broken by a zigzag, one side slid.' },
|
|
54
54
|
{ id: 'half-bars', name: 'Half bars', recipe: 'halfstripe', params: { shape: 'hexagon', bars: 4, step: 0.1 }, note: 'A hexagon half solid, half bars stepping down.' },
|
|
55
55
|
{ id: 'four-shapes', name: 'Four shapes', recipe: 'quarters', params: { a: 'quarter', b: 'wedge', c: 'disc', d: 'leaf', rule: 'rotate' }, note: 'Four unlike shapes, each a quarter turn on from the last.' },
|
|
56
|
+
// the tech-brand styles (0.5.0)
|
|
57
|
+
{ id: 'banded-cloud', name: 'Banded cloud', recipe: 'cloud', params: { puffs: 3, rise: 'left', move: 'bands' }, note: 'A cloud lifted off a strip of its base by one gap.' },
|
|
58
|
+
{ id: 'slotted-cloud', name: 'Slotted cloud', recipe: 'cloud', params: { puffs: 3, rise: 'right', move: 'slot', base: 'round' }, note: 'A cloud with a slot run in from one end.' },
|
|
59
|
+
{ id: 'slab-layers', name: 'Slab layers', recipe: 'layers', params: { plate: 'slab', count: 3, lay: 'stack' }, note: 'Three plates with a thickness, stacked a gap apart.' },
|
|
60
|
+
{ id: 'offset-layers', name: 'Offset layers', recipe: 'layers', params: { plate: 'rounded', count: 3, lay: 'offset' }, note: 'Three soft plates, each a step to one side.' },
|
|
61
|
+
{ id: 'bubble-pair', name: 'Bubble pair', recipe: 'bubble', params: { move: 'pair', body: 'rounded' }, note: 'Two speech bubbles, the back one cleared by the gap.' },
|
|
62
|
+
{ id: 'striped-bubble', name: 'Striped bubble', recipe: 'bubble', params: { move: 'bands', body: 'disc', bands: 3 }, note: 'A round speech bubble cut into three bands.' },
|
|
63
|
+
{ id: 'parted-tick', name: 'Parted tick', recipe: 'check', params: { move: 'heel', weight: 0.21 }, note: 'A heavy tick, its two legs parted at the heel.' },
|
|
64
|
+
{ id: 'seated-a', name: 'Seated A', recipe: 'peak', params: { move: 'seat', apex: 'flat', weight: 0.22 }, note: 'An A as a peak, a small triangle seated for its crossbar.' },
|
|
56
65
|
];
|
package/src/primitives.js
CHANGED
|
@@ -56,12 +56,12 @@ export const alike = (a, b) => a === b || ALIKE.some(([p, q]) => (p === a && q =
|
|
|
56
56
|
* The pairings each recipe never draws, with the read each avoids. A pair is banned either way round.
|
|
57
57
|
*/
|
|
58
58
|
export const BANNED = {
|
|
59
|
-
merge: [['disc', 'square', 'a person'], ['disc', 'rsquare', 'a person'], ['disc', 'pill', 'a person'], ['disc', 'half', 'a person'], ['disc', 'bar', 'a person'], ['disc', 'triangle', 'a pin'], ['disc', 'wedge', 'a pin'], ['disc', 'diamond', 'a pin'], ['triangle', 'square', 'a house'], ['triangle', 'rsquare', 'a house'], ['triangle', 'pill', 'an arrow'], ['triangle', 'bar', 'an arrow'], ['triangle', 'half', 'a cone'], ['diamond', 'half', 'a cone'], ['leaf', 'disc', 'a flame'], ['hexagon', 'triangle', 'a pencil'], ['square', 'half', 'a tombstone'], ['rsquare', 'half', 'a tombstone'], ['pill', 'half', 'a mushroom']],
|
|
59
|
+
merge: [['half', 'leaf', 'Pac-Man'], ['quarter', 'leaf', 'a pie chart'], ['quarter', 'wedge', 'a pie chart'], ['quarter', 'half', 'a pie chart'], ['disc', 'square', 'a person'], ['disc', 'rsquare', 'a person'], ['disc', 'pill', 'a person'], ['disc', 'half', 'a person'], ['disc', 'bar', 'a person'], ['disc', 'triangle', 'a pin'], ['disc', 'wedge', 'a pin'], ['disc', 'diamond', 'a pin'], ['triangle', 'square', 'a house'], ['triangle', 'rsquare', 'a house'], ['triangle', 'pill', 'an arrow'], ['triangle', 'bar', 'an arrow'], ['triangle', 'half', 'a cone'], ['diamond', 'half', 'a cone'], ['leaf', 'disc', 'a flame'], ['hexagon', 'triangle', 'a pencil'], ['square', 'half', 'a tombstone'], ['rsquare', 'half', 'a tombstone'], ['pill', 'half', 'a mushroom']],
|
|
60
60
|
overlap: [['disc', 'triangle', 'a play button'], ['ring', 'bar', 'a no-entry sign'], ['ring', 'pill', 'a no-entry sign'], ['disc', 'bar', 'a no-entry sign'], ['ring', 'triangle', 'a play button'], ['ring', 'square', 'a magnifier'], ['ring', 'rsquare', 'a magnifier'], ['ring', 'diamond', 'a key'], ['disc', 'half', 'a person'], ['triangle', 'square', 'a house'], ['triangle', 'rsquare', 'a house']],
|
|
61
61
|
// a triangle hole in any body is a play button (in a half disc or a leaf too, seen in the mix)
|
|
62
62
|
counter: [['half', 'leaf', 'an eye'], ['half', 'wedge', 'a play button'], ['quarter', 'wedge', 'a play button'], ['hexagon', 'wedge', 'a play button'], ['square', 'wedge', 'a play button'], ['half', 'triangle', 'a play button'], ['leaf', 'triangle', 'a play button'], ['pill', 'triangle', 'a play button'], ['quarter', 'triangle', 'a play button'], ['diamond', 'triangle', 'a play button'], ['disc', 'triangle', 'a play button'], ['rsquare', 'triangle', 'a play button'], ['square', 'triangle', 'a play button'], ['hexagon', 'triangle', 'a play button'], ['disc', 'wedge', 'a play button'], ['rsquare', 'wedge', 'a play button'], ['hexagon', 'disc', 'a nut'], ['triangle', 'disc', 'an eye in a triangle'], ['leaf', 'disc', 'an eye'], ['disc', 'leaf', 'an eye'], ['disc', 'square', 'a stop button'], ['disc', 'rsquare', 'a stop button'], ['rsquare', 'disc', 'a camera'], ['square', 'disc', 'a camera'], ['half', 'disc', 'an eye'], ['diamond', 'disc', 'an eye'], ['disc', 'pill', 'a no-entry sign'], ['disc', 'bar', 'a no-entry sign'], ['rsquare', 'pill', 'a battery'], ['hexagon', 'pill', 'a screw head'], ['disc', 'half', 'a face'], ['rsquare', 'half', 'a face'], ['square', 'half', 'a door'], ['square', 'arch', 'a door'], ['rsquare', 'arch', 'a door'], ['square', 'leaf', 'an eye'], ['rsquare', 'leaf', 'an eye'], ['hexagon', 'leaf', 'an eye']],
|
|
63
63
|
pair: [['triangle', 'square', 'an arrow'], ['triangle', 'rsquare', 'an arrow'], ['triangle', 'pill', 'an arrow'], ['wedge', 'square', 'an arrow'], ['triangle', 'bar', 'an arrow'], ['half', 'triangle', 'a play button']],
|
|
64
|
-
stack: [['half', 'square', 'a burger'], ['half', 'pill', 'a burger'], ['circle', 'square', 'a person'], ['circle', 'pill', 'a person'], ['circle', 'half', 'a person'], ['circle', 'arch', 'a person'], ['circle', 'triangle', 'a pin'], ['circle', 'chevron', 'a person'], ['circle', 'ring', 'an eye'], ['ring', 'half', 'an eye'], ['ring', 'pill', 'an eye'], ['ring', 'square', 'a person'], ['ring', 'triangle', 'a pin'], ['triangle', 'square', 'a house'], ['triangle', 'pill', 'an arrow'], ['chevron', 'square', 'a house'], ['triangle', 'half', 'a cone'], ['diamond', 'half', 'a cone']],
|
|
64
|
+
stack: [['diamond', 'triangle', 'an arrow'], ['triangle', 'half', 'a pin'], ['diamond', 'square', 'a house'], ['diamond', 'rsquare', 'a house'], ['triangle', 'square', 'a house'], ['triangle', 'rsquare', 'a house'], ['half', 'leaf', 'a person'], ['arch', 'leaf', 'a person'], ['half', 'square', 'a burger'], ['half', 'pill', 'a burger'], ['circle', 'square', 'a person'], ['circle', 'pill', 'a person'], ['circle', 'half', 'a person'], ['circle', 'arch', 'a person'], ['circle', 'triangle', 'a pin'], ['circle', 'chevron', 'a person'], ['circle', 'ring', 'an eye'], ['ring', 'half', 'an eye'], ['ring', 'pill', 'an eye'], ['ring', 'square', 'a person'], ['ring', 'triangle', 'a pin'], ['triangle', 'square', 'a house'], ['triangle', 'pill', 'an arrow'], ['chevron', 'square', 'a house'], ['triangle', 'half', 'a cone'], ['diamond', 'half', 'a cone']],
|
|
65
65
|
offset: [],
|
|
66
66
|
quarters: [],
|
|
67
67
|
};
|
package/src/recipes/bars.js
CHANGED
|
@@ -63,6 +63,8 @@ function cutOf(cut, i, n, at) {
|
|
|
63
63
|
export function build(params) {
|
|
64
64
|
const p = { ...params }, n = p.count;
|
|
65
65
|
if (p.spine === 'bottom' && n === 3 && p.lengths === 'arch') p.lengths = 'equal'; // a trident
|
|
66
|
+
// three bars, the middle one longest, are a plus (a cross): they rise instead
|
|
67
|
+
if (n === 3 && p.lengths === 'arch' && !p.level && p.spine === 'none') p.lengths = 'rising';
|
|
66
68
|
// rising bars on one foot are the signal-strength icon (slanted too), and on a bottom spine a bar chart: they hang
|
|
67
69
|
// from a top spine instead, a stepped comb, whatever their cut or slant
|
|
68
70
|
if (p.lengths === 'rising' && (p.spine === 'none' || p.spine === 'bottom') && !p.level) p.spine = 'top';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bubble: a speech bubble as a construction, after the chat marks of the owner's tech-brand audit (2026-11-27): a disc,
|
|
3
|
+
* rounded square or squircle-cornered block with a tail at one lower corner, and ONE move: the tail parted from the body
|
|
4
|
+
* by the gap, two bubbles overlapping with the back one cleared by the gap, the bubble cut into bands, a glyph cut in (a
|
|
5
|
+
* slot, a bar run in from the side, a quarter). Folded from one heavy band it read as a Q: left out. Never eyes or a face (no two
|
|
6
|
+
* holes in a bubble), never three dots (the typing indicator), never a heart, never lines of text (a message icon):
|
|
7
|
+
* a bubble takes at most one cut-out.
|
|
8
|
+
*/
|
|
9
|
+
import { U, D, I, rect, rr, circle, poly, grow, sector } from '@logomarks/core/geometry';
|
|
10
|
+
import { BOX, GAP, tidy } from '../draw.js';
|
|
11
|
+
|
|
12
|
+
/** @type {import('../index.js').Control[]} */
|
|
13
|
+
export const controls = [
|
|
14
|
+
{ key: 'body', label: 'Body', type: 'choice', options: ['disc', 'rounded', 'soft'], value: 'rounded' },
|
|
15
|
+
{ key: 'move', label: 'Move', type: 'choice', options: ['tail', 'pair', 'bands', 'glyph', 'none'], value: 'pair' },
|
|
16
|
+
{ key: 'glyph', label: 'Cut-out', type: 'choice', options: ['bar', 'quarter', 'slot'], value: 'bar' },
|
|
17
|
+
{ key: 'tail', label: 'Tail', type: 'choice', options: ['left', 'right'], value: 'left' },
|
|
18
|
+
{ key: 'tailSize', label: 'Tail size', type: 'range', min: 0.16, max: 0.3, step: 0.01, value: 0.22 },
|
|
19
|
+
{ key: 'bands', label: 'Bands', type: 'range', min: 2, max: 3, step: 1, value: 2 },
|
|
20
|
+
{ key: 'weight', label: 'Band weight', type: 'range', min: 0.13, max: 0.2, step: 0.005, value: 0.16 },
|
|
21
|
+
{ key: 'back', label: 'Back bubble', type: 'range', min: 0.55, max: 0.8, step: 0.01, value: 0.66 },
|
|
22
|
+
{ key: 'spacing', label: 'Gap', type: 'range', min: 1, max: 1.7, step: 0.05, value: 1.2 },
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A bubble's body `s` square at (x, y) and its tail: a corner of the body pulled down past the foot at the `side`. The
|
|
27
|
+
* disc's tail is a wedge under it; the rounded and soft blocks keep that corner sharp and run it down.
|
|
28
|
+
*/
|
|
29
|
+
function bubble(x, y, s, p, side = p.tail) {
|
|
30
|
+
const t = s * p.tailSize, left = side === 'left';
|
|
31
|
+
const r = p.body === 'disc' ? s / 2 : p.body === 'soft' ? s * 0.36 : s * 0.2;
|
|
32
|
+
const body = p.body === 'disc' ? circle(x + s / 2, y + s / 2, s / 2, 160) : rr(x, y, s, s, left ? [r, r, r, 0] : [r, r, 0, r]);
|
|
33
|
+
const cx = left ? x : x + s, foot = y + s;
|
|
34
|
+
// the tail: from the corner (or, on a disc, from under its side) down and out
|
|
35
|
+
const tail = p.body === 'disc'
|
|
36
|
+
? poly(left ? [[x + s * 0.12, y + s * 0.62], [x - t * 0.2, foot + t * 0.55], [x + s * 0.5, y + s * 0.94]] : [[x + s * 0.88, y + s * 0.62], [x + s + t * 0.2, foot + t * 0.55], [x + s * 0.5, y + s * 0.94]])
|
|
37
|
+
: poly(left ? [[cx, foot - t], [cx, foot + t * 0.95], [cx + t * 1.5, foot]] : [[cx, foot - t], [cx, foot + t * 0.95], [cx - t * 1.5, foot]]);
|
|
38
|
+
return { body, tail, all: U(body, tail) };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The mark for resolved params. */
|
|
42
|
+
export function build(p) {
|
|
43
|
+
const g = GAP * p.spacing, S = BOX.size * 0.84, x = BOX.cx - S / 2, y = BOX.cy - S / 2 - S * p.tailSize * 0.35;
|
|
44
|
+
const b = bubble(x, y, S, p);
|
|
45
|
+
// two round bubbles side by side are one tech brand's mark: a disc pair is drawn as rounded blocks
|
|
46
|
+
if (p.move === 'pair' && p.body === 'disc') return build({ ...p, body: 'soft' });
|
|
47
|
+
if (p.move === 'pair') {
|
|
48
|
+
// a smaller bubble behind, up and to the far side, its tail the other way; the front one whole, the back one
|
|
49
|
+
// cleared of it by the gap
|
|
50
|
+
const s2 = S * p.back, left = p.tail === 'left';
|
|
51
|
+
const fx = left ? BOX.x0 : BOX.x1 - S * 0.86, front = bubble(fx, BOX.y1 - S * 0.86 * (1 + p.tailSize * 0.6), S * 0.86, p);
|
|
52
|
+
const bx = left ? BOX.x1 - s2 : BOX.x0, back = bubble(bx, BOX.y0, s2, p, left ? 'right' : 'left');
|
|
53
|
+
return tidy(U(front.all, D(back.all, grow(front.all, g))));
|
|
54
|
+
}
|
|
55
|
+
if (p.move === 'tail') {
|
|
56
|
+
// the tail parted from the body: a right triangle a gap under the block's sharp corner (a disc with a parted
|
|
57
|
+
// wedge is a magnifier: the disc takes its tail whole and is cut into three bands instead)
|
|
58
|
+
if (p.body === 'disc') return build({ ...p, move: 'bands', bands: 3 });
|
|
59
|
+
const t = S * p.tailSize * 1.5, left = p.tail === 'left', cx = left ? x : x + S, ty = y + S + g;
|
|
60
|
+
const tail = poly(left ? [[cx, ty], [cx, ty + t], [cx + t * 1.25, ty]] : [[cx, ty], [cx, ty + t], [cx - t * 1.25, ty]]);
|
|
61
|
+
return tidy(U(b.body, tail));
|
|
62
|
+
}
|
|
63
|
+
// a disc with a bar run into it reads as an e: a disc's cut-out is its bands
|
|
64
|
+
if (p.move === 'bands' || (p.move === 'glyph' && p.body === 'disc')) {
|
|
65
|
+
// level gaps across the bubble, the tail riding with the lowest band
|
|
66
|
+
// a block cut into three is the lines of a message: a block takes one cut, a disc up to two
|
|
67
|
+
// (a disc cut once stays too solid a disc: a disc takes two cuts)
|
|
68
|
+
const n = p.body === 'disc' ? Math.max(3, p.bands) : 2, h = S / n, cuts = [];
|
|
69
|
+
for (let k = 1; k < n; k++) cuts.push(rect(x - S, y + k * h - g / 2, S * 3, g));
|
|
70
|
+
return tidy(D(b.all, U(...cuts)));
|
|
71
|
+
}
|
|
72
|
+
if (p.move === 'glyph') {
|
|
73
|
+
// one cut-out: a round-ended slot across the middle, a bar run in from the tail's far side, or a quarter disc
|
|
74
|
+
const cx = x + S / 2, cy = y + S / 2, w = S * p.weight;
|
|
75
|
+
if (p.glyph === 'bar') {
|
|
76
|
+
const fromRight = p.tail === 'left';
|
|
77
|
+
return tidy(D(b.all, rr(fromRight ? cx - S * 0.12 : x - S, cy - w / 2, S * 0.62 + S, w, w / 2)));
|
|
78
|
+
}
|
|
79
|
+
if (p.glyph === 'quarter') {
|
|
80
|
+
// a quarter bitten from the top corner away from the tail (a quarter hole in the middle read as a D or a P)
|
|
81
|
+
const q = S * 0.54, left = p.tail === 'left', qx = left ? x + S : x;
|
|
82
|
+
return tidy(D(b.all, circle(qx, y, q, 120)));
|
|
83
|
+
}
|
|
84
|
+
return tidy(D(b.all, rr(cx - S * 0.28, cy - w / 2, S * 0.56, w, w / 2)));
|
|
85
|
+
}
|
|
86
|
+
return tidy(b.all);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** One or two bubbles and their cut. */
|
|
90
|
+
export const guard = {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check: a tick as a construction, for tasks, compliance and done (the owner's tech-brand audit, 2026-11-27). A short leg
|
|
3
|
+
* and a long leg, heavy, with ONE move: the legs parted at the heel by the gap, the tick doubled or tripled in parallel
|
|
4
|
+
* bands, or the tick cut out of a slanted slab or a disc segment. Never a checkbox (nothing round it, no hole: a tick in a square), never a tick in a circle (the verified
|
|
5
|
+
* badge), never a thin stroke (the plain icon): every tick is heavy and carries its move. It never turns or mirrors (a
|
|
6
|
+
* tick backwards or on its side is no tick).
|
|
7
|
+
*/
|
|
8
|
+
import { U, D, I, poly, rect, rr, circle, grow, mitreBand } from '@logomarks/core/geometry';
|
|
9
|
+
import { BOX, GAP, tidy } from '../draw.js';
|
|
10
|
+
|
|
11
|
+
/** @type {import('../index.js').Control[]} */
|
|
12
|
+
export const controls = [
|
|
13
|
+
{ key: 'move', label: 'Move', type: 'choice', options: ['heel', 'double', 'triple', 'slab', 'half'], value: 'heel' },
|
|
14
|
+
{ key: 'weight', label: 'Weight', type: 'range', min: 0.15, max: 0.26, step: 0.005, value: 0.2 },
|
|
15
|
+
{ key: 'angle', label: 'Long leg angle', type: 'range', min: 40, max: 62, step: 1, value: 50 },
|
|
16
|
+
{ key: 'short', label: 'Short leg', type: 'range', min: 0.34, max: 0.56, step: 0.01, value: 0.44 },
|
|
17
|
+
{ key: 'ends', label: 'Ends', type: 'choice', options: ['square', 'level', 'round'], value: 'level' },
|
|
18
|
+
{ key: 'spacing', label: 'Gap', type: 'range', min: 1, max: 1.7, step: 0.05, value: 1.2 },
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
/** A tick's centreline: the short leg down to the heel, the long leg up, the heel at (hx, hy); `L` the long leg's length. */
|
|
22
|
+
function tickPts(hx, hy, L, p) {
|
|
23
|
+
const a = (p.angle * Math.PI) / 180, b = ((90 - p.angle + 10) * Math.PI) / 180, s = L * p.short;
|
|
24
|
+
return [[hx - s * Math.cos(b), hy - s * Math.sin(b)], [hx, hy], [hx + L * Math.cos(a), hy - L * Math.sin(a)]];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** A heavy tick of weight `w` on a centreline, its ends cut square to each leg, level, or round. */
|
|
28
|
+
function tick(pts, w, ends) {
|
|
29
|
+
if (ends === 'round') return U(mitreBand(pts, w), circle(...pts[0], w / 2, 64), circle(...pts[2], w / 2, 64));
|
|
30
|
+
if (ends !== 'level') return mitreBand(pts, w);
|
|
31
|
+
// level ends: each leg run on past its end, then cut by a level line through that end
|
|
32
|
+
const ext = (a, b, k) => [a[0] + (a[0] - b[0]) * k, a[1] + (a[1] - b[1]) * k], far = BOX.size * 3;
|
|
33
|
+
const s = mitreBand([ext(pts[0], pts[1], 0.4), pts[1], ext(pts[2], pts[1], 0.3)], w);
|
|
34
|
+
const right = rect(pts[1][0], pts[2][1], far, far), left = rect(pts[1][0] - far, pts[0][1], far, far);
|
|
35
|
+
return I(s, U(right, left));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The mark for resolved params. */
|
|
39
|
+
export function build(p) {
|
|
40
|
+
const g = GAP * p.spacing, w = BOX.size * p.weight, L = BOX.size * 0.78;
|
|
41
|
+
const hx = BOX.cx - L * 0.16, hy = BOX.cy + L * 0.3, pts = tickPts(hx, hy, L, p);
|
|
42
|
+
if (p.move === 'double' || p.move === 'triple') {
|
|
43
|
+
// the tick and one or two copies above it, each a gap clear of the one below
|
|
44
|
+
const n = p.move === 'double' ? 2 : 3, step = w + g, out = [];
|
|
45
|
+
for (let k = 0; k < n; k++) out.push(tick(pts.map(([x, y]) => [x + k * step * 0.18, y - k * step]), w, p.ends));
|
|
46
|
+
let s = out[0];
|
|
47
|
+
for (let k = 1; k < n; k++) s = U(s, D(out[k], grow(s, g)));
|
|
48
|
+
return tidy(s);
|
|
49
|
+
}
|
|
50
|
+
if (p.move === 'heel') {
|
|
51
|
+
// the two legs as two bars: the long one run back a little past the heel, the short one stopping a gap short of it
|
|
52
|
+
const [a, h, c] = pts, dl = [c[0] - h[0], c[1] - h[1]], ll = Math.hypot(...dl);
|
|
53
|
+
const back = [h[0] - (dl[0] / ll) * w * 0.5, h[1] - (dl[1] / ll) * w * 0.5];
|
|
54
|
+
let longBand = mitreBand([back, c], w), shortBand = mitreBand([a, h], w);
|
|
55
|
+
if (p.ends === 'round') { longBand = U(longBand, circle(...c, w / 2, 64)); shortBand = U(shortBand, circle(...a, w / 2, 64)); }
|
|
56
|
+
return tidy(U(longBand, D(shortBand, grow(longBand, g))));
|
|
57
|
+
}
|
|
58
|
+
if (p.move === 'half') {
|
|
59
|
+
// a half disc, a bowl, with a smaller tick cut out of it, the long leg running out over its rim
|
|
60
|
+
const R = BOX.size * 0.5, top = BOX.cy - R * 0.36, L2 = R * 1.25, w2 = w * 0.78;
|
|
61
|
+
const p2 = tickPts(BOX.cx - R * 0.14, top + R * 0.62, L2, p), t2 = tick(p2, w2, p.ends);
|
|
62
|
+
const bowl = I(circle(BOX.cx, top, R, 180), rect(BOX.x0 - 4, top, BOX.size + 8, BOX.size));
|
|
63
|
+
return tidy(D(bowl, grow(t2, g * 0.5)));
|
|
64
|
+
}
|
|
65
|
+
const t = tick(pts, w, p.ends);
|
|
66
|
+
// a slab or a half disc (a bowl) under the tick, its top level a little above the short leg's tip: the tick cut out of
|
|
67
|
+
// it, open where the long leg runs out of the top (the leg drawn on above it left shards at the edge). The slab, a
|
|
68
|
+
// box with the tick running out of it, is the checked-box UI icon: by hand only
|
|
69
|
+
const top = pts[0][1] - w * 1.5, bottom = pts[1][1] + w * 1.2;
|
|
70
|
+
const body = p.move === 'half'
|
|
71
|
+
? I(circle(BOX.cx, top, BOX.size * 0.46, 180), rect(BOX.x0 - 4, top, BOX.size + 8, BOX.size))
|
|
72
|
+
: poly([[BOX.x0 + BOX.size * 0.18, top], [BOX.x1, top], [BOX.x1 - BOX.size * 0.18, bottom], [BOX.x0, bottom]]);
|
|
73
|
+
return tidy(D(body, grow(t, g * 0.5)));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** A heavy tick and its move. */
|
|
77
|
+
export const guard = {};
|
package/src/recipes/chevrons.js
CHANGED
|
@@ -31,7 +31,17 @@ function chevron(cx, y, half, t, k, tip, solid) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** The mark for resolved params. */
|
|
34
|
-
export function build(
|
|
34
|
+
export function build(params) {
|
|
35
|
+
const p = { ...params };
|
|
36
|
+
// one hard chevron alone is an arrow head (>, ^): one only as the soft chevron with its slot (R21); sideways a soft one
|
|
37
|
+
// is an arrow too, so it points up or down
|
|
38
|
+
if (p.count === 1 && !p.soft) p.count = 2;
|
|
39
|
+
// skipping the second of two leaves one chevron alone: the same arrow head
|
|
40
|
+
if (p.move === 'skip' && p.count < 3) p.move = 'none';
|
|
41
|
+
// two plain chevrons alone (or three with the middle skipped) are a show-more icon: without a body, three show at least
|
|
42
|
+
// (the lone soft chevron with its slot, R21, is its own mark and stays one)
|
|
43
|
+
if (p.body !== 'hexagon' && !(p.soft && p.count === 1) && p.count - (p.move === 'skip' ? 1 : 0) < 3) { if (p.move === 'skip') p.move = 'none'; p.count = Math.max(3, p.count); }
|
|
44
|
+
if (p.count === 1 && p.soft && (p.point === 'left' || p.point === 'right')) p.point = p.point === 'left' ? 'up' : 'down';
|
|
35
45
|
// a soft chevron opened wide, or a heavy one, rounds into a blob or a heart: soft keeps the opening to 60–100°
|
|
36
46
|
const angle = p.soft ? Math.min(100, Math.max(60, p.angle)) : p.angle;
|
|
37
47
|
const n = p.count, k = Math.tan(((angle / 2) * Math.PI) / 180); // half-width over drop
|