@logomarks/lookbook 0.6.0 → 0.6.1
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 +110 -0
- package/README.md +1 -1
- package/package.json +2 -2
- package/src/fields.d.ts +12 -2
- package/src/fields.js +240 -2
- package/src/glass.d.ts +1 -1
- package/src/glass.js +229 -63
- package/src/live.d.ts +4 -2
- package/src/live.js +45 -11
- package/src/looks/blur.d.ts +16 -0
- package/src/looks/blur.js +71 -0
- package/src/looks/exposure.js +139 -0
- package/src/looks/index.d.ts +10 -0
- package/src/looks/index.js +73 -0
- package/src/looks/tone.d.ts +20 -0
- package/src/looks/tone.js +132 -0
- package/src/styles/wall-looks.css +859 -1
- package/src/styles/wall.css +13 -0
- package/src/wall.js +8 -5
package/src/glass.js
CHANGED
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
* lit card, growing from the bottom up, then leaning gently. Both are our own effects after reactdrops.dev's Liquid
|
|
9
9
|
* Glass Logo and Glass Slab Logo (the idea, not their code: their licence forbids reuse in a component library).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Both refract a photo from the glass set (`GLASS_PHOTOS`) behind them (2026-11-28, the owner: "proper refraction …
|
|
12
|
+
* look like actual glass"): liquid glass is the mark's own shape in clear, lightly tinted glass that holds, its top
|
|
13
|
+
* swelling slowly, the light drifting; glass slabs are tinted discs, each a thick lens. Each card's still is the photo
|
|
14
|
+
* (a CSS background) and markup under the canvas, laid exactly where the effect draws the mark: the photo through the
|
|
15
|
+
* mark, magnified and tinted, with its rim and lip (liquid glass), or through tinted bands (glass slabs). The
|
|
13
16
|
* runner reads the mark from the still (`data-m`) and hands it to the effect, so the paths are in the page once.
|
|
14
17
|
*
|
|
15
18
|
* Pure: everything comes from the card's seeded random, so the page and its script deal identical cards.
|
|
@@ -18,6 +21,9 @@
|
|
|
18
21
|
import { escapeHtml } from '@arraypress/text';
|
|
19
22
|
import { dropLayout } from '@arraypress/effects-astro/runtime/glass-drop-plan';
|
|
20
23
|
import { sliceTints, stackLayout } from '@arraypress/effects-astro/runtime/glass-stack';
|
|
24
|
+
import { dripAnchors, dripPlan, dripsAtRest } from '@arraypress/effects-astro/runtime/paint-drip';
|
|
25
|
+
import { shapes, rings } from '@logomarks/core/svg';
|
|
26
|
+
import { pixelCoverage } from '@logomarks/core/edit';
|
|
21
27
|
import { markBox, inkShare, opticalScale } from './marks.js';
|
|
22
28
|
|
|
23
29
|
/** A glass card's shape, width over height (4:5, like the field cards). */
|
|
@@ -56,85 +62,244 @@ function still(centre, edge, body, extra = '') {
|
|
|
56
62
|
|
|
57
63
|
/* ---------- Liquid glass (effects-astro's glassDrop) ---------- */
|
|
58
64
|
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
/** What the glass cards refract: the glass set's colourful abstracts (fluid colour, foil, holo, ribbons, waves, sunsets,
|
|
66
|
+
* spheres), where bending and magnifying shows; never a flat ground (the owner, 2026-11-28: "proper refraction … look
|
|
67
|
+
* like actual glass"). */
|
|
68
|
+
export const GLASS_PHOTOS = /\/(fluid|liquid|ribbon|bluewaves|sunset|dusk|spheres|swirl)-\d+\.webp$/;
|
|
69
|
+
|
|
70
|
+
/** How bright the photo shows round the glass (the glass reads over it, the name under it). */
|
|
71
|
+
const DIM = 0.8;
|
|
72
|
+
|
|
73
|
+
/** A card's still background: the photo, dimmed as the effect dims it, covering the card. */
|
|
74
|
+
const photoStill = (src, dim) => `linear-gradient(rgba(0,0,0,${f2(1 - dim)}),rgba(0,0,0,${f2(1 - dim)})),center / cover no-repeat url('${src}')`;
|
|
75
|
+
|
|
76
|
+
/** How soft the photo is round the glass (the effect's `soften`, a mip bias): the glass, a lens, shows it sharp. */
|
|
77
|
+
const SOFT = 2.2;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The card's photo, soft and dimmed, laid over the card in a still's box units (the card's own CSS background stays
|
|
81
|
+
* under it, for the moment before the still's SVG paints).
|
|
82
|
+
*
|
|
83
|
+
* @param href The photo.
|
|
84
|
+
* @param card The card's rect in the box's units.
|
|
85
|
+
* @param dim How bright it shows.
|
|
86
|
+
* @param id The blur filter's id.
|
|
87
|
+
*/
|
|
88
|
+
function softPhoto(href, card, dim, id) {
|
|
89
|
+
const img = `<image href="${href}" x="${f2(card.x)}" y="${f2(card.y)}" width="${f2(card.w)}" height="${f2(card.h)}" preserveAspectRatio="xMidYMid slice" />`;
|
|
90
|
+
const sd = Math.round(card.h / 160);
|
|
91
|
+
return `<filter id="${id}" x="-5%" y="-5%" width="110%" height="110%"><feGaussianBlur stdDeviation="${sd}"/></filter><g filter="url(#${id})">${img}</g><rect x="${f2(card.x)}" y="${f2(card.y)}" width="${f2(card.w)}" height="${f2(card.h)}" fill="#000" opacity="${f2(1 - dim)}"/>`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The glass mark as a still, over the card's photo: inside the mark the photo again, magnified about the mark's middle
|
|
96
|
+
* (the lens the glass is), tinted, with a dark band inside the rim, a lit lip on the light's side, a highlight swept
|
|
97
|
+
* across the top, and the glass's shadow cast away from the light. All in the 512 box the effect draws the mark in.
|
|
98
|
+
*
|
|
99
|
+
* @param o `uid`, the mark's `paths`, the photo `src`, the box (`centre`, `edge`, shares of the card's height), the
|
|
100
|
+
* `tint`, the light's angle `light` (degrees, 0 right, 90 top), and how much it magnifies (`k`).
|
|
101
|
+
*/
|
|
102
|
+
function glassStill({ uid, paths, src, centre, edge, tint, light, k, dim }) {
|
|
103
|
+
// the card in the box's units: the box's top left in card units, scaled to 512 an edge
|
|
104
|
+
const x0 = centre.x * CARD - edge / 2;
|
|
105
|
+
const y0 = centre.y - edge / 2;
|
|
106
|
+
const u = 512 / edge;
|
|
107
|
+
const card = { x: -x0 * u, y: -y0 * u, w: CARD * u, h: u };
|
|
108
|
+
const photo = `<image href="${src}" x="${f2(card.x)}" y="${f2(card.y)}" width="${f2(card.w)}" height="${f2(card.h)}" preserveAspectRatio="xMidYMid slice" />`;
|
|
109
|
+
const a = (light * Math.PI) / 180;
|
|
110
|
+
const lx = Math.cos(a);
|
|
111
|
+
const ly = -Math.sin(a); // screen y is down
|
|
112
|
+
const d = 12; // the shadow's reach, box units
|
|
113
|
+
const id = (x) => `${uid}-${x}`;
|
|
114
|
+
return [
|
|
115
|
+
// behind: the photo soft and dimmed, as the effect shows it round the glass
|
|
116
|
+
softPhoto(src, card, dim, id('gb')),
|
|
117
|
+
'<defs>',
|
|
118
|
+
// the mark's shape, as a mask that keeps its even-odd holes
|
|
119
|
+
`<mask id="${id('gk')}" maskUnits="userSpaceOnUse" x="-64" y="-64" width="640" height="640"><g data-m fill="#fff">${paths}</g></mask>`,
|
|
120
|
+
// the rim: a dark band just inside the edge, a white hairline at the very edge, and the bevel's highlight
|
|
121
|
+
`<filter id="${id('gr')}" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur in="SourceAlpha" stdDeviation="8" result="b"/>`,
|
|
122
|
+
`<feComposite in="SourceAlpha" in2="b" operator="arithmetic" k2="1" k3="-1" result="rim"/>`,
|
|
123
|
+
`<feColorMatrix in="rim" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.1 0" result="band"/>`,
|
|
124
|
+
`<feMorphology in="SourceAlpha" operator="erode" radius="2.2" result="in"/>`,
|
|
125
|
+
`<feComposite in="SourceAlpha" in2="in" operator="out" result="edge"/>`,
|
|
126
|
+
`<feColorMatrix in="edge" type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.75 0" result="hair"/>`,
|
|
127
|
+
`<feSpecularLighting in="b" surfaceScale="11" specularConstant="1.3" specularExponent="26" lighting-color="#fff" result="spec"><feDistantLight azimuth="${Math.round(-light)}" elevation="36"/></feSpecularLighting>`,
|
|
128
|
+
`<feComposite in="spec" in2="SourceAlpha" operator="in" result="lit"/>`,
|
|
129
|
+
`<feMerge><feMergeNode in="band"/><feMergeNode in="hair"/><feMergeNode in="lit"/></feMerge></filter>`,
|
|
130
|
+
`<filter id="${id('gs')}" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="10"/></filter>`,
|
|
131
|
+
'</defs>',
|
|
132
|
+
// the shadow, cast away from the light
|
|
133
|
+
`<g filter="url(#${id('gs')})" opacity="0.4" transform="translate(${f2(-lx * d)} ${f2(-ly * d)})"><g fill="#000">${paths}</g></g>`,
|
|
134
|
+
// the photo through the glass: sharp, magnified about the box's middle, tinted, a touch brighter than the ground
|
|
135
|
+
`<g mask="url(#${id('gk')})"><g transform="translate(256 256) scale(${f2(k)}) translate(-256 -256)">${photo}</g>`,
|
|
136
|
+
`<rect x="-64" y="-64" width="640" height="640" fill="${tint}" opacity="0.22" style="mix-blend-mode:multiply"/>`,
|
|
137
|
+
`<rect x="-64" y="-64" width="640" height="640" fill="#fff" opacity="0.06"/></g>`,
|
|
138
|
+
// the rim
|
|
139
|
+
`<g filter="url(#${id('gr')})"><g fill="#fff">${paths}</g></g>`,
|
|
140
|
+
].join('');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Liquid glass cards' tints (the glass takes the colour as light through tinted glass does) and the name's ink. */
|
|
144
|
+
const dropTintsOf = (accent) => ['#FFFFFF', '#FFFFFF', '#DFF4FF', accent, '#FFD9C7', '#E9E2FF'];
|
|
69
145
|
|
|
70
|
-
/** glassdrop: a drop of liquid glass
|
|
71
|
-
|
|
72
|
-
|
|
146
|
+
/** glassdrop: a drop of liquid glass lands and spreads into the mark's own shape in clear glass over a photo, which it
|
|
147
|
+
* bends and magnifies; the glass holds, its top swelling slowly like liquid, the light drifting over it. */
|
|
148
|
+
function glassdrop({ pick, r, accent, paths, uid, glass }) {
|
|
149
|
+
const src = glass(GLASS_PHOTOS);
|
|
150
|
+
const tint = pick(dropTintsOf(accent));
|
|
73
151
|
const k = growOf(paths);
|
|
74
|
-
const
|
|
152
|
+
const light = Math.round(between(r, 105, 150));
|
|
75
153
|
const cfg = {
|
|
76
|
-
form,
|
|
154
|
+
form: 'mark',
|
|
155
|
+
rest: 'glass',
|
|
156
|
+
loop: false,
|
|
77
157
|
area: AREA,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
158
|
+
size: 0.8,
|
|
159
|
+
markScale: Math.min(0.92, 0.78 * k),
|
|
160
|
+
restScale: 1,
|
|
161
|
+
background: '#050505',
|
|
162
|
+
color: tint,
|
|
163
|
+
light: '#FFFFFF',
|
|
164
|
+
backdrop: src,
|
|
165
|
+
dim: DIM,
|
|
166
|
+
tint: between(r, 0.35, 0.6),
|
|
167
|
+
depth: between(r, 1.1, 1.4),
|
|
168
|
+
bevel: between(r, 0.12, 0.16),
|
|
169
|
+
magnify: between(r, 0.1, 0.14),
|
|
170
|
+
dispersion: between(r, 0.9, 1.3),
|
|
171
|
+
highlights: 1.1,
|
|
172
|
+
caustics: 1,
|
|
173
|
+
bloom: 0.2,
|
|
174
|
+
ripples: 0.8,
|
|
175
|
+
shadow: 0.7,
|
|
176
|
+
soften: SOFT,
|
|
177
|
+
flow: between(r, 0.6, 1),
|
|
178
|
+
lightAngle: light,
|
|
179
|
+
lightDrift: 26,
|
|
180
|
+
delay: between(r, 0.2, 0.7),
|
|
89
181
|
};
|
|
90
182
|
const at = dropLayout(cfg, CARD);
|
|
91
|
-
const under = still(at.centre, at.
|
|
92
|
-
return { cfg, ground, ink, under };
|
|
183
|
+
const under = still(at.centre, at.mark, glassStill({ uid, paths, src, centre: at.centre, edge: at.mark, tint, light, k: 1.12 + cfg.magnify, dim: DIM }), ' overflow="visible"');
|
|
184
|
+
return { cfg, ground: '#050505', ink: '#F4F3EF', under, still: photoStill(src, DIM) };
|
|
93
185
|
}
|
|
94
186
|
|
|
95
187
|
/* ---------- Glass slabs (effects-astro's glassStack) ---------- */
|
|
96
188
|
|
|
97
|
-
/** Glass slab cards'
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
{ colors: ['#
|
|
101
|
-
{ colors: ['#
|
|
102
|
-
{ colors: ['#
|
|
103
|
-
{ colors: ['#
|
|
104
|
-
{ colors: ['#
|
|
189
|
+
/** Glass slab cards' plates, back to front, and the colour their thickness shows (real glass is green-blue through
|
|
190
|
+
* its edge; tinted glass takes its own colour there). */
|
|
191
|
+
const plateInksOf = (accent) => [
|
|
192
|
+
{ colors: ['#EEF8FF', '#DDF0FA', '#CBE6F4'], edge: '#5FD6B8' }, // clear
|
|
193
|
+
{ colors: ['#F4FFE0', '#E6FFB8', accent], edge: '#9BE36A' }, // acid
|
|
194
|
+
{ colors: ['#E8F2FF', '#BFD8FF', '#8FB6FF'], edge: '#4F8BFF' }, // blue
|
|
195
|
+
{ colors: ['#FFF1E6', '#FFD7BA', '#FFB98C'], edge: '#E8925A' }, // amber
|
|
196
|
+
{ colors: ['#F6EEFF', '#E2D2FF', '#C9B0FF'], edge: '#9A7BEA' }, // violet
|
|
105
197
|
];
|
|
106
198
|
|
|
107
|
-
/** glassstack: the mark
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const
|
|
199
|
+
/** glassstack: the mark cut from sheets of thick glass laid one over another, each down and across from the one behind,
|
|
200
|
+
* over a photo it bends and magnifies; the plates slide apart, then drift slowly so the refraction shifts. */
|
|
201
|
+
function glassstack({ pick, r, accent, paths, uid, glass }) {
|
|
202
|
+
const { colors, edge } = pick(plateInksOf(accent));
|
|
203
|
+
const src = glass(GLASS_PHOTOS);
|
|
204
|
+
const plates = pick([2, 3, 3]);
|
|
205
|
+
const k = growOf(paths);
|
|
112
206
|
const cfg = {
|
|
207
|
+
form: 'plates',
|
|
113
208
|
colors,
|
|
209
|
+
edge,
|
|
210
|
+
plates,
|
|
114
211
|
area: AREA,
|
|
115
|
-
logoScale: Math.min(0.
|
|
116
|
-
background:
|
|
117
|
-
light,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
212
|
+
logoScale: Math.min(0.78, 0.64 * k),
|
|
213
|
+
background: '#050505',
|
|
214
|
+
light: '#FFFFFF',
|
|
215
|
+
backdrop: src,
|
|
216
|
+
dim: 0.74,
|
|
217
|
+
soften: SOFT,
|
|
218
|
+
spread: plates === 2 ? 0.09 : 0.07,
|
|
219
|
+
thickness: between(r, 0.04, 0.055),
|
|
220
|
+
bevel: 0.035,
|
|
221
|
+
density: between(r, 0.5, 0.7),
|
|
222
|
+
bend: between(r, 0.02, 0.028),
|
|
223
|
+
dispersion: between(r, 0.3, 0.5),
|
|
224
|
+
lightAngle: Math.round(between(r, 105, 140)),
|
|
124
225
|
delay: between(r, 0.1, 0.5),
|
|
125
226
|
};
|
|
126
227
|
const at = stackLayout(cfg, CARD);
|
|
127
|
-
// the still: the
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
|
|
228
|
+
// the still: the plates as the effect leaves them, back to front, in the box's units: each plate's edge (the mark in
|
|
229
|
+
// the edge colour, down and across from its face), then its face (the photo through it, sharp and magnified, tinted,
|
|
230
|
+
// with a lit lip and a dark band at the rim)
|
|
231
|
+
const x0 = at.centre.x * CARD - at.edge / 2;
|
|
232
|
+
const y0 = at.centre.y - at.edge / 2;
|
|
233
|
+
const u = 512 / at.edge;
|
|
234
|
+
const card = { x: -x0 * u, y: -y0 * u, w: CARD * u, h: u };
|
|
235
|
+
const photo = `<image href="${src}" x="${f2(card.x)}" y="${f2(card.y)}" width="${f2(card.w)}" height="${f2(card.h)}" preserveAspectRatio="xMidYMid slice" />`;
|
|
236
|
+
const step = cfg.spread * 512;
|
|
237
|
+
const side = { x: cfg.thickness * 512 * 0.55, y: cfg.thickness * 512 };
|
|
238
|
+
const tints = sliceTints(colors, plates);
|
|
239
|
+
const rim = `<filter id="${uid}-pr" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur in="SourceAlpha" stdDeviation="6" result="b"/><feComposite in="SourceAlpha" in2="b" operator="arithmetic" k2="1" k3="-1" result="rim"/><feColorMatrix in="rim" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.8 0" result="band"/><feMorphology in="SourceAlpha" operator="erode" radius="1.8" result="in"/><feComposite in="SourceAlpha" in2="in" operator="out" result="edge"/><feColorMatrix in="edge" type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.8 0" result="hair"/><feMerge><feMergeNode in="band"/><feMergeNode in="hair"/></feMerge></filter>`;
|
|
240
|
+
const layers = Array.from({ length: plates }, (_, i) => {
|
|
241
|
+
const t = i - (plates - 1) / 2;
|
|
242
|
+
const dx = t * step;
|
|
243
|
+
const dy = t * step;
|
|
244
|
+
const move = `translate(${f2(dx)} ${f2(dy)})`;
|
|
245
|
+
const edgeLayers = [0.5, 1].map((f) => `<g transform="translate(${f2(dx + side.x * f)} ${f2(dy + side.y * f)})" fill="${edge}" opacity="0.85">${paths}</g>`).join('');
|
|
246
|
+
return `${edgeLayers}<mask id="${uid}-p${i}" maskUnits="userSpaceOnUse" x="-128" y="-128" width="768" height="768"><g transform="${move}"${i === plates - 1 ? ' data-m' : ''} fill="#fff">${paths}</g></mask><g mask="url(#${uid}-p${i})"><g transform="translate(256 256) scale(1.12) translate(-256 -256)">${photo}</g><rect x="-128" y="-128" width="768" height="768" fill="${hex(tints[i])}" opacity="0.5" style="mix-blend-mode:multiply"/><rect x="-128" y="-128" width="768" height="768" fill="#fff" opacity="0.07"/></g><g transform="${move}" filter="url(#${uid}-pr)"><g fill="#fff">${paths}</g></g>`;
|
|
247
|
+
}).join('');
|
|
248
|
+
const body = `${softPhoto(src, card, 0.74, `${uid}-gb`)}<defs>${rim}</defs>${layers}`;
|
|
249
|
+
return { cfg, ground: '#050505', ink: '#F4F3EF', under: still(at.centre, at.edge, body, ' overflow="visible"'), still: photoStill(src, 0.74) };
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* ---------- Paint drip (effects-astro's paintDrip, after the owner's spray-stencil reference, 2026-11-28) ---------- */
|
|
253
|
+
|
|
254
|
+
/** The grid the drips' anchors are read on, cells across the mark's 512 canvas. */
|
|
255
|
+
const DRIP_GRID = 96;
|
|
256
|
+
|
|
257
|
+
/** Paint cards' colours: ground, the paint (the name takes it too). */
|
|
258
|
+
const paintInksOf = (accent) => [
|
|
259
|
+
{ ground: '#85857F', paint: accent }, // acid on concrete
|
|
260
|
+
{ ground: '#141414', paint: '#FF4A1C' }, // signal on black
|
|
261
|
+
{ ground: '#B9B6AE', paint: '#FF2E88' }, // pink on pale concrete
|
|
262
|
+
{ ground: '#1438E0', paint: '#F4F3EF' }, // white on cobalt
|
|
263
|
+
{ ground: '#2A2B2E', paint: '#4FE3FF' }, // cyan on charcoal
|
|
264
|
+
{ ground: accent, paint: '#111111' }, // black on acid
|
|
265
|
+
];
|
|
266
|
+
|
|
267
|
+
/** paintdrip: the mark sprayed in paint, wet paint pooling on its lower edges and running down in drips that slow, stop
|
|
268
|
+
* and dry, then fade and run again. */
|
|
269
|
+
function paintdrip({ pick, r, accent, paths }) {
|
|
270
|
+
const { ground, paint } = pick(paintInksOf(accent));
|
|
271
|
+
// the mark high, so the drips have room above the name
|
|
272
|
+
const centre = { x: 0.5, y: 0.35 };
|
|
273
|
+
const edge = Math.min(0.46, 0.4 * growOf(paths));
|
|
274
|
+
const cfg = {
|
|
275
|
+
color: paint,
|
|
276
|
+
background: ground,
|
|
277
|
+
box: { x: centre.x, y: centre.y, size: edge },
|
|
278
|
+
drips: pick([2, 3, 3, 4]),
|
|
279
|
+
volume: between(r, 0.85, 1.15),
|
|
280
|
+
floor: 0.73,
|
|
281
|
+
glow: between(r, 0.4, 0.7),
|
|
282
|
+
spray: between(r, 0.45, 0.75),
|
|
283
|
+
hold: between(r, 2.2, 3),
|
|
284
|
+
seed: Math.round(r() * 1000) / 100,
|
|
285
|
+
};
|
|
286
|
+
// where the drips hang, read off the mark's outer lower silhouette here (its coverage on a grid of the 512 canvas),
|
|
287
|
+
// handed to the effect so the canvas runs the same drips the still shows at full length
|
|
288
|
+
const n = DRIP_GRID;
|
|
289
|
+
const list = shapes(paths);
|
|
290
|
+
const cover = list.length
|
|
291
|
+
? pixelCoverage(
|
|
292
|
+
list.map((sh) => ({ rings: rings(sh.segs), evenodd: sh.evenodd })),
|
|
293
|
+
{ cols: n, rows: n, cell: 512 / n, x0: 0, y0: 0 },
|
|
294
|
+
)
|
|
295
|
+
: new Float32Array(n * n);
|
|
296
|
+
const round4 = (v) => Math.round(v * 1e4) / 1e4;
|
|
297
|
+
const anchors = dripAnchors(cover, n, n, cfg.drips, cfg.seed).map((a) => ({ x: round4(a.x), y: round4(a.y), room: round4(a.room), open: a.open }));
|
|
298
|
+
const at = { left: centre.x * CARD - edge / 2, top: centre.y - edge / 2, size: edge };
|
|
299
|
+
const rest = anchors.length ? dripsAtRest(dripPlan(anchors, at, cfg)) : '';
|
|
300
|
+
// the still: the mark, and the drips at full length (the loop's resting frame), in the 512 box's units
|
|
301
|
+
const drips = rest ? `<path fill="${paint}" transform="scale(${f2(512 / edge)}) translate(${-at.left} ${-at.top})" d="${rest}" />` : '';
|
|
302
|
+
return { cfg: { ...cfg, anchors }, ground, ink: paint, under: still(centre, edge, `${drips}<g data-m fill="${paint}">${paths}</g>`, ' overflow="visible"') };
|
|
138
303
|
}
|
|
139
304
|
|
|
140
305
|
/* ---------- the table ---------- */
|
|
@@ -144,6 +309,7 @@ function glassstack({ pick, r, accent, paths, uid }) {
|
|
|
144
309
|
export const GLASS = {
|
|
145
310
|
glassdrop: { effect: 'glass-drop', label: 'Liquid glass', deal: glassdrop },
|
|
146
311
|
glassstack: { effect: 'glass-stack', label: 'Glass slabs', deal: glassstack },
|
|
312
|
+
paintdrip: { effect: 'paint-drip', label: 'Paint drip', deal: paintdrip },
|
|
147
313
|
};
|
|
148
314
|
|
|
149
315
|
/** Whether a kind is a glass card. */
|
package/src/live.d.ts
CHANGED
|
@@ -67,6 +67,8 @@ export declare function markSource(card: Element): string | null;
|
|
|
67
67
|
* @returns Starts a card; what it returns stops it (or gives up its place in the queue).
|
|
68
68
|
*/
|
|
69
69
|
export declare function shaders(cap?: number): (card: HTMLElement) => Stop;
|
|
70
|
+
/** How many costly looks run at once: 1 on a phone or a 4-core machine, 4 on a mid one, 10 with 8 cores or more. */
|
|
71
|
+
export declare function heavyCap(): number;
|
|
70
72
|
/** What `liveCards` watches and how. */
|
|
71
73
|
export type LiveOptions = {
|
|
72
74
|
/** Where the cards are found (the document). */
|
|
@@ -77,9 +79,9 @@ export type LiveOptions = {
|
|
|
77
79
|
plain?: () => boolean;
|
|
78
80
|
/** Starts a `[data-smoke]` card (a sponsor's); `smoke(card)` by default. */
|
|
79
81
|
smoke?: (card: HTMLElement) => Stop;
|
|
80
|
-
/** How many costly looks (`data-anim="heavy"`) move at once
|
|
82
|
+
/** How many costly looks (`data-anim="heavy"`) move at once (`heavyCap()`: 1 on a phone, 4 on a mid machine, 10 with 8+ cores). */
|
|
81
83
|
heavy?: number;
|
|
82
|
-
/** How many shader and
|
|
84
|
+
/** How many shader, gradient and field cards run at once (all: they share one WebGL context). */
|
|
83
85
|
gl?: number;
|
|
84
86
|
/** How near the screen a card starts (`150px`). */
|
|
85
87
|
margin?: string;
|
package/src/live.js
CHANGED
|
@@ -28,9 +28,16 @@ const FIELD_EFFECTS = {
|
|
|
28
28
|
'fluted-glow': () => import('@arraypress/effects-astro/runtime/fluted-glow').then((m) => m.flutedGlow),
|
|
29
29
|
'fluid-folds': () => import('@arraypress/effects-astro/runtime/fluid-folds').then((m) => m.fluidFolds),
|
|
30
30
|
'fluted-bokeh': () => import('@arraypress/effects-astro/runtime/fluted-bokeh').then((m) => m.flutedBokeh),
|
|
31
|
+
'photo-bokeh': () => import('@arraypress/effects-astro/runtime/photo-bokeh').then((m) => m.photoBokeh),
|
|
32
|
+
'lens-flare': () => import('@arraypress/effects-astro/runtime/lens-flare').then((m) => m.lensFlare),
|
|
33
|
+
caustics: () => import('@arraypress/effects-astro/runtime/caustics').then((m) => m.caustics),
|
|
34
|
+
'rain-on-glass': () => import('@arraypress/effects-astro/runtime/rain-on-glass').then((m) => m.rainOnGlass),
|
|
35
|
+
'sun-wall': () => import('@arraypress/effects-astro/runtime/sun-wall').then((m) => m.sunWall),
|
|
31
36
|
// the glass cards (./glass.js): the mark itself in glass
|
|
32
37
|
'glass-drop': () => import('@arraypress/effects-astro/runtime/glass-drop').then((m) => m.glassDrop),
|
|
33
38
|
'glass-stack': () => import('@arraypress/effects-astro/runtime/glass-stack').then((m) => m.glassStack),
|
|
39
|
+
// the paint card (./glass.js): the mark sprayed, its paint running
|
|
40
|
+
'paint-drip': () => import('@arraypress/effects-astro/runtime/paint-drip').then((m) => m.paintDrip),
|
|
34
41
|
};
|
|
35
42
|
|
|
36
43
|
/**
|
|
@@ -74,6 +81,7 @@ import { fitNames, fitWatch } from './fit.js';
|
|
|
74
81
|
/** Every card's name fitted to its card (./fit.js): `fitName`, `fitNames`, `fitWatch`. */
|
|
75
82
|
export { fitName, fitNames, fitWatch } from './fit.js';
|
|
76
83
|
import { budget } from '@arraypress/effects-astro/runtime/budget';
|
|
84
|
+
import { shareContexts } from '@arraypress/effects-astro/runtime/shared-gl';
|
|
77
85
|
|
|
78
86
|
/** The smoke's greys: pale on a dark ground, dark on white (Ink's `dark`). */
|
|
79
87
|
export const SMOKE_GREYS = {
|
|
@@ -103,15 +111,17 @@ export function smoke(el, options = {}) {
|
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
/**
|
|
106
|
-
* A starter for the shader, gradient and
|
|
107
|
-
* shaders or
|
|
108
|
-
*
|
|
109
|
-
* still background.
|
|
114
|
+
* A starter for the shader, gradient and field cards: each card's live background (its `data-shader` config, Paper's
|
|
115
|
+
* shaders or an effects-astro field). They share one WebGL context (effects-astro's `shareContexts`), so every card on
|
|
116
|
+
* screen runs; `cap` can still limit them. Without WebGL, or with a bad config, the card keeps its still background.
|
|
110
117
|
*
|
|
111
|
-
* @param cap The most running at once (
|
|
118
|
+
* @param cap The most running at once (all of them).
|
|
112
119
|
* @returns Starts a card; what it returns stops it (or gives up its place in the queue).
|
|
113
120
|
*/
|
|
114
|
-
export function shaders(cap =
|
|
121
|
+
export function shaders(cap = Infinity) {
|
|
122
|
+
// every card draws in one shared WebGL context and copies its frame into its own canvas (effects-astro's
|
|
123
|
+
// shared-gl), so the browser's cap of about sixteen contexts no longer limits how many run: all on screen do
|
|
124
|
+
shareContexts();
|
|
115
125
|
const take = budget(cap);
|
|
116
126
|
return (card) => {
|
|
117
127
|
try {
|
|
@@ -152,11 +162,25 @@ function release(card) {
|
|
|
152
162
|
old.replaceWith(old.cloneNode(false));
|
|
153
163
|
}
|
|
154
164
|
|
|
165
|
+
/**
|
|
166
|
+
* How many costly looks run at once: one on a phone or a small machine, four on a mid one, ten on a desktop with eight
|
|
167
|
+
* cores or more (a screenful of cards; their starts are staggered).
|
|
168
|
+
*
|
|
169
|
+
* @returns The cap.
|
|
170
|
+
*/
|
|
171
|
+
export function heavyCap() {
|
|
172
|
+
const cores = (typeof navigator !== 'undefined' && navigator.hardwareConcurrency) || 8;
|
|
173
|
+
const phone = typeof matchMedia === 'function' && matchMedia('(max-width: 700px)').matches;
|
|
174
|
+
if (phone || cores <= 4) return 1;
|
|
175
|
+
return cores >= 8 ? 10 : 4;
|
|
176
|
+
}
|
|
177
|
+
|
|
155
178
|
const LIVE = '[data-shader], [data-smoke], [data-anim]';
|
|
156
179
|
|
|
157
180
|
/**
|
|
158
|
-
* Runs a wall's live cards: a drawn look's motion while near (from its first frame each time; the costly ones
|
|
159
|
-
* time), a shader or
|
|
181
|
+
* Runs a wall's live cards: a drawn look's motion while near (from its first frame each time; the costly ones a few at a
|
|
182
|
+
* time, `heavyCap`), a shader, gradient or field card's background (every one on screen: they share one WebGL context),
|
|
183
|
+
* a promo card's smoke. Nothing runs off screen.
|
|
160
184
|
*
|
|
161
185
|
* @param options Where to look and how much may run at once.
|
|
162
186
|
*/
|
|
@@ -169,13 +193,23 @@ export function liveCards(options = {}) {
|
|
|
169
193
|
const watching = new Map();
|
|
170
194
|
/** The costly looks (liquid chrome, puff, the point cloud, the laser, the slit-scan) take turns; the others keep their
|
|
171
195
|
* still until one leaves the screen. */
|
|
172
|
-
const heavy = budget(options.heavy ?? (
|
|
173
|
-
const shader = shaders(options.gl ??
|
|
196
|
+
const heavy = budget(options.heavy ?? heavyCap());
|
|
197
|
+
const shader = shaders(options.gl ?? Infinity);
|
|
174
198
|
const live = (card) => () => {
|
|
175
199
|
card.classList.add('is-live');
|
|
176
200
|
return () => card.classList.remove('is-live');
|
|
177
201
|
};
|
|
178
|
-
|
|
202
|
+
/** A costly look starts a moment after its turn comes, each a little later than the last, so they don't all begin
|
|
203
|
+
* (and peak) on the same frame. */
|
|
204
|
+
let order = 0;
|
|
205
|
+
const staggered = (card) => () => {
|
|
206
|
+
const timer = setTimeout(() => card.classList.add('is-live'), (order++ % 6) * 160);
|
|
207
|
+
return () => {
|
|
208
|
+
clearTimeout(timer);
|
|
209
|
+
card.classList.remove('is-live');
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
const motion = (card) => (card.dataset.anim !== 'heavy' || always(card) ? live(card)() : heavy(card, staggered(card)));
|
|
179
213
|
const start = (card) => () => {
|
|
180
214
|
if (card.dataset.anim !== undefined) return motion(card);
|
|
181
215
|
if (card.dataset.shader) return shader(card);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @logomarks/lookbook/looks/blur
|
|
3
|
+
*
|
|
4
|
+
* The Lookbook's long-exposure set (2026-11-28): smear (a portrait dragged into light streaks, left, right or up) and
|
|
5
|
+
* defocus (a portrait drifting out of focus and back), the lockup crisp in the middle.
|
|
6
|
+
*/
|
|
7
|
+
import { type LookCtx, type LookOut } from './kit.js';
|
|
8
|
+
/** The portraits that take a long exposure: silhouettes, rim lights and the off-focus ones. */
|
|
9
|
+
export declare const EXPOSED: RegExp;
|
|
10
|
+
/** How many dragged copies a smear lays over the portrait. */
|
|
11
|
+
export declare const COPIES: number;
|
|
12
|
+
/** The long-exposure set's looks. */
|
|
13
|
+
export declare const BLUR: {
|
|
14
|
+
smear: (c: LookCtx) => LookOut;
|
|
15
|
+
defocus: (c: LookCtx) => LookOut;
|
|
16
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @logomarks/lookbook/looks/blur
|
|
3
|
+
*
|
|
4
|
+
* The Lookbook's long-exposure set (2026-11-28; the owner's reference of a silhouette whose face trails horizontal light
|
|
5
|
+
* streaks, "an animation for portraits that slowly blurs/motion blurs"): smear and defocus, on the silhouette, rim-light
|
|
6
|
+
* and off-focus portraits. Same rules as ./index.js (pure HTML strings from the card's seeded random, per-card values as
|
|
7
|
+
* custom properties in `style`, ids under the card's uid, motion in CSS only and only while `is-live`, the still styles
|
|
8
|
+
* the final frame); the styles are a block at the end of wall-looks.css.
|
|
9
|
+
*
|
|
10
|
+
* - smear: the portrait sharp, and over it five copies of it pushed one way in steps, each fainter and blurred along the
|
|
11
|
+
* push only (an SVG filter: `feGaussianBlur stdDeviation="N 0"`), so the head and the light behind it drag into
|
|
12
|
+
* streaks like a long exposure. A dark silhouette on light drags dark (`darken`), a rim-lit face on dark drags its light
|
|
13
|
+
* (`lighten`). The push is dealt left, right or up. While live the trail draws in and stretches out again (8 s, eased);
|
|
14
|
+
* the still is the trail at full stretch. The mark and the name sit crisp in the middle, one line.
|
|
15
|
+
* - defocus: the portrait slowly drifts out of focus and back, the lockup sharp over it; the still is in focus.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { escapeHtml } from '@arraypress/text';
|
|
19
|
+
import { def, mk, pickOf } from './kit.js';
|
|
20
|
+
import { sansEms } from './studio.js';
|
|
21
|
+
|
|
22
|
+
/** The portraits that take a long exposure: silhouettes, rim lights and the off-focus ones. */
|
|
23
|
+
export const EXPOSED = /\/(silhouette|rimlight|offfocus)-\d+\.webp$/;
|
|
24
|
+
/** How many dragged copies a smear lays over the portrait. */
|
|
25
|
+
export const COPIES = 5;
|
|
26
|
+
|
|
27
|
+
/** The lockup: the mark and the name on one line in the middle, in white (the name sized from its width). */
|
|
28
|
+
const lockup = (c, cls) =>
|
|
29
|
+
`<span class="wx-bllock ${cls}" style="--chars:${sansEms(c.name)}"><span class="wx-blrow"><svg class="wx-blmark" viewBox="0 0 512 512" aria-hidden="true">${mk(`<use href="#${c.uid}-m" />`)}</svg>` +
|
|
30
|
+
`<b class="wc-name" style="${c.type}">${escapeHtml(c.name)}</b></span></span>`;
|
|
31
|
+
|
|
32
|
+
/** smear: the portrait and its dragged copies, each blurred along the push by its own filter, fainter as they go. */
|
|
33
|
+
function smear(c) {
|
|
34
|
+
const pick = pickOf(c);
|
|
35
|
+
const src = c.photo(EXPOSED);
|
|
36
|
+
// a silhouette is dark on light: it drags dark; a rim light or an off-focus face is light on dark: it drags its light
|
|
37
|
+
const blend = /\/silhouette-/.test(src) ? 'darken' : 'lighten';
|
|
38
|
+
const way = pick(['left', 'left', 'right', 'right', 'up']);
|
|
39
|
+
const [dx, dy] = way === 'left' ? [-1, 0] : way === 'right' ? [1, 0] : [0, -1];
|
|
40
|
+
const step = 2.8 + c.r() * 1.4; // percent of the card between copies, at full stretch
|
|
41
|
+
const filters = Array.from({ length: COPIES }, (_, i) => {
|
|
42
|
+
const s = 6 + i * 7;
|
|
43
|
+
return `<filter id="${c.uid}-sm${i}" x="-60%" y="-60%" width="220%" height="220%" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="${dx ? `${s} 0` : `0 ${s}`}" /></filter>`;
|
|
44
|
+
}).join('');
|
|
45
|
+
const copies = Array.from(
|
|
46
|
+
{ length: COPIES },
|
|
47
|
+
(_, i) =>
|
|
48
|
+
`<img src="${src}" alt="" loading="lazy" decoding="async" style="--i:${i + 1};--o:${(0.55 - i * 0.09).toFixed(2)};filter:url(#${c.uid}-sm${i})" />`,
|
|
49
|
+
).join('');
|
|
50
|
+
return {
|
|
51
|
+
style: `;--bg:#07080a;--fg:#fff;--sx:${dx ? (dx * step).toFixed(2) : '0'}%;--sy:${dy ? (dy * step).toFixed(2) : '0'}%;--bl:${blend};--d:-${(c.r() * 6).toFixed(2)}s`,
|
|
52
|
+
attrs: ' data-anim="heavy"',
|
|
53
|
+
inner:
|
|
54
|
+
`<svg class="wx-def" aria-hidden="true"><defs>${def(c)}${filters}</defs></svg>` +
|
|
55
|
+
`<img src="${src}" alt="" loading="lazy" decoding="async" />` +
|
|
56
|
+
`<span class="wx-smtrail is-${way}" aria-hidden="true">${copies}</span>` +
|
|
57
|
+
lockup(c, 'is-smear'),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** defocus: the portrait in focus, then slowly out and back; a soft dark veil so the lockup reads at every stage. */
|
|
62
|
+
function defocus(c) {
|
|
63
|
+
const src = c.photo(EXPOSED);
|
|
64
|
+
return {
|
|
65
|
+
style: `;--bg:#07080a;--fg:#fff;--d:-${(c.r() * 6).toFixed(2)}s`,
|
|
66
|
+
attrs: '',
|
|
67
|
+
inner: `<svg class="wx-def" aria-hidden="true"><defs>${def(c)}</defs></svg>` + `<img class="wx-dfimg" src="${src}" alt="" loading="lazy" decoding="async" />` + lockup(c, 'is-defocus'),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const BLUR = { smear, defocus };
|