@logomarks/lookbook 0.2.0 → 0.3.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 +23 -0
- package/README.md +2 -2
- package/package.json +2 -2
- package/src/fields.d.ts +39 -0
- package/src/fields.js +306 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/live.js +65 -3
- package/src/styles/wall.css +8 -8
- package/src/wall.d.ts +5 -3
- package/src/wall.js +21 -75
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,29 @@ All notable changes to `@logomarks/lookbook` are documented here.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.0] — 2026-11-20
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Six more field cards**, each a live background from @arraypress/effects-astro 0.11 behind the lockup, its middle kept
|
|
13
|
+
quiet, six colourways each from the house palette, off unless a wall gives it a weight (`lookbook({ weights })`):
|
|
14
|
+
`lightleak` (a soft drifting colour field), `dither` (dithered dots, ripples from a corner), `cascade` (a hex or dot
|
|
15
|
+
spectrogram), `flowfield` (fine trails on a flow, Canvas 2D), `voronoi` (thin nested cell lines) and `kinetic` (a wire
|
|
16
|
+
grid that raindrops ripple). After Processing sketches shared with the owner.
|
|
17
|
+
- **`FIELDS`, `isField`** (`./fields.js`): the field cards in one table, each its effect, label and deal (settings,
|
|
18
|
+
ground, ink, still). `KIND_LABEL`, `RATIO` and `WEIGHTS` are built from it; `wall.js` has one branch for them all.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- ASCII noise moved into the field table (its cards are the same apart from the order of their settings). Field cards
|
|
23
|
+
carry `wc-field` (the shared CSS: ground, ink, the canvas fading in over the still); `.wc-asciinoise` rules are now
|
|
24
|
+
`.wc-field`'s.
|
|
25
|
+
- `/live` loads each field's effect when a card first needs it, in its own chunk.
|
|
26
|
+
|
|
27
|
+
### Dependencies
|
|
28
|
+
|
|
29
|
+
- `@arraypress/effects-astro` ^0.11.0.
|
|
30
|
+
|
|
8
31
|
## [0.2.0] — 2026-11-20
|
|
9
32
|
|
|
10
33
|
### Added
|
package/README.md
CHANGED
|
@@ -37,10 +37,10 @@ holoPointer();
|
|
|
37
37
|
|
|
38
38
|
## What's in it
|
|
39
39
|
|
|
40
|
-
- `@logomarks/lookbook`: `lookbook({ brand, faces, accent?, palettes?, weights?, href?, skip? })` gives `card`, `feed` and `backgrounds` (`weights: { asciinoise: 1 }` deals
|
|
40
|
+
- `@logomarks/lookbook`: `lookbook({ brand, faces, accent?, palettes?, weights?, href?, skip? })` gives `card`, `feed` and `backgrounds` (`weights: { asciinoise: 1 }` deals a field card, which is otherwise off: `FIELDS` lists them, live effects-astro backgrounds such as ASCII noise, light leak, dither, cascade grid, flow field, Voronoi mesh and kinetic grid); `shuffled`; the promo cards `headlineCard`, `sponsorCard`, `openSlotCard`; `WEIGHTS`, `KIND_LABEL`, `EVERY`, `ACCENT` (`#C8FF00`) and the look tables.
|
|
41
41
|
- `@logomarks/lookbook/looks`: the drawn looks, `LOOK_KINDS`, `LOOK_LABEL`, `LOOK_LOOP` (each moving look's loop, for a video), `LOOK_RATIO`, `LOOK_WEIGHTS`, `retarget` (another mark on a card) and `refit`.
|
|
42
42
|
- `@logomarks/lookbook/marks`: a mark's box, ink share, optical size (`opticalVars`), cells and heat field; the box, ink, size and cells are `@logomarks/core`'s, re-exported.
|
|
43
|
-
- `@logomarks/lookbook/live`: `liveCards`, `shaders` (Paper's shaders and the
|
|
43
|
+
- `@logomarks/lookbook/live`: `liveCards`, `shaders` (Paper's shaders and the field cards' effects, each loaded when first needed), `smoke` with its presets `SMOKE`, and `holoPointer`.
|
|
44
44
|
- `wall.css` and `wall-looks.css`: the cards and the drawn looks. They read the page's theme tokens (`--text`, `--muted`, `--border`, `--surface`, `--display`, `--mono`) and the accent `--hi`.
|
|
45
45
|
|
|
46
46
|
The pictures go by their file names: `club-N` the club hall, `club-dancer-N` and `club-crowd-N` its people, portraits (`modern`, `y2k` …) and the rest in `photos`; flowers (`bloom-N`, `dahlia-N`, `iris-N`, `lily-N`, `marigold-N`, `palm-N`) and abstracts in `glass`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logomarks/lookbook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A logomark dressed as a made-up brand, in sixty-odd looks: on a photo, glass, a colour, paper or a live gradient, or the mark itself redrawn (traced, constructed, reeded, pixelated, neon, split-flap, contoured, thermal, liquid chrome, holo foil, ASCII, embroidered, frosted, editorial and more). Pure functions returning HTML, the same on the server and in the browser, with their CSS (motion in CSS only, a still final frame, a Plain mode), an optical size for wide, slim or light marks, and a browser runner that starts only what's near the screen.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"registry": "https://registry.npmjs.org/"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@arraypress/effects-astro": "^0.
|
|
78
|
+
"@arraypress/effects-astro": "^0.11.0",
|
|
79
79
|
"@arraypress/og-image": "^1.5.1",
|
|
80
80
|
"@arraypress/text": "^2.2.0",
|
|
81
81
|
"@logomarks/core": "^0.2.1"
|
package/src/fields.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @logomarks/lookbook/fields
|
|
3
|
+
*
|
|
4
|
+
* The field cards: a live background drawn by one of @arraypress/effects-astro's fields, started on screen like a shader
|
|
5
|
+
* card, the lockup over a quiet middle.
|
|
6
|
+
*/
|
|
7
|
+
import type { Face } from './wall.js';
|
|
8
|
+
|
|
9
|
+
/** The field cards' kinds. */
|
|
10
|
+
export type FieldKind = 'asciinoise' | 'lightleak' | 'cascade' | 'flowfield' | 'voronoi' | 'dither' | 'kinetic';
|
|
11
|
+
|
|
12
|
+
/** What a field card is dealt from: the card's seeded pick and random, the accent, and the wall's monospaced face. */
|
|
13
|
+
export type FieldDeal = {
|
|
14
|
+
pick: <T>(xs: readonly T[]) => T;
|
|
15
|
+
r: () => number;
|
|
16
|
+
accent: string;
|
|
17
|
+
mono: Face | undefined;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** A dealt field card: the effect's settings, the card's ground and ink, its still (a CSS background, or markup laid
|
|
21
|
+
* under the canvas), and whether its name is set in the monospaced face. */
|
|
22
|
+
export type FieldCard = {
|
|
23
|
+
cfg: Record<string, unknown>;
|
|
24
|
+
ground: string;
|
|
25
|
+
ink: string;
|
|
26
|
+
still?: string;
|
|
27
|
+
under?: string;
|
|
28
|
+
mono?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** A field: the effects-astro effect that draws it (its runtime file's name), its label, and its deal. */
|
|
32
|
+
export type Field = { effect: string; label: string; deal: (d: FieldDeal) => FieldCard };
|
|
33
|
+
|
|
34
|
+
/** The glyphs' face when the wall has no monospaced one. */
|
|
35
|
+
export declare const MONO_FALLBACK: string;
|
|
36
|
+
/** The field cards by kind. */
|
|
37
|
+
export declare const FIELDS: Record<FieldKind, Field>;
|
|
38
|
+
/** Whether a kind is a field card. */
|
|
39
|
+
export declare const isField: (k: string) => k is FieldKind;
|
package/src/fields.js
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @logomarks/lookbook/fields
|
|
3
|
+
*
|
|
4
|
+
* The field cards: a live background drawn by one of @arraypress/effects-astro's fields (ASCII noise, …), started on
|
|
5
|
+
* screen like a shader card (`./live.js`), the lockup over a quiet middle. Most came from Processing sketches a friend of
|
|
6
|
+
* the owner shared (2026-11-20), modernised in effects-astro.
|
|
7
|
+
*
|
|
8
|
+
* Each field says which effect draws it, its label, and how a card deals it: the effect's settings, the card's ground
|
|
9
|
+
* and ink, what shows before the effect starts (a CSS `still`, or markup laid `under` the canvas), and whether the name
|
|
10
|
+
* is set in the wall's monospaced face. A field's canvas paints its ground too, so it fades in over the still.
|
|
11
|
+
*
|
|
12
|
+
* Pure: everything comes from the card's seeded random, so the page and its script deal identical cards.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { escapeHtml } from '@arraypress/text';
|
|
16
|
+
import { asciiCells, rampOf } from '@arraypress/effects-astro/runtime/ascii-noise';
|
|
17
|
+
import { mixOklab, parseColor, toHex } from '@arraypress/effects-astro/runtime/color';
|
|
18
|
+
import { lightLeakStill } from '@arraypress/effects-astro/runtime/light-leak';
|
|
19
|
+
import { ditherStill } from '@arraypress/effects-astro/runtime/dither-field';
|
|
20
|
+
import { gridStill } from '@arraypress/effects-astro/runtime/kinetic-grid';
|
|
21
|
+
|
|
22
|
+
/** The glyphs' face when the wall has no monospaced one. */
|
|
23
|
+
export const MONO_FALLBACK = 'ui-monospace, SFMono-Regular, Menlo, monospace';
|
|
24
|
+
|
|
25
|
+
/** An offset into a field's noise, so two cards on the same settings differ. */
|
|
26
|
+
const offsetOf = (r) => [Math.round(r() * 4000) / 100, Math.round(r() * 4000) / 100];
|
|
27
|
+
/** A number between two, at two decimals, from the card's random. */
|
|
28
|
+
const between = (r, lo, hi) => Math.round((lo + r() * (hi - lo)) * 100) / 100;
|
|
29
|
+
/** A field card's shape, width over height (every field card is 4:5). */
|
|
30
|
+
const CARD = 4 / 5;
|
|
31
|
+
|
|
32
|
+
/* ---------- ASCII noise (effects-astro's asciiNoise) ---------- */
|
|
33
|
+
|
|
34
|
+
/** ASCII noise cards' colours: ground, the quiet cells, the loud cells, and the lockup. */
|
|
35
|
+
const noiseInksOf = (accent) => [
|
|
36
|
+
['#0B0B0B', '#3A3A3A', '#FFFFFF', '#FFFFFF'], // graphite
|
|
37
|
+
['#0B0B0B', '#2C3A0A', accent, accent], // acid
|
|
38
|
+
['#0B0B0B', '#0D3B2A', '#39FF88', '#39FF88'], // phosphor
|
|
39
|
+
['#0038FF', '#2F5CFF', '#FFFFFF', '#FFFFFF'], // cobalt
|
|
40
|
+
['#F4F3EF', '#D2D0C8', '#0B0B0B', '#0B0B0B'], // paper
|
|
41
|
+
['#FF3D00', '#FF7A4D', '#0B0B0B', '#0B0B0B'], // signal
|
|
42
|
+
];
|
|
43
|
+
/** The ramps an ASCII noise card takes (effects-astro's NOISE_RAMPS, each quietest first, all in a monospaced face; the
|
|
44
|
+
* shade blocks after a space, so the quiet middle is empty, not a texture). */
|
|
45
|
+
const NOISE_RAMPS = ['ascii', ' ░▒▓█', 'digits', 'rise', 'dense', 'quads'];
|
|
46
|
+
/** A noise card's cell, width over height (a monospaced face's advance). */
|
|
47
|
+
const NOISE_ASPECT = 0.6;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* An ASCII noise card's first frame as SVG text: the characters its shader starts on (effects-astro's `asciiCells`), a
|
|
51
|
+
* row a line pinned to the cell pitch (`textLength`). In one tone, between the quiet and loud colours (a colour a run
|
|
52
|
+
* made each card ~19 KB; this is ~3 KB): the shader's canvas fades in over it and the tones settle in.
|
|
53
|
+
*
|
|
54
|
+
* @param cfg The card's noise settings.
|
|
55
|
+
*/
|
|
56
|
+
function noiseStill(cfg) {
|
|
57
|
+
const ramp = rampOf(cfg.glyphs),
|
|
58
|
+
cols = cfg.cols,
|
|
59
|
+
h = 1 / NOISE_ASPECT;
|
|
60
|
+
// a 4:5 card: cols × 1.25 widths tall, in rows of 1 / aspect
|
|
61
|
+
const rows = Math.round((cols * 1.25) / h);
|
|
62
|
+
const [lo, hi] = cfg.colors.map(parseColor);
|
|
63
|
+
const tone = toHex(mixOklab(lo, hi, 0.7));
|
|
64
|
+
const text = asciiCells(cfg, cols, rows).map(
|
|
65
|
+
(row, j) =>
|
|
66
|
+
// spaces as no-break spaces: SVG text collapses runs of spaces (whatever `white-space` says), and `textLength`
|
|
67
|
+
// would spread what's left across the row
|
|
68
|
+
`<text y="${((j + 0.5) * h).toFixed(2)}" textLength="${cols}" lengthAdjust="spacing">${escapeHtml(row.map((i) => ramp[i]).join('')).replaceAll(' ', ' ')}</text>`,
|
|
69
|
+
);
|
|
70
|
+
return `<svg class="wc-noise" viewBox="0 0 ${cols} ${(rows * h).toFixed(2)}" xml:space="preserve" font-size="${(h * 0.92).toFixed(3)}" fill="${tone}" style="font-family:${escapeHtml(cfg.font)}" aria-hidden="true">${text.join('')}</svg>`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** asciinoise: drifting monospaced type, its first frame laid as text under the canvas. */
|
|
74
|
+
function asciinoise({ pick, r, accent, mono }) {
|
|
75
|
+
const [ground, lo, hi, ink] = pick(noiseInksOf(accent));
|
|
76
|
+
const cfg = {
|
|
77
|
+
glyphs: pick(NOISE_RAMPS),
|
|
78
|
+
cols: pick([40, 48]),
|
|
79
|
+
scale: pick([1.8, 2.45, 3.1]),
|
|
80
|
+
contrast: pick([4, 6]),
|
|
81
|
+
brightness: pick([-0.15, -0.1, -0.05]),
|
|
82
|
+
offset: offsetOf(r),
|
|
83
|
+
colors: [lo, hi],
|
|
84
|
+
background: ground,
|
|
85
|
+
font: mono?.[0] ?? MONO_FALLBACK,
|
|
86
|
+
quiet: { radius: 0.56, depth: 1 },
|
|
87
|
+
};
|
|
88
|
+
return { cfg, ground, ink, under: noiseStill(cfg), mono: true };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* ---------- Light leak (effects-astro's lightLeak, after the lava-lamp sketch) ---------- */
|
|
92
|
+
|
|
93
|
+
/** Light leak cards' colours, darkest first (the ground is the darkest), the lockup's ink, and the tone the quiet middle
|
|
94
|
+
* flattens to (0 the darkest, 1 the brightest). */
|
|
95
|
+
const leakInksOf = (accent) => [
|
|
96
|
+
{ colors: ['#160402', '#7A1800', '#FF3D00', '#FFB08A'], ink: '#FFFFFF', tone: 0.08 }, // signal
|
|
97
|
+
{ colors: ['#03061A', '#0A1F8F', '#0038FF', '#8FB4FF'], ink: '#FFFFFF', tone: 0.08 }, // cobalt
|
|
98
|
+
{ colors: ['#0B0B0B', '#1F2A06', '#6B8F00', accent], ink: '#FFFFFF', tone: 0.08 }, // acid
|
|
99
|
+
{ colors: ['#03110F', '#0A4F47', '#0E8C7E', '#39FF88'], ink: '#FFFFFF', tone: 0.08 }, // teal
|
|
100
|
+
{ colors: ['#0E0520', '#4A1F9E', '#7B3FF2', '#FF3EA5'], ink: '#FFFFFF', tone: 0.08 }, // violet
|
|
101
|
+
{ colors: ['#FF5C64', '#FFB3A8', '#F4F3EF', '#FFFFFF'], ink: '#0B0B0B', tone: 1 }, // paper
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
/** lightleak: a soft, slow colour field (light leak, lava lamp), its middle flattened to one tone for the lockup. */
|
|
105
|
+
function lightleak({ pick, r, accent }) {
|
|
106
|
+
const { colors, ink, tone } = pick(leakInksOf(accent));
|
|
107
|
+
const cfg = {
|
|
108
|
+
colors,
|
|
109
|
+
scale: between(r, 1.2, 1.9),
|
|
110
|
+
warp: between(r, 0.2, 0.45),
|
|
111
|
+
octaves: r() < 0.25 ? 3 : 2,
|
|
112
|
+
contrast: between(r, 1.4, 1.9),
|
|
113
|
+
speed: between(r, 0.8, 1.4),
|
|
114
|
+
offset: offsetOf(r),
|
|
115
|
+
quiet: { radius: 0.42, depth: 0.65 },
|
|
116
|
+
quietTone: tone,
|
|
117
|
+
};
|
|
118
|
+
return { cfg, ground: colors[0], ink, still: lightLeakStill(cfg, CARD) };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* ---------- Cascade grid (effects-astro's cascadeGrid, after the hex spectrogram and circle grid sketches) ---------- */
|
|
122
|
+
|
|
123
|
+
/** Cascade grid cards' colours: ground, idle cells, reactive cells, the lockup's ink. */
|
|
124
|
+
const cascadeInksOf = (accent) => [
|
|
125
|
+
['#0B0B0B', '#3A3A36', accent, '#F4F3EF'], // acid
|
|
126
|
+
['#F4F3EF', '#B9BCCB', '#0038FF', '#0B0B0B'], // cobalt on paper
|
|
127
|
+
['#1A0700', '#5A2A18', '#FF3D00', '#F4F3EF'], // signal
|
|
128
|
+
['#04140B', '#1D4A30', '#39FF88', '#F4F3EF'], // phosphor
|
|
129
|
+
['#0B0B0B', '#3A3A3A', '#F4F3EF', '#F4F3EF'], // mono
|
|
130
|
+
['#F4F3EF', '#D6C9C2', '#FF5C64', '#0B0B0B'], // coral on paper
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
/** cascade: a grid of hexagons or dots run like a scrolling spectrogram, waves cascading across it. */
|
|
134
|
+
function cascade({ pick, r, accent }) {
|
|
135
|
+
const [ground, idle, reactive, ink] = pick(cascadeInksOf(accent));
|
|
136
|
+
const cell = r() < 0.5 ? 'hex' : 'dot';
|
|
137
|
+
const cfg = {
|
|
138
|
+
cell,
|
|
139
|
+
cols: cell === 'hex' ? pick([24, 28, 32]) : pick([28, 32, 36]),
|
|
140
|
+
colors: [idle, reactive],
|
|
141
|
+
background: ground,
|
|
142
|
+
...(cell === 'hex' ? { fill: pick(['core', 'core', 'solid', 'outline']) } : {}),
|
|
143
|
+
direction: r() < 0.75 ? 'right' : 'up',
|
|
144
|
+
lag: between(r, 0.05, 0.1),
|
|
145
|
+
tilt: between(r, 0.25, 0.45),
|
|
146
|
+
offset: Math.round(r() * 10000) / 100,
|
|
147
|
+
quiet: { radius: 0.36, depth: 0.95 },
|
|
148
|
+
};
|
|
149
|
+
// the ground alone until it starts: the idle lattice in CSS can't know the card's width to line up with it
|
|
150
|
+
return { cfg, ground, ink };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* ---------- Flow field (effects-astro's flowField, after the Perlin flow-field sketch) ---------- */
|
|
154
|
+
|
|
155
|
+
/** Flow field cards' colours: ground, the trails' colours (blended in Oklab), the lockup's ink. */
|
|
156
|
+
const flowInksOf = (accent) => [
|
|
157
|
+
['#0B0B0B', ['#F4F3EF'], '#F4F3EF'], // mono
|
|
158
|
+
['#0B0B0B', [accent, '#39FF88'], accent], // acid
|
|
159
|
+
['#F4F3EF', ['#0B0B0B', '#0038FF'], '#0B0B0B'], // paper
|
|
160
|
+
['#0038FF', ['#F4F3EF', accent], '#F4F3EF'], // cobalt
|
|
161
|
+
['#140604', ['#FF3D00', '#FF5C64', '#F4F3EF'], '#F4F3EF'], // signal
|
|
162
|
+
['#12081F', ['#7B3FF2', '#FF3EA5'], '#F4F3EF'], // violet
|
|
163
|
+
];
|
|
164
|
+
|
|
165
|
+
/** flowfield: fine trails riding a slowly evolving noise flow, gathering into streams (Canvas 2D: no WebGL context). */
|
|
166
|
+
function flowfield({ pick, r, accent }) {
|
|
167
|
+
const [ground, colors, ink] = pick(flowInksOf(accent));
|
|
168
|
+
const paper = ground === '#F4F3EF';
|
|
169
|
+
const cfg = {
|
|
170
|
+
colors,
|
|
171
|
+
background: ground,
|
|
172
|
+
colorBy: pick(['life', 'life', 'life', 'speed', 'random']),
|
|
173
|
+
density: Math.round(between(r, 20, 28)),
|
|
174
|
+
length: between(r, 0.4, 0.7),
|
|
175
|
+
weight: paper ? between(r, 0.8, 1) : between(r, 0.6, 0.9),
|
|
176
|
+
opacity: between(r, 0.7, 0.85),
|
|
177
|
+
pace: Math.round(between(r, 80, 130)),
|
|
178
|
+
scale: between(r, 1.6, 2.6),
|
|
179
|
+
evolve: between(r, 0.1, 0.2),
|
|
180
|
+
vary: between(r, 0.3, 0.45),
|
|
181
|
+
seed: 1 + Math.floor(r() * 100000),
|
|
182
|
+
quiet: { radius: 0.5, depth: 0.95 },
|
|
183
|
+
};
|
|
184
|
+
const still = `radial-gradient(120% 80% at 30% 25%, color-mix(in oklab, ${colors[0]} 10%, transparent), transparent 65%), ${ground}`;
|
|
185
|
+
return { cfg, ground, ink, still };
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* ---------- Voronoi mesh (effects-astro's voronoiMesh, after the Voronoi sketch) ---------- */
|
|
189
|
+
|
|
190
|
+
/** Voronoi mesh cards' colours: ground, [macro line, inner line], the lockup's ink, and the lines' opacity where the
|
|
191
|
+
* default doesn't hold (lime over black reads olive at the default 0.4). */
|
|
192
|
+
const meshInksOf = (accent) => [
|
|
193
|
+
['#350F0E', ['#C1C2BC', '#A67676'], '#F4F3EF'], // silt (the sketch's own)
|
|
194
|
+
['#0B0B0B', [accent, accent], '#F4F3EF', [0.6, 0.24]], // acid
|
|
195
|
+
['#0038FF', ['#F4F3EF', '#8FA8FF'], '#F4F3EF'], // cobalt
|
|
196
|
+
['#F4F3EF', ['#0B0B0B', '#FF3D00'], '#0B0B0B'], // paper
|
|
197
|
+
['#06302B', ['#39FF88', '#1FB39F'], '#F4F3EF'], // phosphor
|
|
198
|
+
['#1E0B45', ['#FF3EA5', '#9B6BFF'], '#F4F3EF'], // violet
|
|
199
|
+
];
|
|
200
|
+
|
|
201
|
+
/** voronoi: two tiers of thin cell outlines, the macro seeds orbiting, the inner cells pulsing out from theirs. */
|
|
202
|
+
function voronoi({ pick, r, accent }) {
|
|
203
|
+
const [ground, colors, ink, opacity] = pick(meshInksOf(accent));
|
|
204
|
+
const cfg = {
|
|
205
|
+
colors,
|
|
206
|
+
background: ground,
|
|
207
|
+
...(opacity ? { opacity } : {}),
|
|
208
|
+
cells: pick([4, 5, 6]),
|
|
209
|
+
inner: pick([4, 5, 6]),
|
|
210
|
+
width: between(r, 1, 1.25),
|
|
211
|
+
speed: between(r, 0.8, 1.4),
|
|
212
|
+
offset: [Math.round(r() * 10000) / 100, Math.round(r() * 10000) / 100],
|
|
213
|
+
quiet: { radius: 0.55, depth: 0.85 },
|
|
214
|
+
};
|
|
215
|
+
// the ground alone until it starts (its SVG still is ~23 KB a card, and a data: URL the CSP would have to allow)
|
|
216
|
+
return { cfg, ground, ink };
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* ---------- Dither field (effects-astro's ditherField, after the ripple dither sketch) ---------- */
|
|
220
|
+
|
|
221
|
+
/** Dither field cards' colours: ground, [dim edge, bright core], the lockup's ink. */
|
|
222
|
+
const ditherInksOf = (accent) => [
|
|
223
|
+
['#0B0B0B', ['#3A4A0C', accent], '#F4F3EF'], // acid
|
|
224
|
+
['#0B0B0B', ['#5A1A08', '#FF3D00'], '#F4F3EF'], // signal
|
|
225
|
+
['#060A1F', ['#1C2F7A', '#5D8BFF'], '#F4F3EF'], // cobalt
|
|
226
|
+
['#03140B', ['#0E5A35', '#39FF88'], '#F4F3EF'], // phosphor
|
|
227
|
+
['#1A0B14', ['#7B3FF2', '#FF5C64'], '#F4F3EF'], // coral
|
|
228
|
+
['#F4F3EF', ['#9AA6C6', '#0038FF'], '#0B0B0B'], // paper
|
|
229
|
+
];
|
|
230
|
+
/** The corners a dither card's ripples run out from (0–1 from the top left). */
|
|
231
|
+
const DITHER_ORIGINS = [
|
|
232
|
+
[0.04, 0.3],
|
|
233
|
+
[0.96, 0.85],
|
|
234
|
+
[0.04, 0.96],
|
|
235
|
+
[0.96, 0.08],
|
|
236
|
+
];
|
|
237
|
+
|
|
238
|
+
/** dither: a noise field in square dots, Bayer-dithered edges into a banded core, ripples running from a corner. */
|
|
239
|
+
function dither({ pick, r, accent }) {
|
|
240
|
+
const [ground, colors, ink] = pick(ditherInksOf(accent));
|
|
241
|
+
const cfg = {
|
|
242
|
+
colors,
|
|
243
|
+
background: ground,
|
|
244
|
+
dot: 3,
|
|
245
|
+
scale: between(r, 0.9, 1.5),
|
|
246
|
+
brightness: between(r, -0.25, -0.12),
|
|
247
|
+
evolve: between(r, 0.25, 0.45),
|
|
248
|
+
steps: pick([16, 20, 24]),
|
|
249
|
+
rings: pick([2, 3, 4]),
|
|
250
|
+
rippleSpeed: between(r, 0.06, 0.1),
|
|
251
|
+
ripple: between(r, 0.8, 1.2),
|
|
252
|
+
origin: pick(DITHER_ORIGINS),
|
|
253
|
+
offset: [Math.round(r() * 5000) / 100, Math.round(r() * 5000) / 100],
|
|
254
|
+
quiet: { radius: 0.42, depth: 1 },
|
|
255
|
+
};
|
|
256
|
+
return { cfg, ground, ink, still: ditherStill(cfg) };
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* ---------- Kinetic grid (effects-astro's kineticGrid, after the rain grid sketch) ---------- */
|
|
260
|
+
|
|
261
|
+
/** Kinetic grid cards' colours: ground, [wire, pulse], the lockup's ink, and the wires' rest brightness. */
|
|
262
|
+
const gridInksOf = (accent) => [
|
|
263
|
+
['#0B0B0B', ['#3197FF', '#FFFFFF'], '#FFFFFF', 0.35], // blueprint (the sketch's own)
|
|
264
|
+
['#0B0B0B', [accent, '#FFFFFF'], accent, 0.35], // acid
|
|
265
|
+
['#06140D', ['#39FF88', '#E9FFF2'], '#39FF88', 0.28], // phosphor
|
|
266
|
+
['#0038FF', ['#8FA8FF', '#FFFFFF'], '#FFFFFF', 0.35], // cobalt
|
|
267
|
+
['#0B0B0B', ['#FF3D00', '#FFD2C2'], '#FFFFFF', 0.35], // signal
|
|
268
|
+
['#F4F3EF', ['#0B0B0B', '#FF3D00'], '#0B0B0B', 0.35], // paper
|
|
269
|
+
];
|
|
270
|
+
|
|
271
|
+
/** kinetic: a fine wireframe grid that ripples where drops land, pulses running along its wires. */
|
|
272
|
+
function kinetic({ pick, r, accent }) {
|
|
273
|
+
const [ground, colors, ink, rest] = pick(gridInksOf(accent));
|
|
274
|
+
const cfg = {
|
|
275
|
+
colors,
|
|
276
|
+
background: ground,
|
|
277
|
+
// fewer, bigger cells and longer waves than the effect's defaults, so the rings read on a card
|
|
278
|
+
cols: pick([28, 32]),
|
|
279
|
+
width: 1,
|
|
280
|
+
rest,
|
|
281
|
+
drops: pick([4, 5]),
|
|
282
|
+
strength: pick([1, 1.2]),
|
|
283
|
+
size: pick([1, 1.2]),
|
|
284
|
+
pulses: pick([2, 3]),
|
|
285
|
+
offset: Math.round(r() * 10000) / 100,
|
|
286
|
+
quiet: { radius: 0.5, depth: 0.8 },
|
|
287
|
+
};
|
|
288
|
+
return { cfg, ground, ink, still: gridStill(cfg, 1 / CARD) };
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/* ---------- the table ---------- */
|
|
292
|
+
|
|
293
|
+
/** The field cards by kind: the effect that draws each (effects-astro's runtime, by its file name), its label, and its
|
|
294
|
+
* deal. */
|
|
295
|
+
export const FIELDS = {
|
|
296
|
+
asciinoise: { effect: 'ascii-noise', label: 'ASCII noise', deal: asciinoise },
|
|
297
|
+
lightleak: { effect: 'light-leak', label: 'Light leak', deal: lightleak },
|
|
298
|
+
cascade: { effect: 'cascade-grid', label: 'Cascade grid', deal: cascade },
|
|
299
|
+
flowfield: { effect: 'flow-field', label: 'Flow field', deal: flowfield },
|
|
300
|
+
voronoi: { effect: 'voronoi-mesh', label: 'Voronoi mesh', deal: voronoi },
|
|
301
|
+
dither: { effect: 'dither-field', label: 'Dither field', deal: dither },
|
|
302
|
+
kinetic: { effect: 'kinetic-grid', label: 'Kinetic grid', deal: kinetic },
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
/** Whether a kind is a field card. */
|
|
306
|
+
export const isField = (k) => Object.hasOwn(FIELDS, k);
|
package/src/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
/** The wall: `lookbook()` (its cards and feed), `shuffled`, the accent, the looks' weights and how often a promo card comes. */
|
|
10
10
|
export { ACCENT, EVERY, KIND_LABEL, WEIGHTS, lookbook, shuffled } from './wall.js';
|
|
11
|
+
export { FIELDS, isField } from './fields.js';
|
|
12
|
+
export type { FieldKind, Field } from './fields.js';
|
|
11
13
|
export type { Brand, BrandPicker, Card, Face, Kind, Lookbook, LookbookOptions, Recent, WallAssets, WallMark } from './wall.js';
|
|
12
14
|
/** The cards between the marks. */
|
|
13
15
|
export { headlineCard, sponsorCard, openSlotCard } from './promo.js';
|
package/src/index.js
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
/** The wall: `lookbook()` (its cards and feed), `shuffled`, the accent, the looks' weights and how often a promo card comes. */
|
|
11
11
|
export { ACCENT, EVERY, KIND_LABEL, WEIGHTS, lookbook, shuffled } from './wall.js';
|
|
12
|
+
/** The field cards: live effects-astro fields behind a lockup (each off unless a wall gives it a weight). */
|
|
13
|
+
export { FIELDS, isField } from './fields.js';
|
|
12
14
|
|
|
13
15
|
/** The cards between the marks. */
|
|
14
16
|
export { headlineCard, sponsorCard, openSlotCard } from './promo.js';
|
package/src/live.js
CHANGED
|
@@ -9,7 +9,41 @@
|
|
|
9
9
|
|
|
10
10
|
import { ink } from '@arraypress/effects-astro/runtime/ink';
|
|
11
11
|
import { paperShader } from '@arraypress/effects-astro/runtime/paper';
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The field cards' effects (./fields.js), each loaded when a card first needs it, in its own chunk. The paths are
|
|
15
|
+
* literals, so a bundler splits them (it leaves a path built from a name in a package as it is).
|
|
16
|
+
*/
|
|
17
|
+
const FIELD_EFFECTS = {
|
|
18
|
+
'ascii-noise': () => import('@arraypress/effects-astro/runtime/ascii-noise').then((m) => m.asciiNoise),
|
|
19
|
+
'light-leak': () => import('@arraypress/effects-astro/runtime/light-leak').then((m) => m.lightLeak),
|
|
20
|
+
'cascade-grid': () => import('@arraypress/effects-astro/runtime/cascade-grid').then((m) => m.cascadeGrid),
|
|
21
|
+
'flow-field': () => import('@arraypress/effects-astro/runtime/flow-field').then((m) => m.flowField),
|
|
22
|
+
'voronoi-mesh': () => import('@arraypress/effects-astro/runtime/voronoi-mesh').then((m) => m.voronoiMesh),
|
|
23
|
+
'dither-field': () => import('@arraypress/effects-astro/runtime/dither-field').then((m) => m.ditherField),
|
|
24
|
+
'kinetic-grid': () => import('@arraypress/effects-astro/runtime/kinetic-grid').then((m) => m.kineticGrid),
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Starts a field card's effect once its module has loaded.
|
|
29
|
+
*
|
|
30
|
+
* @param card The card.
|
|
31
|
+
* @param config Its `data-shader` config (`effect` names the field).
|
|
32
|
+
* @returns Stops it, or stops it from starting.
|
|
33
|
+
*/
|
|
34
|
+
function field(card, config) {
|
|
35
|
+
let stop = () => {};
|
|
36
|
+
let gone = false;
|
|
37
|
+
FIELD_EFFECTS[config.effect]?.()
|
|
38
|
+
.then((start) => {
|
|
39
|
+
if (!gone) stop = start(card, config);
|
|
40
|
+
})
|
|
41
|
+
.catch(() => {}); // it can't run here: the card keeps its still
|
|
42
|
+
return () => {
|
|
43
|
+
gone = true;
|
|
44
|
+
stop();
|
|
45
|
+
};
|
|
46
|
+
}
|
|
13
47
|
import { whenNear } from '@arraypress/effects-astro/runtime/near';
|
|
14
48
|
import { budget } from '@arraypress/effects-astro/runtime/budget';
|
|
15
49
|
|
|
@@ -54,14 +88,42 @@ export function shaders(cap = 10) {
|
|
|
54
88
|
return (card) => {
|
|
55
89
|
try {
|
|
56
90
|
const config = JSON.parse(card.dataset.shader ?? '{}');
|
|
57
|
-
//
|
|
58
|
-
|
|
91
|
+
// a field card's effect is effects-astro's own; the rest are Paper's shaders
|
|
92
|
+
const start = () => (config.effect ? field(card, config) : paperShader(card, config));
|
|
93
|
+
return take(card, () => {
|
|
94
|
+
const stop = start();
|
|
95
|
+
return () => {
|
|
96
|
+
stop();
|
|
97
|
+
release(card);
|
|
98
|
+
};
|
|
99
|
+
});
|
|
59
100
|
} catch {
|
|
60
101
|
return () => {}; // no WebGL: the card keeps its still look
|
|
61
102
|
}
|
|
62
103
|
};
|
|
63
104
|
}
|
|
64
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Gives a stopped card's WebGL context back and lays a fresh canvas for its next turn. An effect that stops while its
|
|
108
|
+
* card is still on the page keeps its context (to start again quickly), but a long wall stops hundreds: past about
|
|
109
|
+
* sixteen the browser drops the oldest, and a card whose context was dropped can't draw again. So only the cards
|
|
110
|
+
* running (the budget) hold one.
|
|
111
|
+
*
|
|
112
|
+
* @param card The card.
|
|
113
|
+
*/
|
|
114
|
+
function release(card) {
|
|
115
|
+
const old = card.querySelector('canvas.wc-fx');
|
|
116
|
+
if (!old) return;
|
|
117
|
+
// any getContext call gives a canvas without one a new context (and a new WebGL one, at the limit, drops a running
|
|
118
|
+
// card's), so ask for the cheapest first: if it is given, there was none to give back; if not, the canvas has one, and
|
|
119
|
+
// a WebGL one is lost (a Canvas 2D field's has nothing to give back)
|
|
120
|
+
if (!old.getContext('bitmaprenderer')) {
|
|
121
|
+
const gl = old.getContext('webgl2') ?? old.getContext('webgl');
|
|
122
|
+
gl?.getExtension('WEBGL_lose_context')?.loseContext();
|
|
123
|
+
}
|
|
124
|
+
old.replaceWith(old.cloneNode(false));
|
|
125
|
+
}
|
|
126
|
+
|
|
65
127
|
const LIVE = '[data-shader], [data-smoke], [data-anim]';
|
|
66
128
|
|
|
67
129
|
/**
|
package/src/styles/wall.css
CHANGED
|
@@ -754,10 +754,10 @@
|
|
|
754
754
|
text-shadow: 0 2px 24px rgb(0 0 0 / 0.2);
|
|
755
755
|
}
|
|
756
756
|
|
|
757
|
-
/*
|
|
758
|
-
|
|
759
|
-
paints the ground too, so it fades in over the
|
|
760
|
-
.wc-
|
|
757
|
+
/* field cards (../fields.js): a live field from the effects library on a flat ground, the lockup in the quiet middle.
|
|
758
|
+
What shows first is the field's still (a CSS background, or ASCII noise's first frame as text, .wc-noise); the field's
|
|
759
|
+
canvas paints the ground too, so it fades in over the still like a shader card's */
|
|
760
|
+
.wc-field {
|
|
761
761
|
background: var(--bg);
|
|
762
762
|
color: var(--fg);
|
|
763
763
|
}
|
|
@@ -773,7 +773,7 @@
|
|
|
773
773
|
font-variant-ligatures: none;
|
|
774
774
|
}
|
|
775
775
|
|
|
776
|
-
.wc-
|
|
776
|
+
.wc-field .wc-lockup {
|
|
777
777
|
color: var(--fg);
|
|
778
778
|
}
|
|
779
779
|
|
|
@@ -1124,21 +1124,21 @@
|
|
|
1124
1124
|
card), so a card never pops from one to the other as it comes near the screen */
|
|
1125
1125
|
.wc-gradient .wc-fx,
|
|
1126
1126
|
.wc-shader .wc-fx,
|
|
1127
|
-
.wc-
|
|
1127
|
+
.wc-field .wc-fx {
|
|
1128
1128
|
opacity: 0;
|
|
1129
1129
|
transition: opacity 1.4s ease;
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
1132
|
.wc-gradient[data-effect-live] .wc-fx,
|
|
1133
1133
|
.wc-shader[data-effect-live] .wc-fx,
|
|
1134
|
-
.wc-
|
|
1134
|
+
.wc-field[data-effect-live] .wc-fx {
|
|
1135
1135
|
opacity: 1;
|
|
1136
1136
|
}
|
|
1137
1137
|
|
|
1138
1138
|
@media (prefers-reduced-motion: reduce) {
|
|
1139
1139
|
.wc-gradient .wc-fx,
|
|
1140
1140
|
.wc-shader .wc-fx,
|
|
1141
|
-
.wc-
|
|
1141
|
+
.wc-field .wc-fx {
|
|
1142
1142
|
transition: none;
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
package/src/wall.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* (`lookbook()`); the styles are `@logomarks/lookbook/wall.css` and `@logomarks/lookbook/wall-looks.css`.
|
|
8
8
|
*/
|
|
9
9
|
import { type LookKind } from './looks/index.js';
|
|
10
|
+
import { type FieldKind } from './fields.js';
|
|
10
11
|
/** The one accent: acid lime. Every lime the looks print is this, unless `lookbook({ accent })` says otherwise. */
|
|
11
12
|
export declare const ACCENT = '#C8FF00';
|
|
12
13
|
/** A mark as the wall needs it: its outline (its paths' markup on the 512 canvas), what the brand picker reads (subject,
|
|
@@ -46,7 +47,7 @@ export type Kind =
|
|
|
46
47
|
| 'paper'
|
|
47
48
|
| 'gradient'
|
|
48
49
|
| 'shader'
|
|
49
|
-
|
|
|
50
|
+
| FieldKind
|
|
50
51
|
| LookKind;
|
|
51
52
|
/** A card's made-up brand: its name, its line ("Coffee Co."), a tagline and a web address ending, from one sector. */
|
|
52
53
|
export type Brand = {
|
|
@@ -92,8 +93,9 @@ export type LookbookOptions = {
|
|
|
92
93
|
*/
|
|
93
94
|
palettes?: readonly (readonly [string, string])[];
|
|
94
95
|
/**
|
|
95
|
-
* How often looks are dealt, over `WEIGHTS` (relative; 0 deals a look never).
|
|
96
|
-
*
|
|
96
|
+
* How often looks are dealt, over `WEIGHTS` (relative; 0 deals a look never). The field cards (`FIELDS`: ASCII noise,
|
|
97
|
+
* light leak, dither, cascade, flow field, Voronoi, kinetic grid) are 0 unless given one, so a wall without them deals
|
|
98
|
+
* the same cards as before; `{ asciinoise: 1 }` deals one as often as the paper card.
|
|
97
99
|
*/
|
|
98
100
|
weights?: Partial<Record<Kind, number>>;
|
|
99
101
|
/** Where a card links: `#slug` by default. */
|
package/src/wall.js
CHANGED
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { liveGradient } from '@arraypress/effects-astro/runtime/live-gradient';
|
|
11
|
-
import { asciiCells, rampOf } from '@arraypress/effects-astro/runtime/ascii-noise';
|
|
12
|
-
import { mixOklab, parseColor, toHex } from '@arraypress/effects-astro/runtime/color';
|
|
13
11
|
import { escapeHtml } from '@arraypress/text';
|
|
14
12
|
// the share cards' mesh palettes and seeded random (@arraypress/og-image draws with the same); browser-safe
|
|
15
13
|
import { PALETTES as OG_MESHES, hash, rng } from '@arraypress/og-image/palette';
|
|
@@ -17,6 +15,7 @@ import { look, isLook, ACID, LOOK_RATIO, LOOK_WEIGHTS } from './looks/index.js';
|
|
|
17
15
|
import { opticalStyle } from './marks.js';
|
|
18
16
|
import { BLOOM_KINDS, bloomFits } from './looks/bloom.js';
|
|
19
17
|
import { CLUB_KINDS, CLUB_PHOTOS, clubFits } from './looks/club.js';
|
|
18
|
+
import { FIELDS, isField, MONO_FALLBACK } from './fields.js';
|
|
20
19
|
|
|
21
20
|
/** The one accent: acid lime. Every lime the looks print is this, unless `lookbook({ accent })` says otherwise. */
|
|
22
21
|
export const ACCENT = '#C8FF00';
|
|
@@ -100,7 +99,7 @@ const RATIO = {
|
|
|
100
99
|
paper: '4 / 5',
|
|
101
100
|
gradient: '4 / 5',
|
|
102
101
|
shader: '4 / 5',
|
|
103
|
-
|
|
102
|
+
...Object.fromEntries(Object.keys(FIELDS).map((k) => [k, '4 / 5'])),
|
|
104
103
|
...LOOK_RATIO,
|
|
105
104
|
};
|
|
106
105
|
/** How often each look is dealt (relative). The older looks keep the shares they had as a list (photo and gradient 3 in
|
|
@@ -121,14 +120,15 @@ export const WEIGHTS = {
|
|
|
121
120
|
crt: 1,
|
|
122
121
|
pattern: 1,
|
|
123
122
|
crop: 1,
|
|
124
|
-
// dealt only where a wall gives
|
|
125
|
-
|
|
123
|
+
// the field cards are dealt only where a wall gives them a weight (`lookbook({ weights })`), so the walls made before
|
|
124
|
+
// they came deal as they did
|
|
125
|
+
...Object.fromEntries(Object.keys(FIELDS).map((k) => [k, 0])),
|
|
126
126
|
...LOOK_WEIGHTS,
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
/** Names for the looks here whose id doesn't read as one (the others are their id, capitalised; the drawn looks'
|
|
130
130
|
* are `LOOK_LABEL`). */
|
|
131
|
-
export const KIND_LABEL =
|
|
131
|
+
export const KIND_LABEL = Object.fromEntries(Object.entries(FIELDS).map(([k, f]) => [k, f.label]));
|
|
132
132
|
|
|
133
133
|
/** The live backgrounds a shader card can have: Paper's shaders (vendored in the effects library), the calm looks
|
|
134
134
|
* picked from its presets (2026-11-12: the rainbow colour panels, the white-hot smoke ring, the grey ink and Paper's
|
|
@@ -177,48 +177,6 @@ const LOOKS = [
|
|
|
177
177
|
},
|
|
178
178
|
];
|
|
179
179
|
|
|
180
|
-
/** ASCII noise cards' colours: ground, the quiet cells, the loud cells, and the lockup. */
|
|
181
|
-
const noiseInksOf = (accent) => [
|
|
182
|
-
['#0B0B0B', '#3A3A3A', '#FFFFFF', '#FFFFFF'], // graphite
|
|
183
|
-
['#0B0B0B', '#2C3A0A', accent, accent], // acid
|
|
184
|
-
['#0B0B0B', '#0D3B2A', '#39FF88', '#39FF88'], // phosphor
|
|
185
|
-
['#0038FF', '#2F5CFF', '#FFFFFF', '#FFFFFF'], // cobalt
|
|
186
|
-
['#F4F3EF', '#D2D0C8', '#0B0B0B', '#0B0B0B'], // paper
|
|
187
|
-
['#FF3D00', '#FF7A4D', '#0B0B0B', '#0B0B0B'], // signal
|
|
188
|
-
];
|
|
189
|
-
/** The ramps an ASCII noise card takes (effects-astro's NOISE_RAMPS, each quietest first, all in a monospaced face; the
|
|
190
|
-
* shade blocks after a space, so the quiet middle is empty, not a texture). */
|
|
191
|
-
const NOISE_RAMPS = ['ascii', ' ░▒▓█', 'digits', 'rise', 'dense', 'quads'];
|
|
192
|
-
/** The glyphs' face when the wall has no monospaced one. */
|
|
193
|
-
const NOISE_FONT = 'ui-monospace, SFMono-Regular, Menlo, monospace';
|
|
194
|
-
/** A noise card's cell, width over height (a monospaced face's advance). */
|
|
195
|
-
const NOISE_ASPECT = 0.6;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* An ASCII noise card's first frame as SVG text: the characters its shader starts on (effects-astro's `asciiCells`), a
|
|
199
|
-
* row a line pinned to the cell pitch (`textLength`). In one tone, between the quiet and loud colours (a colour a run
|
|
200
|
-
* made each card ~19 KB; this is ~3 KB): the shader's canvas fades in over it and the tones settle in.
|
|
201
|
-
*
|
|
202
|
-
* @param cfg The card's noise settings.
|
|
203
|
-
* @param font The glyphs' face.
|
|
204
|
-
*/
|
|
205
|
-
function noiseStill(cfg, font) {
|
|
206
|
-
const ramp = rampOf(cfg.glyphs),
|
|
207
|
-
cols = cfg.cols,
|
|
208
|
-
h = 1 / NOISE_ASPECT;
|
|
209
|
-
// a 4:5 card: cols × 1.25 widths tall, in rows of 1 / aspect
|
|
210
|
-
const rows = Math.round((cols * 1.25) / h);
|
|
211
|
-
const [lo, hi] = cfg.colors.map(parseColor);
|
|
212
|
-
const tone = toHex(mixOklab(lo, hi, 0.7));
|
|
213
|
-
const text = asciiCells(cfg, cols, rows).map(
|
|
214
|
-
(row, j) =>
|
|
215
|
-
// spaces as no-break spaces: SVG text collapses runs of spaces (whatever `white-space` says), and `textLength`
|
|
216
|
-
// would spread what's left across the row
|
|
217
|
-
`<text y="${((j + 0.5) * h).toFixed(2)}" textLength="${cols}" lengthAdjust="spacing">${escapeHtml(row.map((i) => ramp[i]).join('')).replaceAll(' ', '\u00a0')}</text>`,
|
|
218
|
-
);
|
|
219
|
-
return `<svg class="wc-noise" viewBox="0 0 ${cols} ${(rows * h).toFixed(2)}" xml:space="preserve" font-size="${(h * 0.92).toFixed(3)}" fill="${tone}" style="font-family:${escapeHtml(font)}" aria-hidden="true">${text.join('')}</svg>`;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
180
|
const NONE = { kinds: [], names: [], lines: [], photos: [] };
|
|
223
181
|
/** How far back each repeat is avoided, in cards. */
|
|
224
182
|
const SPAN = { kinds: 3, names: 30, lines: 8, photos: 12 };
|
|
@@ -239,12 +197,12 @@ export function lookbook(options) {
|
|
|
239
197
|
const skipped = (p) => !!skip && skip.test(p);
|
|
240
198
|
const PALETTES = [...palettesOf(accent), ...(options.palettes ?? [])],
|
|
241
199
|
INKS = inksOf(accent),
|
|
242
|
-
TONES = tonesOf(accent)
|
|
243
|
-
NOISE = noiseInksOf(accent);
|
|
200
|
+
TONES = tonesOf(accent);
|
|
244
201
|
// the looks this wall deals, by weight: `WEIGHTS`, and `options.weights` over them (a look at 0 isn't dealt)
|
|
245
202
|
const DEAL = Object.entries({ ...WEIGHTS, ...options.weights }).filter(([, w]) => w > 0);
|
|
246
203
|
const TOTAL = DEAL.reduce((s, [, w]) => s + w, 0);
|
|
247
|
-
/** The face
|
|
204
|
+
/** The face a field card's name takes when it asks for a monospaced one (ASCII noise): the first given, else the card's
|
|
205
|
+
* own. */
|
|
248
206
|
const MONO = FACES.find(([family]) => /mono/i.test(family));
|
|
249
207
|
|
|
250
208
|
/** One card's HTML, its height over its width, its brand, and what it used. `deal` changes with Shuffle (new names
|
|
@@ -422,29 +380,17 @@ export function lookbook(options) {
|
|
|
422
380
|
attrs = ` data-shader="${escapeHtml(JSON.stringify(cfg))}"`;
|
|
423
381
|
style += `;--fg:${look.ink ?? '#fff'};background:${typeof look.still === 'string' ? look.still : look.still(a, b, c, base)}`;
|
|
424
382
|
inner = `<canvas class="wc-fx" aria-hidden="true"></canvas>${r() < 0.5 ? `<span class="wc-lockup is-stack">${svg()}<b class="wc-name" style="${type}">${escapeHtml(name)}</b><i>${escapeHtml(line)}</i></span>` : `<span class="wc-lockup">${svg()}<b class="wc-name" style="${type}">${escapeHtml(name)}</b></span>`}`;
|
|
425
|
-
} else if (kind
|
|
426
|
-
// a field
|
|
427
|
-
//
|
|
428
|
-
//
|
|
429
|
-
const
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
contrast: pick([4, 6]),
|
|
437
|
-
brightness: pick([-0.15, -0.1, -0.05]),
|
|
438
|
-
offset: [Math.round(r() * 4000) / 100, Math.round(r() * 4000) / 100],
|
|
439
|
-
colors: [lo, hi],
|
|
440
|
-
background: bg,
|
|
441
|
-
font,
|
|
442
|
-
quiet: { radius: 0.56, depth: 1 },
|
|
443
|
-
};
|
|
444
|
-
attrs = ` data-shader="${escapeHtml(JSON.stringify(cfg))}"`;
|
|
445
|
-
style += `;--bg:${bg};--fg:${fg}`;
|
|
446
|
-
const mono = MONO ? `font-family:${MONO[0]};font-weight:${MONO[1]};letter-spacing:${MONO[2]};text-transform:${MONO[3]}` : type;
|
|
447
|
-
inner = `${noiseStill(cfg, font)}<canvas class="wc-fx" aria-hidden="true"></canvas><span class="wc-lockup is-stack">${svg()}<b class="wc-name" style="${mono}">${escapeHtml(name)}</b><i style="font-family:${font}">${escapeHtml(line)}</i></span>`;
|
|
383
|
+
} else if (isField(kind)) {
|
|
384
|
+
// a field card (./fields.js): an effects-astro field drawn live, started on screen like a shader card, the lockup
|
|
385
|
+
// over its quiet middle; what shows before it starts is the field's still (a CSS background, or markup under
|
|
386
|
+
// the canvas)
|
|
387
|
+
const field = FIELDS[kind];
|
|
388
|
+
const f = field.deal({ pick, r, accent, mono: MONO });
|
|
389
|
+
attrs = ` data-shader="${escapeHtml(JSON.stringify({ effect: field.effect, ...f.cfg }))}"`;
|
|
390
|
+
style += `;--bg:${f.ground};--fg:${f.ink}${f.still ? `;background:${f.still}` : ''}`;
|
|
391
|
+
const face = f.mono ? (MONO?.[0] ?? MONO_FALLBACK) : null;
|
|
392
|
+
const nameType = f.mono && MONO ? `font-family:${MONO[0]};font-weight:${MONO[1]};letter-spacing:${MONO[2]};text-transform:${MONO[3]}` : type;
|
|
393
|
+
inner = `${f.under ?? ''}<canvas class="wc-fx" aria-hidden="true"></canvas><span class="wc-lockup is-stack">${svg()}<b class="wc-name" style="${nameType}">${escapeHtml(name)}</b><i${face ? ` style="font-family:${face}"` : ''}>${escapeHtml(line)}</i></span>`;
|
|
448
394
|
} else if (kind === 'tone') {
|
|
449
395
|
const [bg, tint] = pick(TONES);
|
|
450
396
|
style += `;--bg:${bg};--accent:${tint}`;
|
|
@@ -460,7 +406,7 @@ export function lookbook(options) {
|
|
|
460
406
|
const plain = `<span class="wc-plain">${mark}<b class="wc-name">${escapeHtml(name)}</b></span>`;
|
|
461
407
|
const [w, h] = RATIO[kind].split('/').map(Number);
|
|
462
408
|
return {
|
|
463
|
-
html: `<a class="wc wc-${kind}${isLook(kind) ? ' wx' : ''}" href="${href(m)}" style="${style}"${attrs}>${inner}${plain}<span class="wc-tag">${escapeHtml(m.name)} <em>→</em></span></a>`,
|
|
409
|
+
html: `<a class="wc wc-${kind}${isLook(kind) ? ' wx' : isField(kind) ? ' wc-field' : ''}" href="${href(m)}" style="${style}"${attrs}>${inner}${plain}<span class="wc-tag">${escapeHtml(m.name)} <em>→</em></span></a>`,
|
|
464
410
|
h: h / w,
|
|
465
411
|
brand,
|
|
466
412
|
used: { kinds: [kind], names: [name], lines: [line], photos: photo ? [photo] : [] },
|