@logomarks/lookbook 0.0.0-stage → 0.1.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 +29 -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 +106 -0
- package/src/marks.js +178 -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,457 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @logomarks/lookbook/looks/modern
|
|
3
|
+
*
|
|
4
|
+
* The Lookbook's 2027 set of drawn looks (the owner: "ultra modern 2027 / edgy… cool asf"), and his grid fill: diffusion,
|
|
5
|
+
* chrome, puff, datamosh, holo, eink, cloud and gridfill. Same rules as ./index.js (pure HTML strings from the
|
|
6
|
+
* card's seeded random, per-card values as custom properties in `style`, ids under the card's uid, motion in CSS only and
|
|
7
|
+
* only while `is-live`, the still styles the final frame); each look's styles are a block in wall-looks.css.
|
|
8
|
+
*
|
|
9
|
+
* - No WebGL: every look moves by CSS, so the Lookbook's video export steps it frame by frame and it loops without a
|
|
10
|
+
* seam (a WebGL runtime keeps its own clock, which the export can't hold). The costly ones (chrome's liquid filter,
|
|
11
|
+
* the point cloud's thousand dots, puff's lit layers) are marked `data-anim="heavy"`, and the Lookbook runs only two
|
|
12
|
+
* of those at a time (one on a small or low-power screen); the rest show their still until one leaves the screen.
|
|
13
|
+
* - Where a look's picture is expensive (noise, lighting, blur), it's drawn once into its own `<svg>` and only shown,
|
|
14
|
+
* hidden or moved as a whole (opacity and transform, which the compositor does without repainting it).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { escapeHtml } from '@arraypress/text';
|
|
18
|
+
import { hash, rng } from '@arraypress/og-image/palette';
|
|
19
|
+
import { pixelCells, pixelCoverage } from '@logomarks/core/edit';
|
|
20
|
+
import { rings, shapes } from '@logomarks/core/svg';
|
|
21
|
+
import { markBox, markCells } from '../marks.js';
|
|
22
|
+
import { art, around, def, f1, markUrl, meta, mk, nameB, pad2, pickOf, use } from './kit.js';
|
|
23
|
+
|
|
24
|
+
/** The mark's box as a `<rect>`'s attributes, grown by `m`. */
|
|
25
|
+
const boxOf = (paths, m = 0) => {
|
|
26
|
+
const b = markBox(paths);
|
|
27
|
+
return { x: b.x - m, y: b.y - m, w: b.w + 2 * m, h: b.h + 2 * m };
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/* ---------- diffusion: the mark denoised out of colour noise, step by step ---------- */
|
|
31
|
+
|
|
32
|
+
/** The diffusion's steps: how blurred and how warped the mark is under how much noise (the first is noise only, the
|
|
33
|
+
* last the crisp mark), and the step count the readout shows. */
|
|
34
|
+
const DIFFUSE = [
|
|
35
|
+
{ blur: 0, warp: 0, noise: 1, step: 1 },
|
|
36
|
+
{ blur: 34, warp: 130, noise: 0.82, step: 9 },
|
|
37
|
+
{ blur: 17, warp: 74, noise: 0.58, step: 21 },
|
|
38
|
+
{ blur: 8, warp: 34, noise: 0.34, step: 32 },
|
|
39
|
+
{ blur: 2.5, warp: 11, noise: 0.14, step: 43 },
|
|
40
|
+
{ blur: 0, warp: 0, noise: 0, step: 50 },
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
/** diffusion: like an image model at work, the mark emerges from coloured noise in visible denoising steps (a blurred,
|
|
44
|
+
* warped blob, then sharper, then crisp), holds, and dissolves back into noise. Each step is its own `<svg>` with its
|
|
45
|
+
* filter drawn once; the steps are only faded in over each other. */
|
|
46
|
+
function diffusion(c) {
|
|
47
|
+
const pick = pickOf(c);
|
|
48
|
+
const [bg, fg] = pick([
|
|
49
|
+
['#0e0e10', '#f4f3ef'],
|
|
50
|
+
['#0f1012', c.accent],
|
|
51
|
+
['#0d0f14', '#8fd3ff'],
|
|
52
|
+
['#120d10', '#ff8fbd'],
|
|
53
|
+
['#efede7', '#121212'],
|
|
54
|
+
]);
|
|
55
|
+
const seed = 1 + Math.floor(c.r() * 9000);
|
|
56
|
+
const m = 70,
|
|
57
|
+
vb = around(m),
|
|
58
|
+
reg = `filterUnits="userSpaceOnUse" x="${-m}" y="${-m}" width="${512 + 2 * m}" height="${512 + 2 * m}"`;
|
|
59
|
+
const ground = `<rect x="${-m}" y="${-m}" width="${512 + 2 * m}" height="${512 + 2 * m}" fill="${bg}" />`;
|
|
60
|
+
const layers = DIFFUSE.map((s, k) => {
|
|
61
|
+
if (k === DIFFUSE.length - 1) return art(vb, ground + mk(use(c, 'wx-dfmark')), `wx-dfl is-k${k}`);
|
|
62
|
+
const id = `${c.uid}-df${k}`;
|
|
63
|
+
// colour noise (fine grain, alpha made whole, a little extra saturation), the mark blurred and warped by a slow
|
|
64
|
+
// noise on the ground, and the two mixed
|
|
65
|
+
const noise = `<feTurbulence type="fractalNoise" baseFrequency="0.62" numOctaves="1" seed="${seed + k}" result="n0" /><feColorMatrix in="n0" type="matrix" values="1.7 0 0 0 -0.35 0 1.7 0 0 -0.35 0 0 1.7 0 -0.35 0 0 0 0 1" result="nz" />`;
|
|
66
|
+
const shape =
|
|
67
|
+
s.noise < 1
|
|
68
|
+
? `<feGaussianBlur in="SourceGraphic" stdDeviation="${s.blur}" result="mb" /><feTurbulence type="fractalNoise" baseFrequency="0.018" numOctaves="2" seed="${seed + 40 + k}" result="w" /><feDisplacementMap in="mb" in2="w" scale="${s.warp}" xChannelSelector="R" yChannelSelector="G" result="md" /><feFlood flood-color="${bg}" result="g" /><feComposite in="md" in2="g" operator="over" result="img" />`
|
|
69
|
+
: '';
|
|
70
|
+
const mix = s.noise < 1 ? `<feComposite in="img" in2="nz" operator="arithmetic" k2="${f1(1 - s.noise)}" k3="${f1(s.noise)}" />` : '';
|
|
71
|
+
const filter = `<filter id="${id}" ${reg} color-interpolation-filters="sRGB">${noise}${shape}${mix}</filter>`;
|
|
72
|
+
return art(vb, `<defs>${k === 0 ? def(c) : ''}${filter}</defs>${mk(use(c, 'wx-dfmark', ` filter="url(#${id})"`))}`, `wx-dfl is-k${k}`);
|
|
73
|
+
}).join('');
|
|
74
|
+
const roll = DIFFUSE.map((s) => `<i>${pad2(s.step)}</i>`).join('');
|
|
75
|
+
return {
|
|
76
|
+
style: `;--bg:${bg};--fg:${fg}`,
|
|
77
|
+
attrs: '',
|
|
78
|
+
inner:
|
|
79
|
+
layers +
|
|
80
|
+
meta('tl', `Seed ${seed}`) +
|
|
81
|
+
meta('tr', escapeHtml(c.line)) +
|
|
82
|
+
`<span class="wx-dfstep" aria-hidden="true">Step <span class="wx-dfroll"><span>${roll}</span></span>/50</span>` +
|
|
83
|
+
`<span class="wx-dfbar" aria-hidden="true"><i></i></span>` +
|
|
84
|
+
`<span class="wx-foot">${nameB(c)}</span>`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* ---------- chrome: liquid mercury in a studio ---------- */
|
|
89
|
+
|
|
90
|
+
/** The studio the chrome reflects, as a picture (a data: URL, for feImage): soft sky, a white softbox, the horizon's dark
|
|
91
|
+
* line, a warm floor fading to a pale sweep. Warm or cool. */
|
|
92
|
+
function studio(warm) {
|
|
93
|
+
const stops = warm
|
|
94
|
+
? ['#f3ede4', '#ffffff', '#c9bfb0', '#2a241f', '#6b5a4a', '#d8cdbd', '#f7f2ea']
|
|
95
|
+
: ['#e6edf6', '#ffffff', '#a9b3bf', '#1b1f26', '#545c66', '#c8ced6', '#f2f5f8'];
|
|
96
|
+
const at = [0, 0.26, 0.44, 0.5, 0.6, 0.82, 1];
|
|
97
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 100" preserveAspectRatio="none"><linearGradient id="g" x1="0" y1="0" x2="0" y2="1">${stops.map((s, i) => `<stop offset="${at[i]}" stop-color="${s}"/>`).join('')}</linearGradient><rect width="10" height="100" fill="url(#g)"/></svg>`;
|
|
98
|
+
return `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** chrome: the mark as liquid chrome reflecting a studio (no highlight spots: the shine is the studio, bent round its
|
|
102
|
+
* rounded edges). Live, a ripple runs down it in strips (fused into one liquid by a goo threshold), it sags and wobbles,
|
|
103
|
+
* then snaps back into shape. */
|
|
104
|
+
function chrome(c) {
|
|
105
|
+
const pick = pickOf(c);
|
|
106
|
+
const warm = c.r() < 0.4;
|
|
107
|
+
const bg = pick(['#16171a', '#1a1b1f', '#111214']);
|
|
108
|
+
const b = boxOf(c.paths, 30);
|
|
109
|
+
const id = `${c.uid}-lm`;
|
|
110
|
+
const n = 9;
|
|
111
|
+
let strips = '',
|
|
112
|
+
clips = '';
|
|
113
|
+
for (let k = 0; k < n; k++) {
|
|
114
|
+
// (the first and last strips run on off the canvas, so another, taller mark ("try another") isn't cut off)
|
|
115
|
+
const y0 = k === 0 ? -200 : b.y + (b.h * k) / n - 0.5,
|
|
116
|
+
y1 = k === n - 1 ? 712 : b.y + (b.h * (k + 1)) / n + 0.5;
|
|
117
|
+
clips += `<clipPath id="${c.uid}-s${k}"><rect x="-200" y="${f1(y0)}" width="912" height="${f1(y1 - y0)}" /></clipPath>`;
|
|
118
|
+
strips += `<g clip-path="url(#${c.uid}-s${k})">${use(c, 'wx-chs', ` style="--k:${k}"`)}</g>`;
|
|
119
|
+
}
|
|
120
|
+
// goo (blur, threshold) → a height (blurred again) → the studio displaced by it → kept inside the liquid's shape
|
|
121
|
+
const filter =
|
|
122
|
+
// (the region is the 448 fit and what the ripple, the sag and the goo add, 76 units: 600 square, where it was 752,
|
|
123
|
+
// so each frame filters 36% fewer pixels)
|
|
124
|
+
`<filter id="${id}" filterUnits="userSpaceOnUse" x="-44" y="-44" width="600" height="600" color-interpolation-filters="sRGB">` +
|
|
125
|
+
`<feGaussianBlur in="SourceAlpha" stdDeviation="5" result="b" /><feColorMatrix in="b" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20 -9" result="g" />` +
|
|
126
|
+
`<feGaussianBlur in="g" stdDeviation="9" result="h" /><feColorMatrix in="h" type="matrix" values="0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1" result="hm" />` +
|
|
127
|
+
`<feImage href="${studio(warm)}" x="${f1(b.x - 90)}" y="${f1(b.y - 40)}" width="${f1(b.w + 180)}" height="${f1(b.h + 80)}" preserveAspectRatio="none" result="env" />` +
|
|
128
|
+
`<feDisplacementMap in="env" in2="hm" scale="-150" xChannelSelector="R" yChannelSelector="G" result="r" />` +
|
|
129
|
+
`<feComposite in="r" in2="g" operator="in" result="m" />` +
|
|
130
|
+
`<feMorphology in="g" operator="erode" radius="1.6" result="e" /><feComposite in="g" in2="e" operator="out" result="rim" />` +
|
|
131
|
+
`<feFlood flood-color="#0b0c0e" flood-opacity="0.55" /><feComposite in2="rim" operator="in" result="rimc" />` +
|
|
132
|
+
`<feMerge><feMergeNode in="m" /><feMergeNode in="rimc" /></feMerge></filter>`;
|
|
133
|
+
return {
|
|
134
|
+
style: `;--bg:${bg}`,
|
|
135
|
+
attrs: ' data-anim="heavy"',
|
|
136
|
+
inner:
|
|
137
|
+
art(around(70), `<defs>${def(c)}${clips}${filter}</defs>${mk(`<g class="wx-chliq" filter="url(#${id})">${strips}</g>`)}`) +
|
|
138
|
+
meta('tl', 'Liquid metal') +
|
|
139
|
+
meta('tr', escapeHtml(c.line)) +
|
|
140
|
+
`<span class="wx-foot">${nameB(c)}</span>`,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* ---------- puff: an inflated vinyl mark ---------- */
|
|
145
|
+
|
|
146
|
+
/** Pastel grounds and their vinyl. */
|
|
147
|
+
const PASTELS = [
|
|
148
|
+
['#f7d9e3', '#ff6f9f'],
|
|
149
|
+
['#dbeafe', '#4f8dff'],
|
|
150
|
+
['#dff3d6', '#43b964'],
|
|
151
|
+
['#fff0c4', '#ffab2e'],
|
|
152
|
+
['#e8e0ff', '#8d6bff'],
|
|
153
|
+
['#ffe1d3', '#ff7a45'],
|
|
154
|
+
['#d6f4f1', '#1fb5a5'],
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
/** One stage of the inflation: the mark's outline rounded (a goo of radius `round`), its height a blur of `blur`, lit by
|
|
158
|
+
* one soft light above left (matte: diffuse, and a broad, faint sheen); 0 is flat. */
|
|
159
|
+
function puffFilter(id, blur, round) {
|
|
160
|
+
const shape = `<feGaussianBlur in="SourceAlpha" stdDeviation="${round}" result="b0" /><feColorMatrix in="b0" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 -8.4" result="a" />`;
|
|
161
|
+
if (!blur)
|
|
162
|
+
return `<filter id="${id}" filterUnits="userSpaceOnUse" x="-80" y="-80" width="672" height="672">${shape}<feComposite in="SourceGraphic" in2="a" operator="in" /></filter>`;
|
|
163
|
+
return (
|
|
164
|
+
`<filter id="${id}" filterUnits="userSpaceOnUse" x="-80" y="-80" width="672" height="672" color-interpolation-filters="sRGB">${shape}` +
|
|
165
|
+
`<feGaussianBlur in="a" stdDeviation="${blur}" result="h" />` +
|
|
166
|
+
`<feDiffuseLighting in="h" surfaceScale="${f1(blur * 1.6)}" diffuseConstant="1.05" lighting-color="#fff" result="d"><feDistantLight azimuth="235" elevation="52" /></feDiffuseLighting>` +
|
|
167
|
+
`<feSpecularLighting in="h" surfaceScale="${f1(blur * 1.6)}" specularConstant="0.45" specularExponent="9" lighting-color="#fff" result="s"><feDistantLight azimuth="235" elevation="62" /></feSpecularLighting>` +
|
|
168
|
+
`<feComposite in="SourceGraphic" in2="d" operator="arithmetic" k1="1.12" k4="0.02" result="lit" />` +
|
|
169
|
+
`<feComposite in="s" in2="a" operator="in" result="s2" /><feComposite in="lit" in2="a" operator="in" result="l2" />` +
|
|
170
|
+
`<feComposite in="s2" in2="l2" operator="arithmetic" k2="0.5" k3="1" /></filter>`
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** puff: the mark as soft inflated vinyl on a pastel ground: it blows up from flat with a real bulge (lit height from a
|
|
175
|
+
* blurred outline), wobbles and settles, holds, and lets its air out. Each stage is its own lit `<svg>`, drawn once; the
|
|
176
|
+
* inflation is them fading over each other, the wobble a transform on their wrapper. */
|
|
177
|
+
function puff(c) {
|
|
178
|
+
const pick = pickOf(c);
|
|
179
|
+
const [bg, ink] = pick(PASTELS);
|
|
180
|
+
const stages = [
|
|
181
|
+
[0, 3],
|
|
182
|
+
[7, 6],
|
|
183
|
+
[14, 9],
|
|
184
|
+
];
|
|
185
|
+
const vb = around(80);
|
|
186
|
+
const layers = stages
|
|
187
|
+
.map(([blur, round], k) => {
|
|
188
|
+
const id = `${c.uid}-pf${k}`;
|
|
189
|
+
return art(
|
|
190
|
+
vb,
|
|
191
|
+
`<defs>${k === 0 ? def(c) : ''}${puffFilter(id, blur, round)}</defs>${mk(use(c, 'wx-pfill', ` filter="url(#${id})"`))}`,
|
|
192
|
+
`wx-pfl is-k${k}`,
|
|
193
|
+
);
|
|
194
|
+
})
|
|
195
|
+
.join('');
|
|
196
|
+
return {
|
|
197
|
+
style: `;--bg:${bg};--ink:${ink}`,
|
|
198
|
+
attrs: ' data-anim="heavy"',
|
|
199
|
+
inner:
|
|
200
|
+
`<span class="wx-puff">${layers}</span>` +
|
|
201
|
+
meta('tl', `Vinyl · ${pick(['Soft', 'Matte', 'Puff'])} ${pad2(1 + Math.floor(c.r() * 40))}`) +
|
|
202
|
+
meta('tr', escapeHtml(c.line)) +
|
|
203
|
+
`<span class="wx-foot">${nameB(c)}</span>`,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* ---------- datamosh: a broken video frame ---------- */
|
|
208
|
+
|
|
209
|
+
/** datamosh: the mark as a video frame that breaks: macroblocks show it from the wrong place and drag (their motion
|
|
210
|
+
* vectors applied again and again), some smear into streaks, bands of the frame slip sideways, the colour channels part;
|
|
211
|
+
* then a clean keyframe snaps it whole, and a small aftershock. All stepped, as a codec would. */
|
|
212
|
+
function datamosh(c) {
|
|
213
|
+
const pick = pickOf(c);
|
|
214
|
+
const ink = pick(['#ffffff', '#ffffff', c.inks[2], c.inks[6]]);
|
|
215
|
+
const b = markBox(c.paths);
|
|
216
|
+
const q = 32;
|
|
217
|
+
let blocks = '',
|
|
218
|
+
clips = '';
|
|
219
|
+
const nb = 16 + Math.floor(c.r() * 6);
|
|
220
|
+
for (let k = 0; k < nb; k++) {
|
|
221
|
+
const s = q * (c.r() < 0.6 ? 1 : 2),
|
|
222
|
+
w = c.r() < 0.3 ? s * 3 : s;
|
|
223
|
+
const x = Math.floor((b.x + c.r() * (b.w - w)) / q) * q,
|
|
224
|
+
y = Math.floor((b.y + c.r() * (b.h - s)) / q) * q;
|
|
225
|
+
const smear = c.r() < 0.4;
|
|
226
|
+
const dx = smear ? 0 : Math.round((c.r() - 0.5) * 6) * 8,
|
|
227
|
+
dy = smear ? 0 : Math.round(c.r() * 5 + 1) * 8;
|
|
228
|
+
const ox = Math.round((c.r() - 0.5) * 4) * q,
|
|
229
|
+
oy = Math.round((c.r() - 0.5) * 4) * q;
|
|
230
|
+
clips += `<clipPath id="${c.uid}-b${k}"><rect x="${x}" y="${y}" width="${w}" height="${s}" /></clipPath>`;
|
|
231
|
+
const vars = `--d:${(k * 0.045).toFixed(2)}s;--ox:${ox};--oy:${oy};--dx:${dx};--dy:${dy};--sy:${smear ? (3 + c.r() * 5).toFixed(1) : 1};--cx:${x};--cy:${y}`;
|
|
232
|
+
blocks += `<g clip-path="url(#${c.uid}-b${k})"><rect class="wx-dmbg" x="${x}" y="${y}" width="${w}" height="${s}" /><g class="wx-dmblk${smear ? ' is-smear' : ''}" style="${vars}">${use(c, 'wx-dmmark')}</g></g>`;
|
|
233
|
+
}
|
|
234
|
+
// three bands of the frame that slip sideways
|
|
235
|
+
let bands = '';
|
|
236
|
+
for (let k = 0; k < 3; k++) {
|
|
237
|
+
const y = b.y + c.r() * b.h * 0.85,
|
|
238
|
+
h = 10 + c.r() * 40;
|
|
239
|
+
clips += `<clipPath id="${c.uid}-h${k}"><rect x="-200" y="${f1(y)}" width="912" height="${f1(h)}" /></clipPath>`;
|
|
240
|
+
bands += `<g clip-path="url(#${c.uid}-h${k})"><rect class="wx-dmbg" x="-200" y="${f1(y)}" width="912" height="${f1(h)}" /><g class="wx-dmband" style="--k:${k};--bx:${Math.round((c.r() - 0.5) * 120)}">${use(c, 'wx-dmmark')}</g></g>`;
|
|
241
|
+
}
|
|
242
|
+
const frame = 100 + Math.floor(c.r() * 800);
|
|
243
|
+
return {
|
|
244
|
+
style: `;--ink:${ink}`,
|
|
245
|
+
attrs: '',
|
|
246
|
+
inner:
|
|
247
|
+
art(
|
|
248
|
+
around(60),
|
|
249
|
+
`<defs>${def(c)}${clips}</defs>${mk(`<g class="wx-dmrgb">${use(c, 'wx-dmr')}${use(c, 'wx-dmb')}</g>${use(c, 'wx-dmmark')}<g class="wx-dmglitch">${blocks}${bands}</g>`)}`,
|
|
250
|
+
) +
|
|
251
|
+
meta('tl', 'H.264 · 24 fps') +
|
|
252
|
+
meta('tr', escapeHtml(c.line)) +
|
|
253
|
+
`<span class="wx-meta is-br wx-dmframe"><span class="is-p">P-frame ${frame}</span><span class="is-i">I-frame ${frame + 1}</span></span>` +
|
|
254
|
+
`<span class="wx-foot">${nameB(c)}</span>`,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* ---------- holo: an iridescent foil card ---------- */
|
|
259
|
+
|
|
260
|
+
/** holo: a premium trading card: the mark in holographic foil (a thin-film rainbow under fine diffraction lines) on a
|
|
261
|
+
* dark card with a thin frame, a serial number and a turning seal. Live, the foil sweeps; on the wall it also follows
|
|
262
|
+
* the pointer (`holoPointer` in ../live.js sets --hx and --hy on the card). */
|
|
263
|
+
function holo(c) {
|
|
264
|
+
const pick = pickOf(c);
|
|
265
|
+
const bg = pick(['#0b0b10', '#0d0c12', '#08090c']);
|
|
266
|
+
const no = 1 + Math.floor(c.r() * 249);
|
|
267
|
+
return {
|
|
268
|
+
style: `;--bg:${bg};--m:${markUrl(c.paths, '#fff')};--hh:${Math.floor(c.r() * 360)}deg`,
|
|
269
|
+
attrs: '',
|
|
270
|
+
inner:
|
|
271
|
+
`<svg class="wx-def" aria-hidden="true"><defs>${def(c)}</defs></svg>` +
|
|
272
|
+
`<span class="wx-hframe" aria-hidden="true"></span>` +
|
|
273
|
+
`<span class="wx-holo" data-ink="#fff" aria-hidden="true"><i class="wx-hbase"></i><i class="wx-hfoil"></i><i class="wx-hsheen"></i></span>` +
|
|
274
|
+
meta('tl', `Holo · No. ${String(no).padStart(3, '0')}/250`) +
|
|
275
|
+
meta('tr', escapeHtml(c.line)) +
|
|
276
|
+
`<span class="wx-hseal" aria-hidden="true"></span>` +
|
|
277
|
+
`<span class="wx-foot">${nameB(c)}</span>`,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* ---------- eink: an e-paper screen refreshing ---------- */
|
|
282
|
+
|
|
283
|
+
/** eink: the mark on an e-paper screen, paper grey, a faint ghost of the last page under it. Live, it refreshes: black,
|
|
284
|
+
* the mark inverted, white, black again, then the mark paints in band by band, grey before black, the ghost stronger
|
|
285
|
+
* for a moment; a status line with a battery says "Refreshing…" meanwhile. */
|
|
286
|
+
function eink(c) {
|
|
287
|
+
const pick = pickOf(c);
|
|
288
|
+
const paper = pick(['#e7e5de', '#e4e3df', '#eae7e0']);
|
|
289
|
+
const b = boxOf(c.paths, 4);
|
|
290
|
+
let bands = '',
|
|
291
|
+
clips = '';
|
|
292
|
+
for (let k = 0; k < 4; k++) {
|
|
293
|
+
// (the first and last bands run on off the canvas, so another, taller mark ("try another") isn't cut off)
|
|
294
|
+
const y0 = k === 0 ? -100 : b.y + (b.h * k) / 4 - 0.5,
|
|
295
|
+
y1 = k === 3 ? 612 : b.y + (b.h * (k + 1)) / 4 + 0.5;
|
|
296
|
+
clips += `<clipPath id="${c.uid}-e${k}"><rect x="-100" y="${f1(y0)}" width="712" height="${f1(y1 - y0)}" /></clipPath>`;
|
|
297
|
+
bands += `<g clip-path="url(#${c.uid}-e${k})">${use(c, `wx-eband is-b${k}`)}</g>`;
|
|
298
|
+
}
|
|
299
|
+
const bat = 40 + Math.floor(c.r() * 58);
|
|
300
|
+
const hh = 7 + Math.floor(c.r() * 4),
|
|
301
|
+
mm = Math.floor(c.r() * 60);
|
|
302
|
+
const time = `${pad2(hh)}:${pad2(mm)}`;
|
|
303
|
+
const gx = Math.round((c.r() - 0.5) * 60),
|
|
304
|
+
gy = Math.round((c.r() - 0.5) * 40);
|
|
305
|
+
return {
|
|
306
|
+
style: `;--bg:${paper}`,
|
|
307
|
+
attrs: '',
|
|
308
|
+
inner:
|
|
309
|
+
art(around(70), `<defs>${def(c)}${clips}</defs>${mk(`${use(c, 'wx-eghost', ` style="--gx:${gx};--gy:${gy}"`)}${bands}`)}`) +
|
|
310
|
+
`<span class="wx-eflash" aria-hidden="true"></span>` +
|
|
311
|
+
art(around(70), mk(use(c, 'wx-einv')), 'wx-einvart') +
|
|
312
|
+
`<span class="wx-meta is-tl wx-ebat"><i style="--bat:${bat}%"></i>${bat}%</span>` +
|
|
313
|
+
`<span class="wx-meta is-tr wx-estat"><span class="is-ok">Updated ${time}</span><span class="is-busy">Refreshing…</span></span>` +
|
|
314
|
+
`<span class="wx-foot">${nameB(c)}</span>`,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* ---------- cloud: a point cloud that swarms into the mark ---------- */
|
|
319
|
+
|
|
320
|
+
/** The cloud's dots: the mark's cells, `n` across, one or two dots each, jittered, dealt into `groups` (each a path of
|
|
321
|
+
* round dots in relative moves, small in the page), and a sprinkling of stray dots round it. */
|
|
322
|
+
export function cloudArt(paths, seed, n = 46, groups = 10) {
|
|
323
|
+
const r = rng(seed);
|
|
324
|
+
const { grid, on } = markCells(paths, n);
|
|
325
|
+
const { cols, cell, x0, y0 } = grid;
|
|
326
|
+
const pts = Array.from({ length: groups }, () => []);
|
|
327
|
+
let count = 0;
|
|
328
|
+
on.forEach((v, i) => {
|
|
329
|
+
if (!v) return;
|
|
330
|
+
const q = i % cols,
|
|
331
|
+
j = Math.floor(i / cols);
|
|
332
|
+
for (let t = r() < 0.55 ? 2 : 1; t > 0; t--) {
|
|
333
|
+
pts[Math.floor(r() * groups)].push([Math.round(x0 + (q + r()) * cell), Math.round(y0 + (j + r()) * cell)]);
|
|
334
|
+
count++;
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
const d = (list) => {
|
|
338
|
+
let s = '',
|
|
339
|
+
px = 0,
|
|
340
|
+
py = 0;
|
|
341
|
+
for (const [x, y] of list) {
|
|
342
|
+
s += `${s ? 'm' : 'M'}${x - px} ${y - py}h0`;
|
|
343
|
+
px = x;
|
|
344
|
+
py = y;
|
|
345
|
+
}
|
|
346
|
+
return s;
|
|
347
|
+
};
|
|
348
|
+
const svg = pts
|
|
349
|
+
.map((list, k) => {
|
|
350
|
+
const a = Math.round((r() - 0.5) * 240),
|
|
351
|
+
s = (1.6 + r() * 1.6).toFixed(2),
|
|
352
|
+
tx = Math.round((r() - 0.5) * 300),
|
|
353
|
+
ty = Math.round((r() - 0.5) * 300);
|
|
354
|
+
return list.length
|
|
355
|
+
? `<path class="wx-cldots" style="--a:${a}deg;--s:${s};--tx:${tx}px;--ty:${ty}px;--d:${(k * 0.05).toFixed(2)}s" d="${d(list)}" />`
|
|
356
|
+
: '';
|
|
357
|
+
})
|
|
358
|
+
.join('');
|
|
359
|
+
const stray = Array.from({ length: 90 }, () => [Math.round(-60 + r() * 632), Math.round(-60 + r() * 632)]);
|
|
360
|
+
return { svg: `<g class="wx-clstray"><path d="${d(stray)}" /></g>${svg}`, count };
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** cloud: the mark as a point cloud: about a thousand dots swarm in from scattered, spinning clouds and lock into it,
|
|
364
|
+
* breathe, then scatter again. */
|
|
365
|
+
function cloud(c) {
|
|
366
|
+
const pick = pickOf(c);
|
|
367
|
+
const ink = pick(['#ffffff', '#8fd3ff', c.inks[2], '#ffd23f', '#b9a8ff']);
|
|
368
|
+
const cl = cloudArt(c.paths, Math.floor(c.r() * 1e9));
|
|
369
|
+
return {
|
|
370
|
+
style: `;--ink:${ink}`,
|
|
371
|
+
attrs: ' data-anim="heavy"',
|
|
372
|
+
inner:
|
|
373
|
+
`<svg class="wx-def" aria-hidden="true"><defs>${def(c)}</defs></svg>` +
|
|
374
|
+
art(around(70), mk(cl.svg), 'wx-clart', ' data-px="cloud"') +
|
|
375
|
+
`<span class="wx-meta is-tl" data-pxcount>Points ${cl.count.toLocaleString('en-GB')}</span>` +
|
|
376
|
+
meta('tr', escapeHtml(c.line)) +
|
|
377
|
+
`<span class="wx-foot">${nameB(c)}</span>`,
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/* ---------- gridfill: the home page's grid, filled in block by block ---------- */
|
|
382
|
+
|
|
383
|
+
/** The grid fill's grid: 16 squares across the 512 canvas with 32 units round it, the home page's hairlines, and the
|
|
384
|
+
* mark's cells (core's coverage and cells at the grid's own resolution, so each sits exactly in a square), each with
|
|
385
|
+
* the moment it fills: a scattered order or a diagonal sweep. */
|
|
386
|
+
export function gridArt(paths, seed) {
|
|
387
|
+
const r = rng(seed);
|
|
388
|
+
const n = 16,
|
|
389
|
+
m = 32,
|
|
390
|
+
cell = (512 + 2 * m) / n;
|
|
391
|
+
const grid = { cols: n, rows: n, cell, x0: -m, y0: -m };
|
|
392
|
+
const list = shapes(paths);
|
|
393
|
+
const cov = list.length
|
|
394
|
+
? pixelCoverage(
|
|
395
|
+
list.map((s) => ({ rings: rings(s.segs), evenodd: s.evenodd })),
|
|
396
|
+
grid,
|
|
397
|
+
)
|
|
398
|
+
: new Float32Array(n * n);
|
|
399
|
+
const on = pixelCells(cov, grid);
|
|
400
|
+
const idx = [];
|
|
401
|
+
on.forEach((v, i) => v && idx.push(i));
|
|
402
|
+
const sweep = r() < 0.5;
|
|
403
|
+
const key = new Map(idx.map((i) => [i, sweep ? (i % n) + Math.floor(i / n) + r() * 1.5 : r()]));
|
|
404
|
+
idx.sort((a, b) => key.get(a) - key.get(b));
|
|
405
|
+
const span = 2;
|
|
406
|
+
const cells = idx
|
|
407
|
+
.map(
|
|
408
|
+
(i, k) =>
|
|
409
|
+
`<rect x="${f1(-m + (i % n) * cell)}" y="${f1(-m + Math.floor(i / n) * cell)}" width="${f1(cell)}" height="${f1(cell)}" style="--d:${((k / Math.max(1, idx.length)) * span).toFixed(2)}s" />`,
|
|
410
|
+
)
|
|
411
|
+
.join('');
|
|
412
|
+
let lines = '';
|
|
413
|
+
for (let k = 0; k <= n; k++) lines += `M${f1(-m + k * cell)} ${-m}V${512 + m}M${-m} ${f1(-m + k * cell)}H${512 + m}`;
|
|
414
|
+
return { svg: `<g class="wx-gfcells">${cells}</g><path class="wx-gflines" d="${lines}" />`, n };
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/** gridfill: the home page's grid (its hairlines and border colour, on the site's ground), its squares filling in with
|
|
418
|
+
* solid ink one by one, scattered or in a diagonal sweep, until the mark stands in blocks; a hold, then they clear in the
|
|
419
|
+
* same order. The name under it in the site's face. Monochrome and Swiss, where the pixel mosaic is neon. */
|
|
420
|
+
function gridfill(c) {
|
|
421
|
+
const light = c.r() < 0.5;
|
|
422
|
+
const pick = pickOf(c);
|
|
423
|
+
const ink = light ? '#171717' : pick([c.accent, '#ededed']);
|
|
424
|
+
const g = gridArt(c.paths, Math.floor(c.r() * 1e9));
|
|
425
|
+
return {
|
|
426
|
+
style: `;--bg:${light ? '#ffffff' : '#000000'};--line:${light ? '#eaeaea' : '#262626'};--ink:${ink};--fg:${light ? '#171717' : '#ededed'}`,
|
|
427
|
+
attrs: '',
|
|
428
|
+
inner:
|
|
429
|
+
`<svg class="wx-def" aria-hidden="true"><defs>${def(c)}</defs></svg>` +
|
|
430
|
+
art(around(32), g.svg, 'wx-gfart', ' data-px="grid"') +
|
|
431
|
+
meta('tl', `Grid ${g.n} × ${g.n}`) +
|
|
432
|
+
meta('tr', escapeHtml(c.line)) +
|
|
433
|
+
`<span class="wx-foot"><b class="wc-name wx-gfname">${escapeHtml(c.name)}</b></span>`,
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/** The set's looks, by kind. */
|
|
438
|
+
export const MODERN = { diffusion, chrome, puff, datamosh, holo, eink, cloud, gridfill };
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Redraws what a modern look built from the mark itself (the expanded view's "try another mark"); the `<use>` copies
|
|
442
|
+
* follow the mark's one copy on their own.
|
|
443
|
+
*
|
|
444
|
+
* @param el The card.
|
|
445
|
+
* @param paths The new mark's paths' markup.
|
|
446
|
+
*/
|
|
447
|
+
export function retargetModern(el, paths) {
|
|
448
|
+
const px = el.querySelector('[data-px]');
|
|
449
|
+
const seed = hash(paths.slice(0, 64));
|
|
450
|
+
const mkg = px?.querySelector('.wx-mk');
|
|
451
|
+
if (px?.dataset.px === 'cloud' && mkg) {
|
|
452
|
+
const cl = cloudArt(paths, seed + 37);
|
|
453
|
+
mkg.innerHTML = cl.svg;
|
|
454
|
+
const t = el.querySelector('[data-pxcount]');
|
|
455
|
+
if (t) t.textContent = `Points ${cl.count.toLocaleString('en-GB')}`;
|
|
456
|
+
} else if (px?.dataset.px === 'grid') px.innerHTML = gridArt(paths, seed + 41).svg;
|
|
457
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
import { type LookCtx, type LookOut } from './kit.js';
|
|
19
|
+
/** Up to `n` points on the mark's outline (its edge cells' centres, `cells` across), spread round it by angle. */
|
|
20
|
+
export declare function edgePoints(paths: string, n: number, cells?: number): [number, number][];
|
|
21
|
+
/** Up to `n` drip starts: the lowest filled cell of some of the mark's columns (seeded by the mark, so a retarget
|
|
22
|
+
* draws the same drips the card would). Each with a length. */
|
|
23
|
+
export declare function dripPoints(
|
|
24
|
+
paths: string,
|
|
25
|
+
n: number,
|
|
26
|
+
): {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
len: number;
|
|
30
|
+
w: number;
|
|
31
|
+
}[];
|
|
32
|
+
/** The laser's beams: from the source to points on the mark's outline. */
|
|
33
|
+
export declare function laserBeams(paths: string): string;
|
|
34
|
+
/** laser: dark haze, beams fanning up from one point at the foot of the card; they sweep in, the mark's outline traces
|
|
35
|
+
* itself in laser light, the beams pulse on it, then sweep off. */
|
|
36
|
+
declare function laser(c: LookCtx): LookOut;
|
|
37
|
+
/** orbittext: the name and tagline round a ring that turns slowly about the mark, between two hairline circles. */
|
|
38
|
+
declare function orbittext(c: LookCtx): LookOut;
|
|
39
|
+
/** sunshadow: a warm plaster wall, the mark a patch of low sunlight on it (soft-edged, skewed as light through a window
|
|
40
|
+
* falls), palm leaves' shadows swaying over the wall and the light. */
|
|
41
|
+
declare function sunshadow(c: LookCtx): LookOut;
|
|
42
|
+
/** patch: a round twill patch with a merrowed edge, the mark satin-stitched on it (fine slanted thread lines, a raised
|
|
43
|
+
* shadow), on denim or canvas. */
|
|
44
|
+
declare function patch(c: LookCtx): LookOut;
|
|
45
|
+
/** slitscan: the mark cut into thin horizontal strips, each smeared sideways by its own amount (a long streak), which
|
|
46
|
+
* snap back into the mark one after another, hold, and smear off again. */
|
|
47
|
+
declare function slitscan(c: LookCtx): LookOut;
|
|
48
|
+
/** Frames in one turn, columns across, and the slab's depth as a share of the mark's longest side. */
|
|
49
|
+
export declare const ASCII3D: {
|
|
50
|
+
readonly frames: 36;
|
|
51
|
+
readonly cols: 36;
|
|
52
|
+
readonly depth: 0.2;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The mark extruded into a slab and turned once round its upright axis, as `frames` frames of ASCII art. The slab's
|
|
56
|
+
* faces and side walls are sampled as points (the mark's cells, `on` from core's coverage); each frame turns them,
|
|
57
|
+
* keeps the nearest point a character cell (a depth buffer), and picks its character by how squarely it faces a
|
|
58
|
+
* light up and to the left. A character is about twice as tall as wide, so a row is two columns' height.
|
|
59
|
+
*
|
|
60
|
+
* @param paths The mark's paths' markup.
|
|
61
|
+
* @returns The frames (rows of text) and the grid's size.
|
|
62
|
+
*/
|
|
63
|
+
export declare function ascii3d(paths: string): {
|
|
64
|
+
frames: string[][];
|
|
65
|
+
cols: number;
|
|
66
|
+
rows: number;
|
|
67
|
+
};
|
|
68
|
+
/** The frames as markup: one block each, stacked, the CSS showing one at a time (each delayed by its place in the turn). */
|
|
69
|
+
export declare const ascii3dArt: (frames: string[][]) => string;
|
|
70
|
+
/** 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
|
|
71
|
+
* name at a prompt under it. */
|
|
72
|
+
declare function ascii(c: LookCtx): LookOut;
|
|
73
|
+
/** The stencil's drips as markup. */
|
|
74
|
+
export declare const dripArt: (paths: string) => string;
|
|
75
|
+
/** stencil: the mark sprayed through a stencil onto concrete: a soft halo of overspray, speckled edges, three drips;
|
|
76
|
+
* the name sprayed under it. */
|
|
77
|
+
declare function stencil(c: LookCtx): LookOut;
|
|
78
|
+
/** acrylic: the mark cut from frosted acrylic, standing off a dark wall and lit from behind: a wide halo of its light on
|
|
79
|
+
* the wall, a bright polished edge, the face frosted white. */
|
|
80
|
+
declare function acrylic(c: LookCtx): LookOut;
|
|
81
|
+
/** The street set's builders, by kind. */
|
|
82
|
+
export declare const STREET: {
|
|
83
|
+
readonly laser: typeof laser;
|
|
84
|
+
readonly orbittext: typeof orbittext;
|
|
85
|
+
readonly sunshadow: typeof sunshadow;
|
|
86
|
+
readonly patch: typeof patch;
|
|
87
|
+
readonly slitscan: typeof slitscan;
|
|
88
|
+
readonly ascii: typeof ascii;
|
|
89
|
+
readonly stencil: typeof stencil;
|
|
90
|
+
readonly acrylic: typeof acrylic;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Another mark on a street card (the expanded view's "try another"): the laser's beams, the ASCII rows and the drips
|
|
94
|
+
* are drawn from the mark, so they're redrawn for the new one; the rest only use the mark's one copy.
|
|
95
|
+
*
|
|
96
|
+
* @param el The card.
|
|
97
|
+
* @param paths The new mark's paths' markup.
|
|
98
|
+
*/
|
|
99
|
+
export declare function retargetStreet(el: HTMLElement, paths: string): void;
|
|
100
|
+
export {};
|