@logomarks/lookbook 0.0.0-stage → 0.1.2
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 +46 -0
- package/LICENSE +21 -0
- package/README.md +56 -2
- package/package.json +85 -4
- package/src/index.d.ts +16 -0
- package/src/index.js +16 -0
- package/src/live.d.ts +105 -0
- package/src/live.js +146 -0
- package/src/looks/bloom.d.ts +40 -0
- package/src/looks/bloom.js +134 -0
- package/src/looks/club.d.ts +39 -0
- package/src/looks/club.js +140 -0
- package/src/looks/index.d.ts +186 -0
- package/src/looks/index.js +1070 -0
- package/src/looks/kit.d.ts +72 -0
- package/src/looks/kit.js +54 -0
- package/src/looks/modern.d.ts +90 -0
- package/src/looks/modern.js +457 -0
- package/src/looks/street.d.ts +100 -0
- package/src/looks/street.js +425 -0
- package/src/looks/studio.d.ts +52 -0
- package/src/looks/studio.js +269 -0
- package/src/marks.d.ts +57 -0
- package/src/marks.js +101 -0
- package/src/promo.d.ts +37 -0
- package/src/promo.js +48 -0
- package/src/styles/wall-looks.css +4900 -0
- package/src/styles/wall.css +1957 -0
- package/src/wall.d.ts +135 -0
- package/src/wall.js +441 -0
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @logomarks/lookbook/looks/street
|
|
3
|
+
*
|
|
4
|
+
* The street set of drawn looks (2026-11-08, the owner: "do all 8"): laser, orbittext, sunshadow, patch, slitscan,
|
|
5
|
+
* ascii, stencil and acrylic. Festival, street and craft. Same rules as ./index.js: pure HTML strings from
|
|
6
|
+
* the card's seeded random, per-card values as custom properties in `style`, ids under the card's uid, motion in CSS
|
|
7
|
+
* only and only while `is-live`, the still styles the final frame; one CSS block each in wall-looks.css.
|
|
8
|
+
*
|
|
9
|
+
* - laser: beams fan up from one point through haze and trace the mark, then sweep off (animated, heavy).
|
|
10
|
+
* - orbittext: the name and tagline round a ring that turns slowly about the mark (animated).
|
|
11
|
+
* - sunshadow: the mark as a patch of sunlight on a plaster wall, palm-leaf shadows swaying over it (animated).
|
|
12
|
+
* - patch: the mark satin-stitched on a round twill patch with a rolled (merrowed) edge.
|
|
13
|
+
* - slitscan: the mark smeared into streaks, strip by strip, snapping back into shape (animated, heavy).
|
|
14
|
+
* - ascii: the mark as a slab of text characters spinning in 3D, shaded by a light (animated, a 36-frame flipbook).
|
|
15
|
+
* - stencil: the mark sprayed through a stencil onto concrete: soft overspray, a few drips.
|
|
16
|
+
* - acrylic: the mark cut from frosted acrylic, lit from behind, glowing on a dark wall.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { escapeHtml } from '@arraypress/text';
|
|
20
|
+
import { hash, rng } from '@arraypress/og-image/palette';
|
|
21
|
+
import { markBox, markCells } from '../marks.js';
|
|
22
|
+
import { f1, pad2, def, use, mk, meta, art, around, pickOf } from './kit.js';
|
|
23
|
+
|
|
24
|
+
/** The laser's frame: a card-shaped viewBox (4 : 5) round the 512 canvas with 40 units of air each side (it was 512
|
|
25
|
+
* wide, and a wide mark's glowing outline ran off the card), the extra height split above and below. */
|
|
26
|
+
const LASER = '-40 -114 592 740';
|
|
27
|
+
|
|
28
|
+
/* ---------- shared: points on the mark ---------- */
|
|
29
|
+
|
|
30
|
+
/** Up to `n` points on the mark's outline (its edge cells' centres, `cells` across), spread round it by angle. */
|
|
31
|
+
export function edgePoints(paths, n, cells = 22) {
|
|
32
|
+
const { grid, on } = markCells(paths, cells);
|
|
33
|
+
const at = (c, r) => c >= 0 && r >= 0 && c < grid.cols && r < grid.rows && on[r * grid.cols + c] === 1;
|
|
34
|
+
const pts = [];
|
|
35
|
+
for (let r = 0; r < grid.rows; r++)
|
|
36
|
+
for (let c = 0; c < grid.cols; c++)
|
|
37
|
+
if (at(c, r) && !(at(c - 1, r) && at(c + 1, r) && at(c, r - 1) && at(c, r + 1)))
|
|
38
|
+
pts.push([grid.x0 + (c + 0.5) * grid.cell, grid.y0 + (r + 0.5) * grid.cell]);
|
|
39
|
+
if (!pts.length) return [[256, 256]];
|
|
40
|
+
const b = markBox(paths),
|
|
41
|
+
cx = b.x + b.w / 2,
|
|
42
|
+
cy = b.y + b.h / 2;
|
|
43
|
+
pts.sort((p, q) => Math.atan2(p[1] - cy, p[0] - cx) - Math.atan2(q[1] - cy, q[0] - cx));
|
|
44
|
+
const step = pts.length / Math.min(n, pts.length);
|
|
45
|
+
return [...Array(Math.min(n, pts.length))].map((_, i) => pts[Math.floor(i * step)]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Up to `n` drip starts: the lowest filled cell of some of the mark's columns (seeded by the mark, so a retarget
|
|
49
|
+
* draws the same drips the card would). Each with a length. */
|
|
50
|
+
export function dripPoints(paths, n) {
|
|
51
|
+
const { grid, on } = markCells(paths, 24);
|
|
52
|
+
const lows = [];
|
|
53
|
+
for (let c = 0; c < grid.cols; c++)
|
|
54
|
+
for (let r = grid.rows - 1; r >= 0; r--)
|
|
55
|
+
if (on[r * grid.cols + c] === 1) {
|
|
56
|
+
lows.push([grid.x0 + (c + 0.5) * grid.cell, grid.y0 + (r + 1) * grid.cell]);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
const r = rng(hash(paths.slice(0, 64)) + 41);
|
|
60
|
+
const out = [];
|
|
61
|
+
for (let i = 0; i < n && lows.length; i++) {
|
|
62
|
+
const [x, y] = lows.splice(Math.floor(r() * lows.length), 1)[0];
|
|
63
|
+
out.push({ x, y: y - 4, len: 30 + r() * 80, w: 8 + r() * 6 });
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* ---------- laser ---------- */
|
|
69
|
+
|
|
70
|
+
/** The laser's beams: from the source to points on the mark's outline. */
|
|
71
|
+
export function laserBeams(paths) {
|
|
72
|
+
return edgePoints(paths, 14)
|
|
73
|
+
.map(([x, y], i) => `<line class="wx-lzbeam" x1="256" y1="600" x2="${f1(x)}" y2="${f1(y)}" style="--i:${i}" />`)
|
|
74
|
+
.join('');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** laser: dark haze, beams fanning up from one point at the foot of the card; they sweep in, the mark's outline traces
|
|
78
|
+
* itself in laser light, the beams pulse on it, then sweep off. */
|
|
79
|
+
function laser(c) {
|
|
80
|
+
const pick = pickOf(c);
|
|
81
|
+
const ink = pick(['#39ff14', '#00f0ff', '#ff2bd6', '#f4f4ff', '#39ff14']);
|
|
82
|
+
return {
|
|
83
|
+
style: `;--ink:${ink}`,
|
|
84
|
+
attrs: ' data-anim="heavy"',
|
|
85
|
+
inner:
|
|
86
|
+
art(
|
|
87
|
+
LASER,
|
|
88
|
+
// the beams inside the optical-size group too, so they land on the outline at any scale
|
|
89
|
+
`<defs>${def(c)}</defs>` +
|
|
90
|
+
mk(
|
|
91
|
+
`<g class="wx-lzbeams" data-laser>${laserBeams(c.paths)}</g><g class="wx-lzglow">${use(c, 'wx-lzline')}</g>${use(c, 'wx-lzcore')}`,
|
|
92
|
+
),
|
|
93
|
+
) +
|
|
94
|
+
meta('tl', `Stage ${pad2(1 + Math.floor(c.r() * 9))}`) +
|
|
95
|
+
meta('tr', escapeHtml(c.line)) +
|
|
96
|
+
`<span class="wx-foot is-centre"><b class="wc-name wx-lzname">${escapeHtml(c.name)}</b></span>`,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* ---------- orbittext ---------- */
|
|
101
|
+
|
|
102
|
+
/** orbittext: the name and tagline round a ring that turns slowly about the mark, between two hairline circles. */
|
|
103
|
+
function orbittext(c) {
|
|
104
|
+
const pick = pickOf(c);
|
|
105
|
+
const [bg, fg] = pick(c.palettes);
|
|
106
|
+
const id = `${c.uid}-orb`;
|
|
107
|
+
// the ring (r = 204) holds about 68 of Michroma's capitals at 25 units (each about 0.75 em). The name and tagline go
|
|
108
|
+
// round as many whole times as fit (the name alone when the tagline is too long), the type a little smaller when
|
|
109
|
+
// one pass is long, and textLength closes the last gap: squeezed past that, the letters run into each other.
|
|
110
|
+
const fill = (w) => w.repeat(Math.max(1, Math.floor(68 / w.length)));
|
|
111
|
+
// the name and tagline, or the name alone, whichever comes nearer to filling the ring without spreading it thin
|
|
112
|
+
const text = [`${c.name} · ${c.tagline.replace(/[.!]+$/, '')} · `, `${c.name} · `]
|
|
113
|
+
.map((w) => fill(w.toUpperCase()))
|
|
114
|
+
.reduce((a, b) => (Math.abs(68 - b.length) < Math.abs(68 - a.length) ? b : a));
|
|
115
|
+
const size = Math.min(25, 1270 / (text.length * 0.75));
|
|
116
|
+
return {
|
|
117
|
+
style: `;--bg:${bg};--fg:${fg}`,
|
|
118
|
+
attrs: '',
|
|
119
|
+
inner: art(
|
|
120
|
+
around(20),
|
|
121
|
+
`<defs>${def(c)}<path id="${id}" d="M256 52a204 204 0 1 1 0 408a204 204 0 1 1 0-408" /></defs>` +
|
|
122
|
+
`<circle class="wx-orline" cx="256" cy="256" r="232" /><circle class="wx-orline" cx="256" cy="256" r="178" />` +
|
|
123
|
+
`<g class="wx-orring"><text class="wx-ortext" font-size="${f1(size)}"><textPath href="#${id}" textLength="1270" lengthAdjust="spacing">${escapeHtml(text)}</textPath></text></g>` +
|
|
124
|
+
`<g transform="translate(256 256) scale(0.56) translate(-256 -256)">${mk(use(c, 'wx-ormark'))}</g>`,
|
|
125
|
+
),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* ---------- sunshadow ---------- */
|
|
130
|
+
|
|
131
|
+
/** sunshadow: a warm plaster wall, the mark a patch of low sunlight on it (soft-edged, skewed as light through a window
|
|
132
|
+
* falls), palm leaves' shadows swaying over the wall and the light. */
|
|
133
|
+
function sunshadow(c) {
|
|
134
|
+
const pick = pickOf(c);
|
|
135
|
+
const [wall, ink] = pick([
|
|
136
|
+
['#e8dcc6', '#5a4a36'],
|
|
137
|
+
['#e9d3c2', '#5b3b2e'],
|
|
138
|
+
['#d9dccf', '#3d4436'],
|
|
139
|
+
['#efe4d2', '#4a3a2a'],
|
|
140
|
+
]);
|
|
141
|
+
return {
|
|
142
|
+
style: `;--bg:${wall};--fg:${ink};--sd:-${(c.r() * 10).toFixed(2)}s`,
|
|
143
|
+
attrs: '',
|
|
144
|
+
inner:
|
|
145
|
+
art(around(60), `<defs>${def(c)}</defs>${mk(`<g class="wx-sslight">${use(c, '')}</g>`)}`) +
|
|
146
|
+
`<img class="wx-ssleaves" src="${c.glass(/\/palm-\d+\.webp$/)}" alt="" loading="lazy" decoding="async" />` +
|
|
147
|
+
meta('tl', escapeHtml(c.line)) +
|
|
148
|
+
`<span class="wx-foot"><b class="wc-name wx-ssname">${escapeHtml(c.name)}</b><i>${escapeHtml(c.tagline)}</i></span>`,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* ---------- patch ---------- */
|
|
153
|
+
|
|
154
|
+
/** patch: a round twill patch with a merrowed edge, the mark satin-stitched on it (fine slanted thread lines, a raised
|
|
155
|
+
* shadow), on denim or canvas. */
|
|
156
|
+
function patch(c) {
|
|
157
|
+
const pick = pickOf(c);
|
|
158
|
+
const [twill, thread, cloth] = pick([
|
|
159
|
+
['#1b2a49', '#f2c14e', '#33415c'],
|
|
160
|
+
['#0f3d2e', '#f4efe6', '#2f3b52'],
|
|
161
|
+
['#7a1f1f', '#f6e7c1', '#d9d2c3'],
|
|
162
|
+
['#111214', c.accent, '#3a3f47'],
|
|
163
|
+
['#f4efe6', '#d1495b', '#2f3b52'],
|
|
164
|
+
]);
|
|
165
|
+
const id = c.uid;
|
|
166
|
+
const satin = `<pattern id="${id}-sat" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(58)"><rect width="6" height="6" fill="${thread}" /><rect width="1.6" height="6" fill="#fff" fill-opacity="0.28" /><rect x="4.2" width="1.2" height="6" fill="#000" fill-opacity="0.18" /></pattern>`;
|
|
167
|
+
const weave = `<pattern id="${id}-tw" width="8" height="8" patternUnits="userSpaceOnUse" patternTransform="rotate(-45)"><rect width="8" height="8" fill="${twill}" /><rect width="8" height="2.4" fill="#fff" fill-opacity="0.06" /></pattern>`;
|
|
168
|
+
const raised = `<filter id="${id}-up" x="-10%" y="-10%" width="120%" height="120%"><feDropShadow dx="0" dy="3" stdDeviation="3" flood-color="#000" flood-opacity="0.45" /></filter>`;
|
|
169
|
+
return {
|
|
170
|
+
style: `;--bg:${cloth};--thread:${thread};--fg:${cloth === '#d9d2c3' ? '#2b2b2b' : '#f2efe6'}`,
|
|
171
|
+
attrs: '',
|
|
172
|
+
inner:
|
|
173
|
+
art(
|
|
174
|
+
around(24),
|
|
175
|
+
`<defs>${def(c)}${satin}${weave}${raised}</defs>` +
|
|
176
|
+
`<g filter="url(#${id}-up)"><circle cx="256" cy="256" r="236" fill="url(#${id}-tw)" />` +
|
|
177
|
+
`<circle class="wx-ptedge" cx="256" cy="256" r="236" /></g>` +
|
|
178
|
+
`<g transform="translate(256 256) scale(0.66) translate(-256 -256)" filter="url(#${id}-up)">${mk(`${use(c, '', ` fill="url(#${id}-sat)"`)}${use(c, 'wx-ptrim')}`)}</g>`,
|
|
179
|
+
) +
|
|
180
|
+
meta('bl', escapeHtml(c.name)) +
|
|
181
|
+
meta('br', `Patch ${pad2(1 + Math.floor(c.r() * 60))}`),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* ---------- slitscan ---------- */
|
|
186
|
+
|
|
187
|
+
const STRIPS = 22;
|
|
188
|
+
|
|
189
|
+
/** slitscan: the mark cut into thin horizontal strips, each smeared sideways by its own amount (a long streak), which
|
|
190
|
+
* snap back into the mark one after another, hold, and smear off again. */
|
|
191
|
+
function slitscan(c) {
|
|
192
|
+
const pick = pickOf(c);
|
|
193
|
+
const [bg, fg] = pick(c.palettes);
|
|
194
|
+
const id = c.uid;
|
|
195
|
+
const h = 512 / STRIPS;
|
|
196
|
+
const clips = [...Array(STRIPS)]
|
|
197
|
+
.map((_, i) => `<clipPath id="${id}-s${i}"><rect x="-600" y="${f1(i * h)}" width="1712" height="${f1(h + 2)}" /></clipPath>`)
|
|
198
|
+
.join('');
|
|
199
|
+
const dir = c.r() < 0.5 ? -1 : 1;
|
|
200
|
+
const strips = [...Array(STRIPS)]
|
|
201
|
+
.map((_, i) => {
|
|
202
|
+
const k = 1 + 2.6 * Math.abs(Math.sin(i * 0.55 + c.r() * 3));
|
|
203
|
+
return `<g clip-path="url(#${id}-s${i})"><g class="wx-slstrip" style="--k:${k.toFixed(2)};--x:${(dir * (40 + 120 * Math.abs(Math.cos(i * 0.37)))).toFixed(0)}px;--i:${i}">${use(c, '')}</g></g>`;
|
|
204
|
+
})
|
|
205
|
+
.join('');
|
|
206
|
+
return {
|
|
207
|
+
style: `;--bg:${bg};--fg:${fg}`,
|
|
208
|
+
attrs: ' data-anim="heavy"',
|
|
209
|
+
inner:
|
|
210
|
+
art(around(60), `<defs>${def(c)}${clips}</defs>${mk(`<g class="wx-slghost">${use(c, '')}</g>${strips}`)}`) +
|
|
211
|
+
meta('tl', `Scan ${pad2(1 + Math.floor(c.r() * 30))}`) +
|
|
212
|
+
meta('tr', escapeHtml(c.line)) +
|
|
213
|
+
`<span class="wx-foot">${`<b class="wc-name" style="${c.type}">${escapeHtml(c.name)}</b>`}</span>`,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* ---------- ascii: a 3D spinning ASCII render (the "donut.c" way) ---------- */
|
|
218
|
+
|
|
219
|
+
/** Frames in one turn, columns across, and the slab's depth as a share of the mark's longest side. */
|
|
220
|
+
export const ASCII3D = { frames: 36, cols: 36, depth: 0.2 };
|
|
221
|
+
/** Characters from dark to bright (the classic donut ramp). */
|
|
222
|
+
const LUMA = '.,-~:;=!*#$@';
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* The mark extruded into a slab and turned once round its upright axis, as `frames` frames of ASCII art. The slab's
|
|
226
|
+
* faces and side walls are sampled as points (the mark's cells, `on` from core's coverage); each frame turns them,
|
|
227
|
+
* keeps the nearest point a character cell (a depth buffer), and picks its character by how squarely it faces a
|
|
228
|
+
* light up and to the left. A character is about twice as tall as wide, so a row is two columns' height.
|
|
229
|
+
*
|
|
230
|
+
* @param paths The mark's paths' markup.
|
|
231
|
+
* @returns The frames (rows of text) and the grid's size.
|
|
232
|
+
*/
|
|
233
|
+
export function ascii3d(paths) {
|
|
234
|
+
const { frames: N, cols: C, depth } = ASCII3D;
|
|
235
|
+
const { grid, on } = markCells(paths, 56);
|
|
236
|
+
const at = (c, r) => c >= 0 && r >= 0 && c < grid.cols && r < grid.rows && on[r * grid.cols + c] === 1;
|
|
237
|
+
const cx = grid.x0 + (grid.cols * grid.cell) / 2,
|
|
238
|
+
cy = grid.y0 + (grid.rows * grid.cell) / 2;
|
|
239
|
+
const D = depth * Math.max(grid.cols, grid.rows) * grid.cell;
|
|
240
|
+
// points: [x, y, z, nx, ny, nz], about the mark's centre
|
|
241
|
+
const pts = [];
|
|
242
|
+
const zSteps = Math.max(2, Math.ceil(D / (grid.cell * 0.8)));
|
|
243
|
+
for (let r = 0; r < grid.rows; r++)
|
|
244
|
+
for (let c = 0; c < grid.cols; c++) {
|
|
245
|
+
if (!at(c, r)) continue;
|
|
246
|
+
const x = grid.x0 + (c + 0.5) * grid.cell - cx,
|
|
247
|
+
y = grid.y0 + (r + 0.5) * grid.cell - cy;
|
|
248
|
+
// the faces bow out a little (a pillow), so the light grades across them and uses the whole ramp
|
|
249
|
+
const bx = (0.55 * x) / ((grid.cols * grid.cell) / 2),
|
|
250
|
+
by = (0.55 * y) / ((grid.rows * grid.cell) / 2),
|
|
251
|
+
bn = Math.hypot(bx, by, 1);
|
|
252
|
+
pts.push([x, y, D / 2, bx / bn, by / bn, 1 / bn], [x, y, -D / 2, bx / bn, by / bn, -1 / bn]);
|
|
253
|
+
// a side wall wherever a neighbour is empty, facing out
|
|
254
|
+
for (const [dx, dy] of [
|
|
255
|
+
[1, 0],
|
|
256
|
+
[-1, 0],
|
|
257
|
+
[0, 1],
|
|
258
|
+
[0, -1],
|
|
259
|
+
]) {
|
|
260
|
+
if (at(c + dx, r + dy)) continue;
|
|
261
|
+
for (let k = 0; k <= zSteps; k++)
|
|
262
|
+
pts.push([x + (dx * grid.cell) / 2, y + (dy * grid.cell) / 2, -D / 2 + (D * k) / zSteps, dx, dy, 0]);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// the turning radius sets the width; rows cover the height at twice a column's size
|
|
266
|
+
let rad = 1,
|
|
267
|
+
hy = 1;
|
|
268
|
+
for (const p of pts) {
|
|
269
|
+
rad = Math.max(rad, Math.hypot(p[0], p[2]));
|
|
270
|
+
hy = Math.max(hy, Math.abs(p[1]));
|
|
271
|
+
}
|
|
272
|
+
const cw = (2 * rad * 1.04) / C,
|
|
273
|
+
ch = cw * 2,
|
|
274
|
+
R = Math.max(1, Math.ceil((2 * hy * 1.04) / ch));
|
|
275
|
+
const L = (([x, y, z]) => {
|
|
276
|
+
const n = Math.hypot(x, y, z);
|
|
277
|
+
return [x / n, y / n, z / n];
|
|
278
|
+
})([-0.45, -0.5, 0.74]);
|
|
279
|
+
const frames = [];
|
|
280
|
+
for (let f = 0; f < N; f++) {
|
|
281
|
+
const a = (2 * Math.PI * f) / N,
|
|
282
|
+
ca = Math.cos(a),
|
|
283
|
+
sa = Math.sin(a);
|
|
284
|
+
const zbuf = new Float32Array(C * R).fill(-Infinity);
|
|
285
|
+
const lum = new Float32Array(C * R).fill(-1);
|
|
286
|
+
for (const [x, y, z, nx, ny, nz] of pts) {
|
|
287
|
+
const X = x * ca + z * sa,
|
|
288
|
+
Z = -x * sa + z * ca,
|
|
289
|
+
NX = nx * ca + nz * sa,
|
|
290
|
+
NZ = -nx * sa + nz * ca;
|
|
291
|
+
if (NZ < -0.05) continue; // facing away
|
|
292
|
+
const col = Math.floor(X / cw + C / 2),
|
|
293
|
+
row = Math.floor(y / ch + R / 2);
|
|
294
|
+
if (col < 0 || row < 0 || col >= C || row >= R) continue;
|
|
295
|
+
const i = row * C + col;
|
|
296
|
+
if (Z <= zbuf[i]) continue;
|
|
297
|
+
zbuf[i] = Z;
|
|
298
|
+
lum[i] = Math.max(0, NX * L[0] + ny * L[1] + NZ * L[2]);
|
|
299
|
+
}
|
|
300
|
+
const rows = [];
|
|
301
|
+
for (let r = 0; r < R; r++) {
|
|
302
|
+
let line = '';
|
|
303
|
+
for (let c = 0; c < C; c++) {
|
|
304
|
+
const v = lum[r * C + c];
|
|
305
|
+
line += v < 0 ? ' ' : LUMA[Math.min(LUMA.length - 1, Math.floor(v * (LUMA.length - 0.01)))];
|
|
306
|
+
}
|
|
307
|
+
rows.push(line);
|
|
308
|
+
}
|
|
309
|
+
frames.push(rows);
|
|
310
|
+
}
|
|
311
|
+
return { frames, cols: C, rows: R };
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** The frame the still shows: a three-quarter turn (about 30° off face-on). */
|
|
315
|
+
const STILL_FRAME = 33;
|
|
316
|
+
|
|
317
|
+
/** The frames as markup: one block each, stacked, the CSS showing one at a time (each delayed by its place in the turn). */
|
|
318
|
+
export const ascii3dArt = (frames) =>
|
|
319
|
+
frames
|
|
320
|
+
.map((rows, f) => `<span class="wx-a3f${f === STILL_FRAME ? ' is-still' : ''}" style="--f:${f}">${escapeHtml(rows.join('\n'))}</span>`)
|
|
321
|
+
.join('');
|
|
322
|
+
|
|
323
|
+
/** ascii: the mark as a slab of text characters spinning in 3D on a screen, shaded by a light up and to the left; the
|
|
324
|
+
* name at a prompt under it. */
|
|
325
|
+
function ascii(c) {
|
|
326
|
+
const pick = pickOf(c);
|
|
327
|
+
const [bg, fg] = pick([
|
|
328
|
+
['#0b0d0c', '#e8e6df'],
|
|
329
|
+
['#06110a', '#33ff66'],
|
|
330
|
+
['#140d00', '#ffb000'],
|
|
331
|
+
['#f2efe6', '#1a1a1a'],
|
|
332
|
+
['#0a0a23', '#7dd3fc'],
|
|
333
|
+
]);
|
|
334
|
+
const art3 = ascii3d(c.paths);
|
|
335
|
+
return {
|
|
336
|
+
style: `;--bg:${bg};--fg:${fg};--cols:${art3.cols};--rows:${art3.rows}`,
|
|
337
|
+
attrs: '',
|
|
338
|
+
inner:
|
|
339
|
+
`<svg class="wx-def" aria-hidden="true"><defs>${def(c)}</defs></svg>` +
|
|
340
|
+
`<span class="wx-ascii" data-ascii aria-hidden="true">${ascii3dArt(art3.frames)}</span>` +
|
|
341
|
+
meta('tl', `${escapeHtml(c.name.toLowerCase().replace(/\s+/g, '-'))}.obj`) +
|
|
342
|
+
meta('tr', `${art3.cols} × ${art3.rows} · ${ASCII3D.frames} fr`) +
|
|
343
|
+
`<span class="wx-foot wx-ascname"><b class="wc-name">> ${escapeHtml(c.name.toLowerCase())}<i class="wx-asccur">_</i></b></span>`,
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* ---------- stencil ---------- */
|
|
348
|
+
|
|
349
|
+
/** The stencil's drips as markup. */
|
|
350
|
+
export const dripArt = (paths) =>
|
|
351
|
+
dripPoints(paths, 3)
|
|
352
|
+
.map((d) => `<rect x="${f1(d.x - d.w / 2)}" y="${f1(d.y)}" width="${f1(d.w)}" height="${f1(d.len)}" rx="${f1(d.w / 2)}" />`)
|
|
353
|
+
.join('');
|
|
354
|
+
|
|
355
|
+
/** stencil: the mark sprayed through a stencil onto concrete: a soft halo of overspray, speckled edges, three drips;
|
|
356
|
+
* the name sprayed under it. */
|
|
357
|
+
function stencil(c) {
|
|
358
|
+
const pick = pickOf(c);
|
|
359
|
+
const paint = pick(['#ff3b30', '#ffd60a', '#111111', '#ff2e88', '#0a84ff', c.accent, '#f4f4f0']);
|
|
360
|
+
const id = c.uid;
|
|
361
|
+
// concrete: fine turbulence greyed into speckle over the wall's grey
|
|
362
|
+
const concrete = `<filter id="${id}-cc" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="3" seed="${hash(c.slug) % 97}" /><feColorMatrix values="0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 -1.6 1.1" /></filter>`;
|
|
363
|
+
// the paint's edge roughened by noise, and its overspray (a wide blur of the same)
|
|
364
|
+
const rough = `<filter id="${id}-sp" x="-20%" y="-20%" width="140%" height="140%"><feTurbulence type="fractalNoise" baseFrequency="0.7" numOctaves="2" seed="7" result="n" /><feDisplacementMap in="SourceGraphic" in2="n" scale="5" /></filter>`;
|
|
365
|
+
const spray = `<filter id="${id}-os" x="-30%" y="-30%" width="160%" height="160%"><feGaussianBlur stdDeviation="9" /></filter>`;
|
|
366
|
+
return {
|
|
367
|
+
style: `;--paint:${paint}`,
|
|
368
|
+
attrs: '',
|
|
369
|
+
inner:
|
|
370
|
+
`<svg class="wx-stwall" viewBox="0 0 400 500" preserveAspectRatio="none" aria-hidden="true"><defs>${concrete}</defs><rect width="400" height="500" filter="url(#${id}-cc)" /></svg>` +
|
|
371
|
+
art(
|
|
372
|
+
around(60),
|
|
373
|
+
`<defs>${def(c)}${rough}${spray}</defs>` +
|
|
374
|
+
mk(
|
|
375
|
+
`<g class="wx-stover" filter="url(#${id}-os)">${use(c, '')}</g><g filter="url(#${id}-sp)">${use(c, '')}<g class="wx-stdrips" data-drips>${dripArt(c.paths)}</g></g>`,
|
|
376
|
+
),
|
|
377
|
+
) +
|
|
378
|
+
`<span class="wx-foot is-centre"><b class="wc-name wx-stname">${escapeHtml(c.name)}</b></span>`,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* ---------- acrylic ---------- */
|
|
383
|
+
|
|
384
|
+
/** acrylic: the mark cut from frosted acrylic, standing off a dark wall and lit from behind: a wide halo of its light on
|
|
385
|
+
* the wall, a bright polished edge, the face frosted white. */
|
|
386
|
+
function acrylic(c) {
|
|
387
|
+
const pick = pickOf(c);
|
|
388
|
+
const light = pick(['#fff1d6', '#d9f1ff', '#ffd9ec', '#e4ff8a', '#fff1d6']);
|
|
389
|
+
const halo = `<filter id="${c.uid}-h" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="30" /></filter>`;
|
|
390
|
+
return {
|
|
391
|
+
style: `;--ink:${light}`,
|
|
392
|
+
attrs: '',
|
|
393
|
+
inner:
|
|
394
|
+
art(
|
|
395
|
+
around(70),
|
|
396
|
+
`<defs>${def(c)}${halo}</defs>${mk(`${use(c, 'wx-achalo', ` filter="url(#${c.uid}-h)"`)}${use(c, 'wx-acface')}${use(c, 'wx-acedge')}`)}`,
|
|
397
|
+
) +
|
|
398
|
+
meta('tl', escapeHtml(c.line)) +
|
|
399
|
+
`<span class="wx-foot is-centre"><b class="wc-name wx-acname">${escapeHtml(c.name)}</b></span>`,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/** The street set's builders, by kind. */
|
|
404
|
+
export const STREET = { laser, orbittext, sunshadow, patch, slitscan, ascii, stencil, acrylic };
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Another mark on a street card (the expanded view's "try another"): the laser's beams, the ASCII rows and the drips
|
|
408
|
+
* are drawn from the mark, so they're redrawn for the new one; the rest only use the mark's one copy.
|
|
409
|
+
*
|
|
410
|
+
* @param el The card.
|
|
411
|
+
* @param paths The new mark's paths' markup.
|
|
412
|
+
*/
|
|
413
|
+
export function retargetStreet(el, paths) {
|
|
414
|
+
const beams = el.querySelector('[data-laser]');
|
|
415
|
+
if (beams) beams.innerHTML = laserBeams(paths);
|
|
416
|
+
const asc = el.querySelector('[data-ascii]');
|
|
417
|
+
if (asc) {
|
|
418
|
+
const art3 = ascii3d(paths);
|
|
419
|
+
asc.innerHTML = ascii3dArt(art3.frames);
|
|
420
|
+
el.style.setProperty('--cols', String(art3.cols));
|
|
421
|
+
el.style.setProperty('--rows', String(art3.rows));
|
|
422
|
+
}
|
|
423
|
+
const drips = el.querySelector('[data-drips]');
|
|
424
|
+
if (drips) drips.innerHTML = dripArt(paths);
|
|
425
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @logomarks/lookbook/looks/studio
|
|
3
|
+
*
|
|
4
|
+
* The Lookbook's studio set (2026-11-12; the owner: "a few new ones … that are modern and look good"): frost, spectral,
|
|
5
|
+
* editorial, brandsheet and overprint. Quiet, current brand design: soft colour behind glass, a grainy spectrum in the
|
|
6
|
+
* mark, big type with a small mark, a brand sheet, a two-ink print. Same rules as ./index.js (pure HTML
|
|
7
|
+
* strings from the card's seeded random, per-card values as custom properties in `style`, ids under the card's uid,
|
|
8
|
+
* motion in CSS only and only while `is-live`, the still styles the final frame); each look's styles are a block at the
|
|
9
|
+
* end of wall-looks.css.
|
|
10
|
+
*
|
|
11
|
+
* - The two that move (frost, spectral) move by `transform` alone, on layers drawn once: the compositor does the work,
|
|
12
|
+
* so neither is heavy.
|
|
13
|
+
* - editorial and brandsheet are flat boxes, hairlines, the mark and words, so they also download as plain SVG.
|
|
14
|
+
*/
|
|
15
|
+
import { type LookCtx, type LookOut } from './kit.js';
|
|
16
|
+
/**
|
|
17
|
+
* A name's width in ems, set in Instrument Sans 700 tracked −0.05 em (the editorial's name is sized to its measure
|
|
18
|
+
* from this). The Lookbook's script calls it again for a name typed in the toolbar (`data-fit="sans"`).
|
|
19
|
+
*
|
|
20
|
+
* @param name The name.
|
|
21
|
+
*/
|
|
22
|
+
export declare function sansEms(name: string): number;
|
|
23
|
+
/** frost: three soft lights drift slowly behind a pane of frosted glass (a pale tint, a bright rim, fine grain), the
|
|
24
|
+
* mark on the pane in one ink, the name under it. The lights are plain radial fades moved by `transform`. */
|
|
25
|
+
declare function frost(c: LookCtx): LookOut;
|
|
26
|
+
/** spectral: the mark filled with a spectrum that slides slowly through it under film grain, on near-black or paper;
|
|
27
|
+
* nothing else on the card but its name and two small words. The mark is a mask (the glass look's `markUrl`); the
|
|
28
|
+
* spectrum is one wide strip moved by `transform`. */
|
|
29
|
+
declare function spectral(c: LookCtx): LookOut;
|
|
30
|
+
/** editorial: a magazine cover: the mark small in the top corner beside an issue number, a hairline, the tagline in a
|
|
31
|
+
* light weight, and the name huge and tight in a bold grotesque the full measure (sized from its width, `sansEms`), a
|
|
32
|
+
* hairline and two small words at the foot. Flat colour, hairlines and words only. */
|
|
33
|
+
declare function editorial(c: LookCtx): LookOut;
|
|
34
|
+
/** brandsheet: a page from a brand's guidelines on a hairline grid: the name and a version in the header, the mark big
|
|
35
|
+
* in its own cell, then three cells: its minimum sizes, its colours as chips with the accent's hex, and its typeface
|
|
36
|
+
* ("Aa" in the card's face, named). Flat boxes, hairlines and words only. */
|
|
37
|
+
declare function brandsheet(c: LookCtx): LookOut;
|
|
38
|
+
/** overprint: the mark printed twice on uncoated paper in two spot inks: the first solid, the second through a 45°
|
|
39
|
+
* halftone screen and off register, multiplied over the first so a third colour shows in the dots where they cross;
|
|
40
|
+
* paper grain, two registration marks, the inks as swatches. A print-room proof, where the riso look is a photo. */
|
|
41
|
+
declare function overprint(c: LookCtx): LookOut;
|
|
42
|
+
/** The set's looks, by kind. */
|
|
43
|
+
export declare const STUDIO: {
|
|
44
|
+
readonly frost: typeof frost;
|
|
45
|
+
readonly spectral: typeof spectral;
|
|
46
|
+
readonly editorial: typeof editorial;
|
|
47
|
+
readonly brandsheet: typeof brandsheet;
|
|
48
|
+
readonly overprint: typeof overprint;
|
|
49
|
+
};
|
|
50
|
+
/** A studio look's kind. */
|
|
51
|
+
export type StudioKind = keyof typeof STUDIO;
|
|
52
|
+
export {};
|