shardlight 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/LICENSE +21 -0
- package/README.md +328 -0
- package/dist/baker-BmlWqsXG.d.ts +290 -0
- package/dist/chunk-MARSXMGB.js +263 -0
- package/dist/chunk-MARSXMGB.js.map +1 -0
- package/dist/chunk-W7WG7K5R.js +67 -0
- package/dist/chunk-W7WG7K5R.js.map +1 -0
- package/dist/chunk-ZWPHIC3K.js +1786 -0
- package/dist/chunk-ZWPHIC3K.js.map +1 -0
- package/dist/core/index.d.ts +901 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +1 -0
- package/dist/createShardLight-DTUyJQML.d.ts +56 -0
- package/dist/effects-bjjSnDyP.d.ts +287 -0
- package/dist/r3f/index.d.ts +59 -0
- package/dist/r3f/index.js +164 -0
- package/dist/r3f/index.js.map +1 -0
- package/dist/react/index.d.ts +62 -0
- package/dist/react/index.js +204 -0
- package/dist/react/index.js.map +1 -0
- package/dist/testing/index.d.ts +44 -0
- package/dist/testing/index.js +81 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/three/index.d.ts +13 -0
- package/dist/three/index.js +4 -0
- package/dist/three/index.js.map +1 -0
- package/package.json +121 -0
|
@@ -0,0 +1,901 @@
|
|
|
1
|
+
import { E as EffectConfig, a as ShardLightConfig, P as Preset, S as ShardInput, R as ResolvedLight, B as Baker, L as LayerSource, d as ResolvedLayer, e as BaseShardKinds, f as BaseShardPresets } from '../baker-BmlWqsXG.js';
|
|
2
|
+
export { g as BakeOptions, h as BlobParams, i as BuiltInPresetName, C as ClusterParams, F as FanParams, H as HaloParams, N as NullContextError, j as ResolvedCollapse, k as ResolvedHover, l as ResolvedShard, m as ResolvedSpin, c as ShardBase, n as ShardBlend, o as ShardCollapse, b as ShardConfig, p as ShardHover, q as ShardSpin } from '../baker-BmlWqsXG.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Param schemas. One schema per kind or effect drives types, defaults,
|
|
6
|
+
* validation and (later) shader backends.
|
|
7
|
+
*/
|
|
8
|
+
interface NumberParam {
|
|
9
|
+
type: 'number';
|
|
10
|
+
default: number;
|
|
11
|
+
min?: number;
|
|
12
|
+
max?: number;
|
|
13
|
+
step?: number;
|
|
14
|
+
/** `'px'` costs and widths scale with the bake resolution. */
|
|
15
|
+
unit?: string;
|
|
16
|
+
/** Multiplied by the `rayScale` render option. */
|
|
17
|
+
ray?: boolean;
|
|
18
|
+
label?: string;
|
|
19
|
+
}
|
|
20
|
+
interface AngleParam {
|
|
21
|
+
type: 'angle';
|
|
22
|
+
default: number;
|
|
23
|
+
min?: number;
|
|
24
|
+
max?: number;
|
|
25
|
+
step?: number;
|
|
26
|
+
label?: string;
|
|
27
|
+
}
|
|
28
|
+
interface ColorParam {
|
|
29
|
+
type: 'color';
|
|
30
|
+
default: string;
|
|
31
|
+
label?: string;
|
|
32
|
+
}
|
|
33
|
+
interface BooleanParam {
|
|
34
|
+
type: 'boolean';
|
|
35
|
+
default: boolean;
|
|
36
|
+
label?: string;
|
|
37
|
+
}
|
|
38
|
+
interface EnumParam {
|
|
39
|
+
type: 'enum';
|
|
40
|
+
default: string;
|
|
41
|
+
values: readonly string[];
|
|
42
|
+
label?: string;
|
|
43
|
+
}
|
|
44
|
+
interface ChannelsParam {
|
|
45
|
+
type: 'channels';
|
|
46
|
+
default: readonly string[];
|
|
47
|
+
label?: string;
|
|
48
|
+
}
|
|
49
|
+
type ParamSchema = NumberParam | AngleParam | ColorParam | BooleanParam | EnumParam | ChannelsParam;
|
|
50
|
+
type ParamMap = Record<string, ParamSchema>;
|
|
51
|
+
/** The runtime value type a schema describes. */
|
|
52
|
+
type ValueOfParam<P> = P extends {
|
|
53
|
+
type: 'number' | 'angle';
|
|
54
|
+
} ? number : P extends {
|
|
55
|
+
type: 'color';
|
|
56
|
+
} ? string : P extends {
|
|
57
|
+
type: 'boolean';
|
|
58
|
+
} ? boolean : P extends {
|
|
59
|
+
type: 'channels';
|
|
60
|
+
} ? string[] : P extends {
|
|
61
|
+
type: 'enum';
|
|
62
|
+
values: readonly (infer V)[];
|
|
63
|
+
} ? V : unknown;
|
|
64
|
+
/** Derive the param value type from a schema map: `ParamsOf<typeof dots>`. */
|
|
65
|
+
type ParamsFromSchema<P extends ParamMap> = {
|
|
66
|
+
[K in keyof P]: ValueOfParam<P[K]>;
|
|
67
|
+
};
|
|
68
|
+
type ParamsOf<D> = D extends {
|
|
69
|
+
params: infer P extends ParamMap;
|
|
70
|
+
} ? ParamsFromSchema<P> : Record<string, unknown>;
|
|
71
|
+
|
|
72
|
+
type Ctx2D = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
73
|
+
/**
|
|
74
|
+
* Everything a draw function needs besides the context and its params. The
|
|
75
|
+
* context is already centred and rotated for the shard; draw functions work in
|
|
76
|
+
* local coordinates with the origin at the light's centre.
|
|
77
|
+
*/
|
|
78
|
+
interface DrawEnv {
|
|
79
|
+
/** Half-edge of the bake canvas, in px (`resolution / 2`). */
|
|
80
|
+
unit: number;
|
|
81
|
+
/** Base-pixel scale (`resolution / 1024`), for px-valued parameters. */
|
|
82
|
+
px: number;
|
|
83
|
+
/** The shard's resolved colour. */
|
|
84
|
+
color: string;
|
|
85
|
+
/** Render option that thins every ray on lights shown much larger than tuned. */
|
|
86
|
+
rayScale: number;
|
|
87
|
+
/** Bake canvas edge, in px. */
|
|
88
|
+
size: number;
|
|
89
|
+
/** The shard's own PRNG. Consume it in a fixed order for determinism. */
|
|
90
|
+
rng: () => number;
|
|
91
|
+
/** Format the shard's colour at a given alpha. */
|
|
92
|
+
rgba: (alpha: number) => string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A shard kind: a param schema plus a draw function. The four built-ins are
|
|
96
|
+
* written the same way and go through the same registry, so nothing in core
|
|
97
|
+
* switches on kind names.
|
|
98
|
+
*/
|
|
99
|
+
interface ShardKindDefinition<K extends string = string, P extends ParamMap = ParamMap> {
|
|
100
|
+
kind: K;
|
|
101
|
+
label?: string;
|
|
102
|
+
params: P;
|
|
103
|
+
draw: (ctx: Ctx2D, params: ParamsFromSchema<P>, env: DrawEnv) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Optional composite blur for this shard, in px. Defaults to the shard's
|
|
106
|
+
* `softness` param when present.
|
|
107
|
+
*/
|
|
108
|
+
blur?: (params: ParamsFromSchema<P>, env: DrawEnv) => number;
|
|
109
|
+
/**
|
|
110
|
+
* Optional mask applied to the shard's scratch canvas after drawing (e.g. the
|
|
111
|
+
* variance mask for blob/halo). Receives an untransformed context.
|
|
112
|
+
*/
|
|
113
|
+
mask?: (ctx: Ctx2D, params: ParamsFromSchema<P>, env: DrawEnv, size: number) => void;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** `blob`: a soft round glow. A radial gradient from the centre out to `size`. */
|
|
117
|
+
declare const blob: ShardKindDefinition<"blob", {
|
|
118
|
+
readonly strength: {
|
|
119
|
+
readonly type: "number";
|
|
120
|
+
readonly default: 1;
|
|
121
|
+
readonly min: 0;
|
|
122
|
+
readonly max: 2;
|
|
123
|
+
};
|
|
124
|
+
readonly size: {
|
|
125
|
+
readonly type: "number";
|
|
126
|
+
readonly default: 0.5;
|
|
127
|
+
readonly min: 0;
|
|
128
|
+
readonly max: 2;
|
|
129
|
+
};
|
|
130
|
+
readonly hardness: {
|
|
131
|
+
readonly type: "number";
|
|
132
|
+
readonly default: 0;
|
|
133
|
+
readonly min: 0;
|
|
134
|
+
readonly max: 0.999;
|
|
135
|
+
};
|
|
136
|
+
readonly falloff: {
|
|
137
|
+
readonly type: "number";
|
|
138
|
+
readonly default: 2;
|
|
139
|
+
readonly min: 0.1;
|
|
140
|
+
readonly max: 8;
|
|
141
|
+
};
|
|
142
|
+
readonly aspect: {
|
|
143
|
+
readonly type: "number";
|
|
144
|
+
readonly default: 1;
|
|
145
|
+
readonly min: 0.1;
|
|
146
|
+
readonly max: 10;
|
|
147
|
+
};
|
|
148
|
+
readonly angle: {
|
|
149
|
+
readonly type: "angle";
|
|
150
|
+
readonly default: 0;
|
|
151
|
+
};
|
|
152
|
+
readonly softness: {
|
|
153
|
+
readonly type: "number";
|
|
154
|
+
readonly default: 0;
|
|
155
|
+
readonly min: 0;
|
|
156
|
+
readonly max: 50;
|
|
157
|
+
readonly unit: "px";
|
|
158
|
+
};
|
|
159
|
+
readonly variance: {
|
|
160
|
+
readonly type: "number";
|
|
161
|
+
readonly default: 0;
|
|
162
|
+
readonly min: 0;
|
|
163
|
+
readonly max: 1;
|
|
164
|
+
};
|
|
165
|
+
}>;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* `fan`: `count` rays spread evenly round the centre. Each ray is a quad
|
|
169
|
+
* tapering from root to tip, filled with a linear gradient along its length.
|
|
170
|
+
*/
|
|
171
|
+
declare const fan: ShardKindDefinition<"fan", {
|
|
172
|
+
readonly strength: {
|
|
173
|
+
readonly type: "number";
|
|
174
|
+
readonly default: 1;
|
|
175
|
+
readonly min: 0;
|
|
176
|
+
readonly max: 2;
|
|
177
|
+
};
|
|
178
|
+
readonly size: {
|
|
179
|
+
readonly type: "number";
|
|
180
|
+
readonly default: 1;
|
|
181
|
+
readonly min: 0;
|
|
182
|
+
readonly max: 2;
|
|
183
|
+
};
|
|
184
|
+
readonly count: {
|
|
185
|
+
readonly type: "number";
|
|
186
|
+
readonly default: 4;
|
|
187
|
+
readonly min: 1;
|
|
188
|
+
readonly max: 256;
|
|
189
|
+
readonly step: 1;
|
|
190
|
+
};
|
|
191
|
+
readonly angle: {
|
|
192
|
+
readonly type: "angle";
|
|
193
|
+
readonly default: 0;
|
|
194
|
+
};
|
|
195
|
+
readonly jitter: {
|
|
196
|
+
readonly type: "number";
|
|
197
|
+
readonly default: 0;
|
|
198
|
+
readonly min: 0;
|
|
199
|
+
readonly max: 1;
|
|
200
|
+
};
|
|
201
|
+
readonly inner: {
|
|
202
|
+
readonly type: "number";
|
|
203
|
+
readonly default: 0;
|
|
204
|
+
readonly min: 0;
|
|
205
|
+
readonly max: 1;
|
|
206
|
+
};
|
|
207
|
+
readonly variance: {
|
|
208
|
+
readonly type: "number";
|
|
209
|
+
readonly default: 0;
|
|
210
|
+
readonly min: 0;
|
|
211
|
+
readonly max: 1;
|
|
212
|
+
};
|
|
213
|
+
readonly width: {
|
|
214
|
+
readonly type: "number";
|
|
215
|
+
readonly default: 4;
|
|
216
|
+
readonly min: 0;
|
|
217
|
+
readonly max: 100;
|
|
218
|
+
readonly unit: "px";
|
|
219
|
+
readonly ray: true;
|
|
220
|
+
};
|
|
221
|
+
readonly taper: {
|
|
222
|
+
readonly type: "number";
|
|
223
|
+
readonly default: 1;
|
|
224
|
+
readonly min: 0;
|
|
225
|
+
readonly max: 1;
|
|
226
|
+
};
|
|
227
|
+
readonly falloff: {
|
|
228
|
+
readonly type: "number";
|
|
229
|
+
readonly default: 1;
|
|
230
|
+
readonly min: 0;
|
|
231
|
+
readonly max: 8;
|
|
232
|
+
};
|
|
233
|
+
readonly fadeIn: {
|
|
234
|
+
readonly type: "number";
|
|
235
|
+
readonly default: 0;
|
|
236
|
+
readonly min: 0;
|
|
237
|
+
readonly max: 1;
|
|
238
|
+
};
|
|
239
|
+
readonly softness: {
|
|
240
|
+
readonly type: "number";
|
|
241
|
+
readonly default: 1;
|
|
242
|
+
readonly min: 0;
|
|
243
|
+
readonly max: 50;
|
|
244
|
+
readonly unit: "px";
|
|
245
|
+
readonly ray: true;
|
|
246
|
+
};
|
|
247
|
+
}>;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* `clusters`: `clusters` bundles, spread evenly round the centre, of
|
|
251
|
+
* `perCluster` fine rays each. Rays are drawn like `fan` rays.
|
|
252
|
+
*/
|
|
253
|
+
declare const clusters: ShardKindDefinition<"clusters", {
|
|
254
|
+
readonly clusters: {
|
|
255
|
+
readonly type: "number";
|
|
256
|
+
readonly default: 4;
|
|
257
|
+
readonly min: 1;
|
|
258
|
+
readonly max: 64;
|
|
259
|
+
readonly step: 1;
|
|
260
|
+
};
|
|
261
|
+
readonly perCluster: {
|
|
262
|
+
readonly type: "number";
|
|
263
|
+
readonly default: 5;
|
|
264
|
+
readonly min: 1;
|
|
265
|
+
readonly max: 64;
|
|
266
|
+
readonly step: 1;
|
|
267
|
+
};
|
|
268
|
+
readonly spread: {
|
|
269
|
+
readonly type: "number";
|
|
270
|
+
readonly default: 20;
|
|
271
|
+
readonly min: 0;
|
|
272
|
+
readonly max: 360;
|
|
273
|
+
};
|
|
274
|
+
readonly inner: {
|
|
275
|
+
readonly type: "number";
|
|
276
|
+
readonly default: 0.1;
|
|
277
|
+
readonly min: 0;
|
|
278
|
+
readonly max: 1;
|
|
279
|
+
};
|
|
280
|
+
readonly strength: {
|
|
281
|
+
readonly type: "number";
|
|
282
|
+
readonly default: 0.5;
|
|
283
|
+
readonly min: 0;
|
|
284
|
+
readonly max: 2;
|
|
285
|
+
};
|
|
286
|
+
readonly size: {
|
|
287
|
+
readonly type: "number";
|
|
288
|
+
readonly default: 0.5;
|
|
289
|
+
readonly min: 0;
|
|
290
|
+
readonly max: 2;
|
|
291
|
+
};
|
|
292
|
+
readonly angle: {
|
|
293
|
+
readonly type: "angle";
|
|
294
|
+
readonly default: 0;
|
|
295
|
+
};
|
|
296
|
+
readonly variance: {
|
|
297
|
+
readonly type: "number";
|
|
298
|
+
readonly default: 0.5;
|
|
299
|
+
readonly min: 0;
|
|
300
|
+
readonly max: 1;
|
|
301
|
+
};
|
|
302
|
+
readonly width: {
|
|
303
|
+
readonly type: "number";
|
|
304
|
+
readonly default: 2;
|
|
305
|
+
readonly min: 0;
|
|
306
|
+
readonly max: 100;
|
|
307
|
+
readonly unit: "px";
|
|
308
|
+
readonly ray: true;
|
|
309
|
+
};
|
|
310
|
+
readonly taper: {
|
|
311
|
+
readonly type: "number";
|
|
312
|
+
readonly default: 0.5;
|
|
313
|
+
readonly min: 0;
|
|
314
|
+
readonly max: 1;
|
|
315
|
+
};
|
|
316
|
+
readonly falloff: {
|
|
317
|
+
readonly type: "number";
|
|
318
|
+
readonly default: 1;
|
|
319
|
+
readonly min: 0;
|
|
320
|
+
readonly max: 8;
|
|
321
|
+
};
|
|
322
|
+
readonly fadeIn: {
|
|
323
|
+
readonly type: "number";
|
|
324
|
+
readonly default: 0.1;
|
|
325
|
+
readonly min: 0;
|
|
326
|
+
readonly max: 1;
|
|
327
|
+
};
|
|
328
|
+
readonly softness: {
|
|
329
|
+
readonly type: "number";
|
|
330
|
+
readonly default: 1;
|
|
331
|
+
readonly min: 0;
|
|
332
|
+
readonly max: 50;
|
|
333
|
+
readonly unit: "px";
|
|
334
|
+
readonly ray: true;
|
|
335
|
+
};
|
|
336
|
+
}>;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* `halo`: a ring. A radial gradient between `size − width/2` and
|
|
340
|
+
* `size + width/2`, brightest at `size`.
|
|
341
|
+
*/
|
|
342
|
+
declare const halo: ShardKindDefinition<"halo", {
|
|
343
|
+
readonly strength: {
|
|
344
|
+
readonly type: "number";
|
|
345
|
+
readonly default: 0.1;
|
|
346
|
+
readonly min: 0;
|
|
347
|
+
readonly max: 2;
|
|
348
|
+
};
|
|
349
|
+
readonly size: {
|
|
350
|
+
readonly type: "number";
|
|
351
|
+
readonly default: 0.5;
|
|
352
|
+
readonly min: 0;
|
|
353
|
+
readonly max: 2;
|
|
354
|
+
};
|
|
355
|
+
readonly width: {
|
|
356
|
+
readonly type: "number";
|
|
357
|
+
readonly default: 0.05;
|
|
358
|
+
readonly min: 0;
|
|
359
|
+
readonly max: 2;
|
|
360
|
+
};
|
|
361
|
+
readonly falloff: {
|
|
362
|
+
readonly type: "number";
|
|
363
|
+
readonly default: 1;
|
|
364
|
+
readonly min: 0;
|
|
365
|
+
readonly max: 8;
|
|
366
|
+
};
|
|
367
|
+
readonly softness: {
|
|
368
|
+
readonly type: "number";
|
|
369
|
+
readonly default: 0;
|
|
370
|
+
readonly min: 0;
|
|
371
|
+
readonly max: 50;
|
|
372
|
+
readonly unit: "px";
|
|
373
|
+
};
|
|
374
|
+
readonly variance: {
|
|
375
|
+
readonly type: "number";
|
|
376
|
+
readonly default: 0;
|
|
377
|
+
readonly min: 0;
|
|
378
|
+
readonly max: 1;
|
|
379
|
+
};
|
|
380
|
+
}>;
|
|
381
|
+
|
|
382
|
+
/** Register the built-in kinds as ordinary definitions. */
|
|
383
|
+
declare function registerBuiltInKinds(): void;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* A frame's animation values. Effects start from scale 1, opacity 1, rotation 0
|
|
387
|
+
* and compose by multiplying scale/opacity and adding to rotation.
|
|
388
|
+
*/
|
|
389
|
+
interface FrameValues {
|
|
390
|
+
/** The values for a channel, created on first access at scale 1 / opacity 1. */
|
|
391
|
+
channel(name: string): ChannelValues;
|
|
392
|
+
/** The whole light's opacity. */
|
|
393
|
+
opacity: number;
|
|
394
|
+
/** Light-wide hover amount, 0..1, eased by the model. */
|
|
395
|
+
hover: number;
|
|
396
|
+
/** Seconds accumulated while hovered; lets effects spin up on hover. */
|
|
397
|
+
hoverTime: number;
|
|
398
|
+
/** Light-wide collapsed amount, 0..1, eased by the model. */
|
|
399
|
+
collapse: number;
|
|
400
|
+
/** Channel names currently present (built-in effects use this for `channels: 'all'`). */
|
|
401
|
+
channels(): string[];
|
|
402
|
+
}
|
|
403
|
+
interface EffectDefinition<N extends string = string, P extends ParamMap = ParamMap> {
|
|
404
|
+
name: N;
|
|
405
|
+
label?: string;
|
|
406
|
+
params: P;
|
|
407
|
+
/** Pure: advance the frame values for time `t` (seconds). */
|
|
408
|
+
apply: (t: number, params: ParamsFromSchema<P>, out: FrameValues) => void;
|
|
409
|
+
/**
|
|
410
|
+
* Optional CSS-keyframes form the DOM adapter can use instead of one JS call
|
|
411
|
+
* per frame. Reserved for a later release.
|
|
412
|
+
*/
|
|
413
|
+
css?: (params: ParamsFromSchema<P>) => string;
|
|
414
|
+
/** Pause under `prefers-reduced-motion` unless this is `'keep'`. */
|
|
415
|
+
reducedMotion?: 'keep';
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* `pulse`: multiplies each channel's scale by `1 + amount·sin(2π·speed·t)`.
|
|
420
|
+
*/
|
|
421
|
+
declare const pulse: EffectDefinition<"pulse", {
|
|
422
|
+
readonly channels: {
|
|
423
|
+
readonly type: "channels";
|
|
424
|
+
readonly default: readonly ["main"];
|
|
425
|
+
};
|
|
426
|
+
readonly speed: {
|
|
427
|
+
readonly type: "number";
|
|
428
|
+
readonly default: 1;
|
|
429
|
+
readonly min: 0;
|
|
430
|
+
readonly max: 10;
|
|
431
|
+
readonly step: 0.01;
|
|
432
|
+
};
|
|
433
|
+
readonly amount: {
|
|
434
|
+
readonly type: "number";
|
|
435
|
+
readonly default: 0.1;
|
|
436
|
+
readonly min: 0;
|
|
437
|
+
readonly max: 1;
|
|
438
|
+
};
|
|
439
|
+
}>;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* `flicker`: a two-sine brightness wobble, applied to each channel's opacity.
|
|
443
|
+
* `channels: ['*']` (the default) means every channel.
|
|
444
|
+
*/
|
|
445
|
+
declare const flicker: EffectDefinition<"flicker", {
|
|
446
|
+
readonly amount: {
|
|
447
|
+
readonly type: "number";
|
|
448
|
+
readonly default: 0.15;
|
|
449
|
+
readonly min: 0;
|
|
450
|
+
readonly max: 1;
|
|
451
|
+
};
|
|
452
|
+
readonly speed: {
|
|
453
|
+
readonly type: "number";
|
|
454
|
+
readonly default: 1;
|
|
455
|
+
readonly min: 0;
|
|
456
|
+
readonly max: 10;
|
|
457
|
+
readonly step: 0.01;
|
|
458
|
+
};
|
|
459
|
+
readonly channels: {
|
|
460
|
+
readonly type: "channels";
|
|
461
|
+
readonly default: readonly ["*"];
|
|
462
|
+
};
|
|
463
|
+
}>;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* `spin`: adds `phase + speed · 360 · t` degrees to each target channel's
|
|
467
|
+
* rotation. Several spin effects on one channel add up, so a shard can turn at
|
|
468
|
+
* the sum of their speeds.
|
|
469
|
+
*/
|
|
470
|
+
declare const spin: EffectDefinition<"spin", {
|
|
471
|
+
readonly channels: {
|
|
472
|
+
readonly type: "channels";
|
|
473
|
+
readonly default: readonly ["main"];
|
|
474
|
+
};
|
|
475
|
+
readonly speed: {
|
|
476
|
+
readonly type: "number";
|
|
477
|
+
readonly default: 0.1;
|
|
478
|
+
readonly min: -10;
|
|
479
|
+
readonly max: 10;
|
|
480
|
+
readonly step: 0.01;
|
|
481
|
+
readonly unit: "turns/s";
|
|
482
|
+
};
|
|
483
|
+
readonly phase: {
|
|
484
|
+
readonly type: "angle";
|
|
485
|
+
readonly default: 0;
|
|
486
|
+
};
|
|
487
|
+
}>;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* `hover`: eases each target channel toward `scale` / `opacity` / `rotate` as
|
|
491
|
+
* the pointer sits over the light, and keeps turning at `spin` turns/s while it
|
|
492
|
+
* is there. `out.hover` is the light-wide hover amount (0..1) and
|
|
493
|
+
* `out.hoverTime` is the seconds accumulated while hovered, both eased by the
|
|
494
|
+
* model, so the response is the same shape everywhere.
|
|
495
|
+
*
|
|
496
|
+
* Hover is user-driven, so it keeps running under `prefers-reduced-motion`.
|
|
497
|
+
*/
|
|
498
|
+
declare const hover: EffectDefinition<"hover", {
|
|
499
|
+
readonly channels: {
|
|
500
|
+
readonly type: "channels";
|
|
501
|
+
readonly default: readonly ["main"];
|
|
502
|
+
};
|
|
503
|
+
readonly scale: {
|
|
504
|
+
readonly type: "number";
|
|
505
|
+
readonly default: 1.15;
|
|
506
|
+
readonly min: 0;
|
|
507
|
+
readonly max: 4;
|
|
508
|
+
readonly step: 0.01;
|
|
509
|
+
};
|
|
510
|
+
readonly opacity: {
|
|
511
|
+
readonly type: "number";
|
|
512
|
+
readonly default: 1;
|
|
513
|
+
readonly min: 0;
|
|
514
|
+
readonly max: 4;
|
|
515
|
+
readonly step: 0.01;
|
|
516
|
+
};
|
|
517
|
+
readonly rotate: {
|
|
518
|
+
readonly type: "angle";
|
|
519
|
+
readonly default: 0;
|
|
520
|
+
};
|
|
521
|
+
readonly spin: {
|
|
522
|
+
readonly type: "number";
|
|
523
|
+
readonly default: 0;
|
|
524
|
+
readonly min: -10;
|
|
525
|
+
readonly max: 10;
|
|
526
|
+
readonly step: 0.01;
|
|
527
|
+
readonly unit: "turns/s";
|
|
528
|
+
};
|
|
529
|
+
}>;
|
|
530
|
+
|
|
531
|
+
/** How a light reacts to a click when it has a `collapse` effect. */
|
|
532
|
+
type CollapseTrigger = 'click' | 'once' | 'none';
|
|
533
|
+
/**
|
|
534
|
+
* `collapse`: shrinks (`scale`) and fades (`opacity`) each target channel as the
|
|
535
|
+
* light is clicked. `out.collapse` is the light-wide collapsed amount (0..1),
|
|
536
|
+
* eased by the model.
|
|
537
|
+
*
|
|
538
|
+
* `trigger` decides the built-in click behavior: `'click'` toggles, `'once'`
|
|
539
|
+
* collapses and stays, `'none'` leaves the click alone so you can drive
|
|
540
|
+
* `setCollapsed()` yourself.
|
|
541
|
+
*
|
|
542
|
+
* Click is user-driven, so it keeps running under `prefers-reduced-motion`.
|
|
543
|
+
*/
|
|
544
|
+
declare const collapse: EffectDefinition<"collapse", {
|
|
545
|
+
readonly channels: {
|
|
546
|
+
readonly type: "channels";
|
|
547
|
+
readonly default: readonly ["*"];
|
|
548
|
+
};
|
|
549
|
+
readonly scale: {
|
|
550
|
+
readonly type: "number";
|
|
551
|
+
readonly default: 0;
|
|
552
|
+
readonly min: 0;
|
|
553
|
+
readonly max: 4;
|
|
554
|
+
readonly step: 0.01;
|
|
555
|
+
};
|
|
556
|
+
readonly opacity: {
|
|
557
|
+
readonly type: "number";
|
|
558
|
+
readonly default: 1;
|
|
559
|
+
readonly min: 0;
|
|
560
|
+
readonly max: 4;
|
|
561
|
+
readonly step: 0.01;
|
|
562
|
+
};
|
|
563
|
+
readonly trigger: {
|
|
564
|
+
readonly type: "enum";
|
|
565
|
+
readonly default: "click";
|
|
566
|
+
readonly values: readonly ["click", "once", "none"];
|
|
567
|
+
};
|
|
568
|
+
}>;
|
|
569
|
+
/**
|
|
570
|
+
* The built-in click behavior for a light's `collapse` effects. `'none'` wins
|
|
571
|
+
* when set (an explicit opt-out), then `'once'`, otherwise `'click'`.
|
|
572
|
+
*/
|
|
573
|
+
declare function collapseTrigger(effects: readonly EffectConfig[]): CollapseTrigger;
|
|
574
|
+
|
|
575
|
+
/** Register the built-in effects as ordinary definitions. */
|
|
576
|
+
declare function registerBuiltInEffects(): void;
|
|
577
|
+
|
|
578
|
+
/** `star` (default): a warm 4-point star with a soft bloom and a faint ring. */
|
|
579
|
+
declare const star: ShardLightConfig;
|
|
580
|
+
|
|
581
|
+
/** `sun`: a big soft sun with many faint, slightly jittered rays. */
|
|
582
|
+
declare const sun: ShardLightConfig;
|
|
583
|
+
|
|
584
|
+
/** `sparkle`: a small crisp glint — a tight core with two crossed fans. */
|
|
585
|
+
declare const sparkle: ShardLightConfig;
|
|
586
|
+
|
|
587
|
+
/** `starburst`: a bright core throwing many long, fine, uneven rays. */
|
|
588
|
+
declare const starburst: ShardLightConfig;
|
|
589
|
+
|
|
590
|
+
/** `ember`: a warm, low glow with a few short, uneven sparks. */
|
|
591
|
+
declare const ember: ShardLightConfig;
|
|
592
|
+
|
|
593
|
+
/** Register the built-in presets by name. */
|
|
594
|
+
declare function registerBuiltInPresets(): void;
|
|
595
|
+
|
|
596
|
+
interface ResolveInput {
|
|
597
|
+
/** Starting config. Omitted or `null` = start empty (only the shards you give). */
|
|
598
|
+
preset?: Preset | null;
|
|
599
|
+
/** Data-driven config merged over the preset. */
|
|
600
|
+
config?: Partial<ShardLightConfig> | null;
|
|
601
|
+
/** Per-shard overrides (`<Shard>` children / the `shards` option). */
|
|
602
|
+
shards?: readonly ShardInput[] | null;
|
|
603
|
+
/** Effects; overrides `config.effects` when provided. */
|
|
604
|
+
effects?: readonly EffectConfig[] | null;
|
|
605
|
+
color?: string;
|
|
606
|
+
rotation?: number;
|
|
607
|
+
seed?: number;
|
|
608
|
+
}
|
|
609
|
+
interface ResolveOptions {
|
|
610
|
+
/** Force development warnings on/off. Defaults to NODE_ENV !== 'production'. */
|
|
611
|
+
warn?: boolean;
|
|
612
|
+
/** Preset used when `preset` is omitted. Defaults to none. */
|
|
613
|
+
defaultPreset?: string | null;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* The single place that decides what gets drawn. Every adapter calls
|
|
617
|
+
* it. Order: preset → config → shard overrides, merged per shard by `id`; then
|
|
618
|
+
* kind defaults are filled in; then values are clamped.
|
|
619
|
+
*/
|
|
620
|
+
declare function resolveConfig(input?: ResolveInput, options?: ResolveOptions): ResolvedLight;
|
|
621
|
+
|
|
622
|
+
declare const CURRENT_VERSION = 1;
|
|
623
|
+
/**
|
|
624
|
+
* Upgrade older config JSON to the current schema version, step by step
|
|
625
|
+
*. Adapters run this on every config they're given, so old saves
|
|
626
|
+
* keep working. Unknown fields are preserved so a config from a newer version
|
|
627
|
+
* degrades gracefully rather than throwing.
|
|
628
|
+
*/
|
|
629
|
+
declare function migrateConfig(input: unknown): ShardLightConfig;
|
|
630
|
+
|
|
631
|
+
/** Define a kind object. Does not register it. */
|
|
632
|
+
declare function defineShardKind<K extends string, const P extends ParamMap>(def: ShardKindDefinition<K, P>): ShardKindDefinition<K, P>;
|
|
633
|
+
declare function registerShardKind(def: ShardKindDefinition<string, ParamMap>): void;
|
|
634
|
+
declare function getShardKind(kind: string): ShardKindDefinition<string, ParamMap> | undefined;
|
|
635
|
+
declare function listShardKinds(): ShardKindDefinition<string, ParamMap>[];
|
|
636
|
+
declare function unregisterShardKind(kind: string): void;
|
|
637
|
+
|
|
638
|
+
/** Define an effect object. Does not register it. */
|
|
639
|
+
declare function defineEffect<N extends string, const P extends ParamMap>(def: EffectDefinition<N, P>): EffectDefinition<N, P>;
|
|
640
|
+
declare function registerEffect(def: EffectDefinition<string, ParamMap>): void;
|
|
641
|
+
declare function getEffect(name: string): EffectDefinition<string, ParamMap> | undefined;
|
|
642
|
+
declare function listEffects(): EffectDefinition<string, ParamMap>[];
|
|
643
|
+
declare function unregisterEffect(name: string): void;
|
|
644
|
+
|
|
645
|
+
/** Values set by hand through `set()`; effects compose on top of these. */
|
|
646
|
+
interface FrameBase {
|
|
647
|
+
channels?: Record<string, {
|
|
648
|
+
scale?: number;
|
|
649
|
+
opacity?: number;
|
|
650
|
+
rotation?: number;
|
|
651
|
+
}>;
|
|
652
|
+
opacity?: number;
|
|
653
|
+
/** Light-wide hover amount, 0..1. Default 0. */
|
|
654
|
+
hover?: number;
|
|
655
|
+
/** Seconds accumulated while hovered. Default 0. */
|
|
656
|
+
hoverTime?: number;
|
|
657
|
+
/** Light-wide collapsed amount, 0..1. Default 0. */
|
|
658
|
+
collapse?: number;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Compute a frame: start from the manual base (scale 1 / opacity 1 / rotation 0),
|
|
662
|
+
* seed every known channel, then let each effect multiply scale and opacity and
|
|
663
|
+
* add to rotation.
|
|
664
|
+
*/
|
|
665
|
+
declare function computeFrame(base: FrameBase, effects: readonly EffectConfig[], t: number, channelNames?: readonly string[]): FrameValues;
|
|
666
|
+
|
|
667
|
+
/** Define a preset object. Does not register it, so it can be passed directly. */
|
|
668
|
+
declare function definePreset(config: ShardLightConfig): ShardLightConfig;
|
|
669
|
+
declare function registerPreset(name: string, config: ShardLightConfig): void;
|
|
670
|
+
declare function getPreset(name: string): ShardLightConfig | undefined;
|
|
671
|
+
declare function listPresets(): string[];
|
|
672
|
+
declare function unregisterPreset(name: string): void;
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* The default baker. Draws each shard to its own scratch canvas with
|
|
676
|
+
* the kind's `draw`, applies its variance mask, then composites it onto the
|
|
677
|
+
* layer canvas with `lighter` and a per-shard blur.
|
|
678
|
+
*/
|
|
679
|
+
declare const canvas2dBaker: Baker;
|
|
680
|
+
|
|
681
|
+
declare function acquireSource(key: string, start: (signal: AbortSignal) => Promise<LayerSource>): Promise<LayerSource>;
|
|
682
|
+
declare function releaseSource(key: string): void;
|
|
683
|
+
declare function disposeSource(source: LayerSource): void;
|
|
684
|
+
/** Number of live entries; used by the memory tests. */
|
|
685
|
+
declare function cacheSize(): number;
|
|
686
|
+
declare function clearCache(): void;
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Runs bakes one layer per task, yielding between them, so a big light never
|
|
690
|
+
* blocks a frame and stale bakes never finish.
|
|
691
|
+
*/
|
|
692
|
+
interface Scheduler {
|
|
693
|
+
run<T>(task: () => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
694
|
+
/** Drop everything still queued (does not cancel the running task). */
|
|
695
|
+
clear(): void;
|
|
696
|
+
}
|
|
697
|
+
interface SchedulerOptions {
|
|
698
|
+
/** Delay between tasks, in ms. 0 (a macrotask) still yields. */
|
|
699
|
+
yieldDelay?: number;
|
|
700
|
+
}
|
|
701
|
+
declare function createScheduler(options?: SchedulerOptions): Scheduler;
|
|
702
|
+
declare function abortError(): Error;
|
|
703
|
+
declare function isAbortError(error: unknown): boolean;
|
|
704
|
+
|
|
705
|
+
interface PrewarmOptions extends ResolveInput {
|
|
706
|
+
resolution?: number;
|
|
707
|
+
rayScale?: number;
|
|
708
|
+
baker?: Baker;
|
|
709
|
+
accepts?: LayerSource['type'][];
|
|
710
|
+
warn?: boolean;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Bake a config into the shared cache ahead of time, so a light that appears on
|
|
714
|
+
* a key moment (a reveal, an entrance) is ready before it's needed.
|
|
715
|
+
* Holds a cache reference until `releasePrewarm()` is called.
|
|
716
|
+
*/
|
|
717
|
+
declare function prewarm(options?: PrewarmOptions): Promise<void>;
|
|
718
|
+
/** Release the cache references held by `prewarm()`. */
|
|
719
|
+
declare function releasePrewarm(): void;
|
|
720
|
+
|
|
721
|
+
/** One host unit: one baked image, one `<img>` or plane. */
|
|
722
|
+
interface Layer {
|
|
723
|
+
/** Stable while the layer exists: `${channel}|${blend}`. */
|
|
724
|
+
id: string;
|
|
725
|
+
/** Content hash; changes when the layer needs re-baking. */
|
|
726
|
+
key: string;
|
|
727
|
+
channel: string;
|
|
728
|
+
blend: 'add' | 'screen';
|
|
729
|
+
source: LayerSource | null;
|
|
730
|
+
}
|
|
731
|
+
interface SetValues {
|
|
732
|
+
channels?: Record<string, {
|
|
733
|
+
scale?: number;
|
|
734
|
+
opacity?: number;
|
|
735
|
+
rotation?: number;
|
|
736
|
+
}>;
|
|
737
|
+
/** The whole light's opacity. */
|
|
738
|
+
opacity?: number;
|
|
739
|
+
/** Direct hover amount 0..1; also snaps the eased hover target. */
|
|
740
|
+
hover?: number;
|
|
741
|
+
/** Direct collapsed amount 0..1; also snaps the eased collapse target. */
|
|
742
|
+
collapse?: number;
|
|
743
|
+
}
|
|
744
|
+
interface LightModelOptions extends ResolveInput {
|
|
745
|
+
resolution?: number;
|
|
746
|
+
rayScale?: number;
|
|
747
|
+
baker?: Baker;
|
|
748
|
+
accepts?: LayerSource['type'][];
|
|
749
|
+
/** Pause effects under `prefers-reduced-motion`. */
|
|
750
|
+
reducedMotion?: boolean;
|
|
751
|
+
/** Seconds for hover to ease in/out. Default 0.25; 0 snaps. */
|
|
752
|
+
hoverEase?: number;
|
|
753
|
+
/** Seconds for the click collapse to ease in/out. Default 0.3; 0 snaps. */
|
|
754
|
+
collapseEase?: number;
|
|
755
|
+
warn?: boolean;
|
|
756
|
+
onError?: (error: unknown) => void;
|
|
757
|
+
}
|
|
758
|
+
interface LightModel {
|
|
759
|
+
subscribe(listener: (layers: Layer[]) => void): () => void;
|
|
760
|
+
onFrame(listener: (values: FrameValues) => void): () => void;
|
|
761
|
+
update(patch: Partial<LightModelOptions>): void;
|
|
762
|
+
set(values: SetValues): void;
|
|
763
|
+
setChannel(channel: string, values: {
|
|
764
|
+
scale?: number;
|
|
765
|
+
opacity?: number;
|
|
766
|
+
rotation?: number;
|
|
767
|
+
}): void;
|
|
768
|
+
/** Ease the light-wide hover amount toward 0 or 1. */
|
|
769
|
+
setHover(hovered: boolean): void;
|
|
770
|
+
/** Ease the light-wide collapse toward 0 (expanded) or 1 (collapsed). */
|
|
771
|
+
setCollapsed(collapsed: boolean): void;
|
|
772
|
+
/** Flip between expanded and collapsed. */
|
|
773
|
+
toggleCollapsed(): void;
|
|
774
|
+
tick(dt: number): void;
|
|
775
|
+
dispose(): void;
|
|
776
|
+
readonly layers: readonly Layer[];
|
|
777
|
+
readonly resolved: ResolvedLight;
|
|
778
|
+
/** Resolves once every currently-known layer has a baked source. */
|
|
779
|
+
readonly ready: Promise<void>;
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* The headless controller every target wraps. It owns everything that
|
|
783
|
+
* isn't drawing to a host: resolving, grouping, baking, caching, diffing and
|
|
784
|
+
* effects.
|
|
785
|
+
*/
|
|
786
|
+
declare function createLightModel(options?: LightModelOptions): LightModel;
|
|
787
|
+
|
|
788
|
+
interface BakeInputs {
|
|
789
|
+
resolution: number;
|
|
790
|
+
rayScale: number;
|
|
791
|
+
baker: string;
|
|
792
|
+
accept: string[];
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Group shards into layers: shards that share `channel` + `blend` are baked
|
|
796
|
+
* baked together into one image. The layer `key` is a stable content
|
|
797
|
+
* hash (resolved shards + light-wide bake inputs) used for caching and sharing.
|
|
798
|
+
*/
|
|
799
|
+
declare function buildLayers(light: ResolvedLight, inputs: BakeInputs): ResolvedLayer[];
|
|
800
|
+
declare function layerId(channel: string, blend: string): string;
|
|
801
|
+
|
|
802
|
+
interface RGB {
|
|
803
|
+
r: number;
|
|
804
|
+
g: number;
|
|
805
|
+
b: number;
|
|
806
|
+
a: number;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Parse the common CSS colour forms used by lights: #rgb, #rgba, #rrggbb,
|
|
810
|
+
* #rrggbbaa, rgb()/rgba(). Falls back to opaque white for anything unknown so a
|
|
811
|
+
* malformed colour never blanks a whole light.
|
|
812
|
+
*/
|
|
813
|
+
declare function parseColor(input: string): RGB;
|
|
814
|
+
/** A function that formats a colour at a given alpha, for a draw env. */
|
|
815
|
+
type RgbaFormatter = (alpha: number) => string;
|
|
816
|
+
declare function makeRgba(color: string): RgbaFormatter;
|
|
817
|
+
/** Loose validity check for names used in CSS custom properties. */
|
|
818
|
+
declare function isCssIdentifier(name: string): boolean;
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* FNV-1a string hash. Deterministic across runs and platforms.
|
|
822
|
+
* Used to seed a shard's PRNG from its `id`, so reordering or inserting
|
|
823
|
+
* shards never reshuffles the other shards' randomness.
|
|
824
|
+
*/
|
|
825
|
+
declare function hashString(input: string): number;
|
|
826
|
+
|
|
827
|
+
/** mulberry32: a tiny, fast, seedable PRNG. */
|
|
828
|
+
declare function mulberry32(seed: number): () => number;
|
|
829
|
+
/**
|
|
830
|
+
* A shard's PRNG seed: `hash(id) ^ (shard.seed ?? light.seed)`.
|
|
831
|
+
* Seeding by id (not position) keeps each shard's randomness stable.
|
|
832
|
+
*/
|
|
833
|
+
declare function shardSeed(id: string, seed: number): number;
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Stable, deterministic serialisation used for cache keys and diffing.
|
|
837
|
+
* Key order never affects the output.
|
|
838
|
+
*/
|
|
839
|
+
declare function stableStringify(value: unknown): string;
|
|
840
|
+
|
|
841
|
+
/** Environment helpers shared by the bakers and adapters. */
|
|
842
|
+
type AnyCanvas = HTMLCanvasElement | OffscreenCanvas;
|
|
843
|
+
type AnyCanvasContext = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
844
|
+
declare function isBrowser(): boolean;
|
|
845
|
+
/** Create a canvas of the best available flavour for the current host. */
|
|
846
|
+
declare function createCanvas(width: number, height: number): AnyCanvas;
|
|
847
|
+
declare function get2dContext(canvas: AnyCanvas): AnyCanvasContext | null;
|
|
848
|
+
/**
|
|
849
|
+
* Free a scratch canvas immediately rather than waiting for the GC.
|
|
850
|
+
* Setting both dimensions to 0 releases the backing store in browsers.
|
|
851
|
+
*/
|
|
852
|
+
declare function freeCanvas(canvas: AnyCanvas): void;
|
|
853
|
+
declare function canvasToBlob(canvas: AnyCanvas): Promise<Blob>;
|
|
854
|
+
declare function isLowMemoryDevice(): boolean;
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Copy only the own properties whose value is not `undefined`.
|
|
858
|
+
*
|
|
859
|
+
* Used when merging options over defaults: a caller that spreads an optional
|
|
860
|
+
* prop (e.g. `{ baker }` where `baker` is undefined) must not wipe out the
|
|
861
|
+
* default. `null` is kept, since it is a meaningful value for `preset`.
|
|
862
|
+
*/
|
|
863
|
+
declare function definedOnly<T extends object>(value: T): Partial<T>;
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* **shardlight** — core (headless).
|
|
867
|
+
*
|
|
868
|
+
* Framework-free: no React, no three. Config model, shard kinds, presets,
|
|
869
|
+
* effects, baking and cache. Adapters (`shardlight/react`, `shardlight/three`,
|
|
870
|
+
* `shardlight/r3f`) wrap `createLightModel()` and draw its layers to a host.
|
|
871
|
+
*
|
|
872
|
+
* Importing this module registers the built-in kinds, effects and presets, so
|
|
873
|
+
* `preset="sun"` works with no setup. That is the package's only side effect.
|
|
874
|
+
*/
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Built-in shard kinds, plus any added by downstream code:
|
|
878
|
+
*
|
|
879
|
+
* ```ts
|
|
880
|
+
* declare module 'shardlight' {
|
|
881
|
+
* interface ShardKinds { dots: ParamsOf<typeof dots> }
|
|
882
|
+
* }
|
|
883
|
+
* ```
|
|
884
|
+
*/
|
|
885
|
+
interface ShardKinds extends BaseShardKinds {
|
|
886
|
+
}
|
|
887
|
+
/** Built-in presets, plus any registered by name via `registerPreset()`. */
|
|
888
|
+
interface ShardPresets extends BaseShardPresets {
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Per-channel animation values. Augmentable so a later release can add fields;
|
|
892
|
+
* v1 ships scale, opacity and rotation.
|
|
893
|
+
*/
|
|
894
|
+
interface ChannelValues {
|
|
895
|
+
scale: number;
|
|
896
|
+
opacity: number;
|
|
897
|
+
/** Degrees; turns this channel's layer around the light's centre. */
|
|
898
|
+
rotation: number;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
export { type AngleParam, type AnyCanvas, type AnyCanvasContext, type BakeInputs, Baker, BaseShardKinds, BaseShardPresets, type BooleanParam, CURRENT_VERSION, type ChannelValues, type ChannelsParam, type CollapseTrigger, type ColorParam, type Ctx2D, type DrawEnv, EffectConfig, type EffectDefinition, type EnumParam, type FrameBase, type FrameValues, type Layer, LayerSource, type LightModel, type LightModelOptions, type NumberParam, type ParamMap, type ParamSchema, type ParamsFromSchema, type ParamsOf, Preset, type PrewarmOptions, type RGB, type ResolveInput, type ResolveOptions, ResolvedLayer, ResolvedLight, type RgbaFormatter, type Scheduler, type SchedulerOptions, type SetValues, ShardInput, type ShardKindDefinition, type ShardKinds, ShardLightConfig, type ShardPresets, type ValueOfParam, abortError, acquireSource, blob, buildLayers, cacheSize, canvas2dBaker, canvasToBlob, clearCache, clusters, collapse, collapseTrigger, computeFrame, createCanvas, createLightModel, createScheduler, defineEffect, definePreset, defineShardKind, definedOnly, disposeSource, ember, fan, flicker, freeCanvas, get2dContext, getEffect, getPreset, getShardKind, halo, hashString, hover, isAbortError, isBrowser, isCssIdentifier, isLowMemoryDevice, layerId, listEffects, listPresets, listShardKinds, makeRgba, migrateConfig, mulberry32, parseColor, prewarm, pulse, registerBuiltInEffects, registerBuiltInKinds, registerBuiltInPresets, registerEffect, registerPreset, registerShardKind, releasePrewarm, releaseSource, resolveConfig, shardSeed, sparkle, spin, stableStringify, star, starburst, sun, unregisterEffect, unregisterPreset, unregisterShardKind };
|