@vectojs/core 0.1.0 → 0.2.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/dist/animation/drivers.d.ts +48 -0
- package/dist/animation/easing.d.ts +16 -0
- package/dist/{chunk-M2IZPGOL.mjs → chunk-H3QIE77O.mjs} +316 -12
- package/dist/{chunk-53DAQC3U.js → chunk-LA3FJLP2.js} +369 -65
- package/dist/components/GridTextEntity.d.ts +15 -0
- package/dist/components/SplineEntity.d.ts +144 -0
- package/dist/components/TextEntity.d.ts +35 -0
- package/dist/index.d.ts +26 -577
- package/dist/index.js +121 -136
- package/dist/index.mjs +19 -34
- package/dist/{layout.d.mts → layout/LayoutEngine.d.ts} +15 -70
- package/dist/layout/LayoutWorker.d.ts +23 -0
- package/dist/layout/LayoutWorkerManager.d.ts +22 -0
- package/dist/layout/LayoutWorkerSource.d.ts +1 -0
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/measure.d.ts +20 -0
- package/dist/math/SpatialHashGrid.d.ts +53 -0
- package/dist/math/SpringPhysics.d.ts +13 -0
- package/dist/renderer/CanvasRenderer.d.ts +81 -0
- package/dist/renderer/IRenderer.d.ts +178 -0
- package/dist/renderer/SVGRenderer.d.ts +69 -0
- package/dist/renderer/WebGLPointRenderer.d.ts +62 -0
- package/dist/renderer/WebGPUParticleSystemManager.d.ts +14 -0
- package/dist/renderer/colorParse.d.ts +17 -0
- package/dist/renderer/index.d.ts +6 -0
- package/dist/text/ArabicShaper.d.ts +10 -0
- package/dist/text/BidiResolver.d.ts +6 -0
- package/dist/{text.d.ts → text/MSDFFont.d.ts} +10 -82
- package/dist/text/MSDFTextEntity.d.ts +30 -0
- package/dist/text/SVGEntity.d.ts +22 -0
- package/dist/text/index.d.ts +5 -0
- package/dist/text.js +2 -2
- package/dist/text.mjs +1 -1
- package/dist/tree/ComputeParticleEntity.d.ts +118 -0
- package/dist/tree/DOMPortalEntity.d.ts +18 -0
- package/dist/{Entity-D-rfAFCf.d.mts → tree/Entity.d.ts} +71 -201
- package/dist/tree/Scene.d.ts +302 -0
- package/package.json +5 -5
- package/dist/Entity-D-rfAFCf.d.ts +0 -572
- package/dist/index-ByBDSmMK.d.mts +0 -365
- package/dist/index-C3Fd_XmG.d.ts +0 -365
- package/dist/index.d.mts +0 -577
- package/dist/layout.d.ts +0 -319
- package/dist/renderer.d.mts +0 -2
- package/dist/renderer.d.ts +0 -2
- package/dist/text.d.mts +0 -201
package/dist/index-C3Fd_XmG.d.ts
DELETED
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
import { I as IRenderer, E as Entity } from './Entity-D-rfAFCf.js';
|
|
2
|
-
|
|
3
|
-
declare class CanvasRenderer implements IRenderer {
|
|
4
|
-
private ctx;
|
|
5
|
-
private width;
|
|
6
|
-
private height;
|
|
7
|
-
/**
|
|
8
|
-
* Max circles per batched `fill()`. A single Canvas 2D `fill()` over a path is
|
|
9
|
-
* superlinear in sub-path count, so an unbounded batch is *slower* than many
|
|
10
|
-
* small fills at high entity counts. Capping bounds each fill's path
|
|
11
|
-
* complexity while still amortizing per-draw overhead. Tuned via the benchmark.
|
|
12
|
-
*/
|
|
13
|
-
static readonly MAX_BATCH = 64;
|
|
14
|
-
private batchActive;
|
|
15
|
-
private batchColor;
|
|
16
|
-
private batchAlpha;
|
|
17
|
-
private batchCount;
|
|
18
|
-
constructor(canvas: HTMLCanvasElement);
|
|
19
|
-
/**
|
|
20
|
-
* Expose the underlying `CanvasRenderingContext2D` for operations not
|
|
21
|
-
* covered by the {@link IRenderer} interface.
|
|
22
|
-
*
|
|
23
|
-
* @returns The raw 2D rendering context.
|
|
24
|
-
*/
|
|
25
|
-
getContext(): CanvasRenderingContext2D;
|
|
26
|
-
/**
|
|
27
|
-
* Resize the backing canvas buffer and re-apply DPR scaling.
|
|
28
|
-
*
|
|
29
|
-
* Called automatically by {@link Scene} on `window.resize` events.
|
|
30
|
-
*
|
|
31
|
-
* @param width - New logical width in CSS pixels.
|
|
32
|
-
* @param height - New logical height in CSS pixels.
|
|
33
|
-
*/
|
|
34
|
-
resize(width: number, height: number): void;
|
|
35
|
-
/** @inheritdoc */
|
|
36
|
-
clear(): void;
|
|
37
|
-
/** @inheritdoc */
|
|
38
|
-
save(): void;
|
|
39
|
-
/** @inheritdoc */
|
|
40
|
-
restore(): void;
|
|
41
|
-
/** @inheritdoc */
|
|
42
|
-
translate(x: number, y: number): void;
|
|
43
|
-
/** @inheritdoc */
|
|
44
|
-
scale(x: number, y: number): void;
|
|
45
|
-
/** @inheritdoc */
|
|
46
|
-
rotate(angle: number): void;
|
|
47
|
-
/** @inheritdoc */
|
|
48
|
-
setGlobalAlpha(alpha: number): void;
|
|
49
|
-
/** @inheritdoc */
|
|
50
|
-
clip(x: number, y: number, width: number, height: number): void;
|
|
51
|
-
/** @inheritdoc */
|
|
52
|
-
beginPath(): void;
|
|
53
|
-
/** @inheritdoc */
|
|
54
|
-
moveTo(x: number, y: number): void;
|
|
55
|
-
/** @inheritdoc */
|
|
56
|
-
lineTo(x: number, y: number): void;
|
|
57
|
-
/** @inheritdoc */
|
|
58
|
-
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
|
|
59
|
-
/** @inheritdoc */
|
|
60
|
-
closePath(): void;
|
|
61
|
-
/** @inheritdoc */
|
|
62
|
-
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
|
|
63
|
-
/** @inheritdoc */
|
|
64
|
-
roundRect(x: number, y: number, width: number, height: number, radii: number | number[]): void;
|
|
65
|
-
/** @inheritdoc */
|
|
66
|
-
drawImage(source: CanvasImageSource, dx: number, dy: number, dw: number, dh: number): void;
|
|
67
|
-
/** @inheritdoc */
|
|
68
|
-
fillCircle(cx: number, cy: number, radius: number, color: string, alpha?: number): void;
|
|
69
|
-
/** @inheritdoc */
|
|
70
|
-
flush(): void;
|
|
71
|
-
/** @inheritdoc */
|
|
72
|
-
fill(color: string | any): void;
|
|
73
|
-
/** @inheritdoc */
|
|
74
|
-
stroke(color: string | any, lineWidth?: number): void;
|
|
75
|
-
/** @inheritdoc */
|
|
76
|
-
fillText(text: string, x: number, y: number, font: string, color: string | any): void;
|
|
77
|
-
/** @inheritdoc */
|
|
78
|
-
createLinearGradient(x0: number, y0: number, x1: number, y1: number, colorStops: {
|
|
79
|
-
stop: number;
|
|
80
|
-
color: string;
|
|
81
|
-
}[]): any;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
interface SVGLinearGradient {
|
|
85
|
-
type: 'linear';
|
|
86
|
-
id?: string;
|
|
87
|
-
x0: number;
|
|
88
|
-
y0: number;
|
|
89
|
-
x1: number;
|
|
90
|
-
y1: number;
|
|
91
|
-
colorStops: {
|
|
92
|
-
stop: number;
|
|
93
|
-
color: string;
|
|
94
|
-
}[];
|
|
95
|
-
createMatrix: number[];
|
|
96
|
-
}
|
|
97
|
-
declare class SVGRenderer implements IRenderer {
|
|
98
|
-
private width;
|
|
99
|
-
private height;
|
|
100
|
-
private buffer;
|
|
101
|
-
private defsBuffer;
|
|
102
|
-
private currentPath;
|
|
103
|
-
private mStack;
|
|
104
|
-
private ma;
|
|
105
|
-
private mb;
|
|
106
|
-
private mc;
|
|
107
|
-
private md;
|
|
108
|
-
private me;
|
|
109
|
-
private mf;
|
|
110
|
-
private alphaStack;
|
|
111
|
-
private globalAlpha;
|
|
112
|
-
private clipDepthStack;
|
|
113
|
-
private clipDepth;
|
|
114
|
-
private clipCounter;
|
|
115
|
-
private batchCircles;
|
|
116
|
-
private batchMatrix;
|
|
117
|
-
private batchColor;
|
|
118
|
-
private batchAlpha;
|
|
119
|
-
private batchActive;
|
|
120
|
-
private gradientCounter;
|
|
121
|
-
private gradientCache;
|
|
122
|
-
constructor(width: number, height: number);
|
|
123
|
-
clear(): void;
|
|
124
|
-
save(): void;
|
|
125
|
-
restore(): void;
|
|
126
|
-
translate(dx: number, dy: number): void;
|
|
127
|
-
scale(sx: number, sy: number): void;
|
|
128
|
-
rotate(angle: number): void;
|
|
129
|
-
setGlobalAlpha(alpha: number): void;
|
|
130
|
-
beginPath(): void;
|
|
131
|
-
moveTo(x: number, y: number): void;
|
|
132
|
-
lineTo(x: number, y: number): void;
|
|
133
|
-
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
|
|
134
|
-
closePath(): void;
|
|
135
|
-
arc(x: number, y: number, r: number, startAngle: number, endAngle: number, ccw?: boolean): void;
|
|
136
|
-
roundRect(x: number, y: number, w: number, h: number, radii: number | number[]): void;
|
|
137
|
-
fill(colorOrGradient: string | SVGLinearGradient): void;
|
|
138
|
-
stroke(colorOrGradient: string | SVGLinearGradient, lineWidth?: number): void;
|
|
139
|
-
fillText(text: string, x: number, y: number, font: string, color: string | SVGLinearGradient): void;
|
|
140
|
-
fillCircle(cx: number, cy: number, radius: number, color: string, alpha?: number): void;
|
|
141
|
-
drawImage(source: any, dx: number, dy: number, dw: number, dh: number): void;
|
|
142
|
-
flush(): void;
|
|
143
|
-
createLinearGradient(x0: number, y0: number, x1: number, y1: number, colorStops: {
|
|
144
|
-
stop: number;
|
|
145
|
-
color: string;
|
|
146
|
-
}[]): SVGLinearGradient;
|
|
147
|
-
clip(x: number, y: number, width: number, height: number): void;
|
|
148
|
-
toXMLString(): string;
|
|
149
|
-
private resolveGradient;
|
|
150
|
-
private escapeXML;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* A GPU-accelerated layer that draws large sets of circles and rectangles in a
|
|
155
|
-
* couple of draw calls. Used by {@link Scene} (via `pointBackend: 'webgl'`) to
|
|
156
|
-
* render `getBatchCircle()` / `getBatchRect()` entities — the point-cloud /
|
|
157
|
-
* particle case where Canvas2D tops out at ~7 fps for 100k primitives.
|
|
158
|
-
*/
|
|
159
|
-
interface PointRenderer {
|
|
160
|
-
/** Resize the backing buffer + GL viewport to a logical `w × h` (DPR applied). */
|
|
161
|
-
resize(width: number, height: number): void;
|
|
162
|
-
/** Begin a frame: reset the accumulated primitive buffers. */
|
|
163
|
-
begin(): void;
|
|
164
|
-
/** Add one circle in world (CSS-pixel) coordinates; `alpha` multiplies the color's. */
|
|
165
|
-
addCircle(x: number, y: number, radius: number, color: string, alpha?: number): void;
|
|
166
|
-
/**
|
|
167
|
-
* Add one rectangle: top-left at world `(x, y)`, `width × height` in world units,
|
|
168
|
-
* rotated `rotation` radians about `(x, y)`; `alpha` multiplies the color's.
|
|
169
|
-
*/
|
|
170
|
-
addRect(x: number, y: number, width: number, height: number, color: string, alpha?: number, rotation?: number): void;
|
|
171
|
-
/**
|
|
172
|
-
* Upload a texture atlas used by {@link addSprite}. Pass any `TexImageSource`
|
|
173
|
-
* (HTMLImageElement, HTMLCanvasElement, ImageBitmap, …). Call once (or whenever
|
|
174
|
-
* the atlas changes) before adding sprites.
|
|
175
|
-
*/
|
|
176
|
-
setTexture(source: TexImageSource): void;
|
|
177
|
-
/**
|
|
178
|
-
* Add one textured sprite sampling the atlas region `[u0,v0]–[u1,v1]` (UVs in
|
|
179
|
-
* `0..1`): top-left at world `(x, y)`, `width × height` in world units, rotated
|
|
180
|
-
* `rotation` radians about `(x, y)`. `color` multiplies the sampled texel
|
|
181
|
-
* (white = unchanged; use it to tint white glyphs); `alpha` multiplies further.
|
|
182
|
-
* No-op until a texture is set via {@link setTexture}.
|
|
183
|
-
*/
|
|
184
|
-
addSprite(x: number, y: number, width: number, height: number, u0: number, v0: number, u1: number, v1: number, color?: string, alpha?: number, rotation?: number): void;
|
|
185
|
-
/**
|
|
186
|
-
* Upload an MSDF (multi-channel signed distance field) glyph atlas used by
|
|
187
|
-
* {@link addGlyph}, kept separate from the {@link setTexture} atlas so both can
|
|
188
|
-
* be active. `distanceRange` is the field's pixel range (the atlas JSON's
|
|
189
|
-
* `atlas.distanceRange`) — it drives the shader's edge sharpness. Pair with
|
|
190
|
-
* `MSDFFont.layout` to position the glyphs.
|
|
191
|
-
*/
|
|
192
|
-
setMSDFTexture(source: TexImageSource, distanceRange: number): void;
|
|
193
|
-
/**
|
|
194
|
-
* Add one MSDF glyph quad sampling `[u0,v0]–[u1,v1]` (UVs in `0..1`): top-left
|
|
195
|
-
* at world `(x, y)`, `width × height` in world units. The fragment shader
|
|
196
|
-
* reconstructs a crisp, resolution-independent edge from the distance field, so
|
|
197
|
-
* glyphs stay sharp at any scale. `color` tints the glyph (default white);
|
|
198
|
-
* `alpha` multiplies coverage. No-op until {@link setMSDFTexture} is called.
|
|
199
|
-
*/
|
|
200
|
-
addGlyph(x: number, y: number, width: number, height: number, u0: number, v0: number, u1: number, v1: number, color?: string, alpha?: number, rotation?: number): void;
|
|
201
|
-
/** Clear the layer and draw all accumulated primitives. */
|
|
202
|
-
flush(): void;
|
|
203
|
-
/** Release GL resources. */
|
|
204
|
-
destroy(): void;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Create a WebGL2-backed {@link PointRenderer} on `canvas`, or `null` when WebGL2
|
|
208
|
-
* (or shader compilation) is unavailable — callers fall back to Canvas2D.
|
|
209
|
-
*
|
|
210
|
-
* @param canvas - A dedicated canvas (WebGL2 context); should be stacked over the
|
|
211
|
-
* scene's 2D canvas.
|
|
212
|
-
* @returns A point renderer, or `null` if WebGL2 isn't supported.
|
|
213
|
-
*/
|
|
214
|
-
declare function createWebGLPointRenderer(canvas: HTMLCanvasElement): PointRenderer | null;
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Options for configuring a {@link ComputeParticleEntity}.
|
|
218
|
-
*/
|
|
219
|
-
interface ComputeParticleOptions {
|
|
220
|
-
/** Maximum number of particles to simulate. Defaults to 10000. */
|
|
221
|
-
maxParticles?: number;
|
|
222
|
-
/** Spring stiffness coefficient for returning to origin. Defaults to 0.05. */
|
|
223
|
-
springK?: number;
|
|
224
|
-
/** Velocity damping factor in `[0, 1]`. Defaults to 0.95. */
|
|
225
|
-
damping?: number;
|
|
226
|
-
/** Bounce damping factor for boundary collisions in `[0, 1]`. Defaults to 0.5. */
|
|
227
|
-
bounceDamping?: number;
|
|
228
|
-
/** Speed limit for particles. Defaults to 500.0. */
|
|
229
|
-
maxVelocity?: number;
|
|
230
|
-
/** Base particle size in pixels. Defaults to 4. */
|
|
231
|
-
size?: number;
|
|
232
|
-
/** CSS color string for the particles. Defaults to '#00f0ff'. */
|
|
233
|
-
color?: string;
|
|
234
|
-
/** Whether the particle layer captures pointer/hit events. Defaults to false. */
|
|
235
|
-
pointerEvents?: boolean;
|
|
236
|
-
}
|
|
237
|
-
declare const PARTICLE_STRIDE_FLOATS = 8;
|
|
238
|
-
declare const PARTICLE_OFFSET_POSITION_X = 0;
|
|
239
|
-
declare const PARTICLE_OFFSET_POSITION_Y = 1;
|
|
240
|
-
declare const PARTICLE_OFFSET_VELOCITY_X = 2;
|
|
241
|
-
declare const PARTICLE_OFFSET_VELOCITY_Y = 3;
|
|
242
|
-
declare const PARTICLE_OFFSET_ORIGIN_X = 4;
|
|
243
|
-
declare const PARTICLE_OFFSET_ORIGIN_Y = 5;
|
|
244
|
-
declare const PARTICLE_OFFSET_SIZE = 6;
|
|
245
|
-
declare const PARTICLE_OFFSET_LIFE = 7;
|
|
246
|
-
/**
|
|
247
|
-
* An entity representing a high-performance WebGPU/CPU particle simulation layer.
|
|
248
|
-
*/
|
|
249
|
-
declare class ComputeParticleEntity extends Entity {
|
|
250
|
-
maxParticles: number;
|
|
251
|
-
springK: number;
|
|
252
|
-
damping: number;
|
|
253
|
-
bounceDamping: number;
|
|
254
|
-
maxVelocity: number;
|
|
255
|
-
size: number;
|
|
256
|
-
baseColor: string;
|
|
257
|
-
pointerEvents: boolean;
|
|
258
|
-
/** Flat array containing layout of all particles: position, velocity, origin, size, life. */
|
|
259
|
-
particleData: Float32Array;
|
|
260
|
-
/** Flag indicating whether the particle coordinates need to be initialized. */
|
|
261
|
-
needsInit: boolean;
|
|
262
|
-
/** Active explosion impulse to apply in the next simulation step. */
|
|
263
|
-
pendingExplosion: {
|
|
264
|
-
x: number;
|
|
265
|
-
y: number;
|
|
266
|
-
force: number;
|
|
267
|
-
} | null;
|
|
268
|
-
/** WebGPU storage buffer containing particle states. */
|
|
269
|
-
gpuStorageBuffer: any;
|
|
270
|
-
/** WebGPU uniform buffer containing simulation parameters. */
|
|
271
|
-
gpuUniformBuffer: any;
|
|
272
|
-
/** WebGPU bind group for the compute shader pass. */
|
|
273
|
-
computeBindGroup: any;
|
|
274
|
-
/** WebGPU bind group for the render pass (usually same as compute). */
|
|
275
|
-
renderBindGroup: any;
|
|
276
|
-
constructor(options?: ComputeParticleOptions);
|
|
277
|
-
/**
|
|
278
|
-
* Disperses all particles randomly across the specified screen bounds.
|
|
279
|
-
* Sets initial positions, velocities, origins, and sizes.
|
|
280
|
-
*
|
|
281
|
-
* @param width - Simulation zone width.
|
|
282
|
-
* @param height - Simulation zone height.
|
|
283
|
-
*/
|
|
284
|
-
initRandomParticles(width: number, height: number): void;
|
|
285
|
-
/**
|
|
286
|
-
* Sets the origins (ox, oy) for a subset or all particles.
|
|
287
|
-
* Also sets position to origin if requestPositionReset is true.
|
|
288
|
-
*
|
|
289
|
-
* @param points - Flat Float32Array containing [x0, y0, x1, y1, ...]
|
|
290
|
-
* @param requestPositionReset - Whether to set current positions to the new origins. Defaults to true.
|
|
291
|
-
*/
|
|
292
|
-
setOrigins(points: Float32Array | number[], requestPositionReset?: boolean): void;
|
|
293
|
-
/**
|
|
294
|
-
* Sets the current positions (x, y) for a subset or all particles.
|
|
295
|
-
*
|
|
296
|
-
* @param positions - Flat Float32Array containing [x0, y0, x1, y1, ...]
|
|
297
|
-
*/
|
|
298
|
-
setPositions(positions: Float32Array | number[]): void;
|
|
299
|
-
/**
|
|
300
|
-
* Sets the current velocities (vx, vy) for a subset or all particles.
|
|
301
|
-
*
|
|
302
|
-
* @param velocities - Flat Float32Array containing [vx0, vy0, vx1, vy1, ...]
|
|
303
|
-
*/
|
|
304
|
-
setVelocities(velocities: Float32Array | number[]): void;
|
|
305
|
-
/**
|
|
306
|
-
* Triggers an explosion force center.
|
|
307
|
-
*
|
|
308
|
-
* @param x - Explosion center x-coordinate.
|
|
309
|
-
* @param y - Explosion center y-coordinate.
|
|
310
|
-
* @param force - Magnitude force scalar.
|
|
311
|
-
*/
|
|
312
|
-
triggerExplosion(x: number, y: number, force: number): void;
|
|
313
|
-
isPointInside(_x: number, _y: number): boolean;
|
|
314
|
-
render(_r: IRenderer): void;
|
|
315
|
-
/**
|
|
316
|
-
* Updates particle simulation on the CPU.
|
|
317
|
-
* Handles spring forces, mouse repulsion, explosion impulses, velocity capping, and bounds bouncing/clamping.
|
|
318
|
-
*
|
|
319
|
-
* @param dt - Delta time in seconds.
|
|
320
|
-
* @param mouseX - Mouse x-coordinate, or a value below -9000 if inactive.
|
|
321
|
-
* @param mouseY - Mouse y-coordinate, or a value below -9000 if inactive.
|
|
322
|
-
* @param width - Boundary width.
|
|
323
|
-
* @param height - Boundary height.
|
|
324
|
-
*/
|
|
325
|
-
updateCPU(dt: number, mouseX: number, mouseY: number, width: number, height: number): void;
|
|
326
|
-
destroy(): void;
|
|
327
|
-
/**
|
|
328
|
-
* Frees all GPU resources allocated for WebGPU simulation.
|
|
329
|
-
*/
|
|
330
|
-
destroyGPUResources(): void;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
declare class WebGPUParticleSystemManager {
|
|
334
|
-
private device;
|
|
335
|
-
private computePipeline;
|
|
336
|
-
private renderPipeline;
|
|
337
|
-
private computeBindGroupLayout;
|
|
338
|
-
private renderBindGroupLayout;
|
|
339
|
-
constructor(device: GPUDevice);
|
|
340
|
-
initPipelines(format: GPUTextureFormat): void;
|
|
341
|
-
setupEntityResources(entity: ComputeParticleEntity): void;
|
|
342
|
-
recordComputePass(pass: GPUComputePassEncoder, entity: ComputeParticleEntity, dt: number, mouseX: number, mouseY: number, width: number, height: number): void;
|
|
343
|
-
recordRenderPass(pass: GPURenderPassEncoder, entity: ComputeParticleEntity): void;
|
|
344
|
-
destroy(): void;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* Parsed color as normalized `[r, g, b, a]` floats in `[0, 1]`.
|
|
349
|
-
*/
|
|
350
|
-
type RGBA = [number, number, number, number];
|
|
351
|
-
/**
|
|
352
|
-
* Parse a CSS color string into normalized `[r, g, b, a]` floats.
|
|
353
|
-
*
|
|
354
|
-
* Fast paths handle `#rgb`/`#rgba`/`#rrggbb`/`#rrggbbaa` and `rgb()`/`rgba()`;
|
|
355
|
-
* other forms (named colors, `hsl()`, …) resolve via a cached 1×1 canvas when a
|
|
356
|
-
* DOM is available. Results are cached per input string and shared by identity,
|
|
357
|
-
* so callers must treat the returned array as read-only. Unparseable input with
|
|
358
|
-
* no DOM yields opaque black `[0, 0, 0, 1]`.
|
|
359
|
-
*
|
|
360
|
-
* @param css - A CSS color string, e.g. `'#38bdf8'` or `'rgba(0,0,0,.5)'`.
|
|
361
|
-
* @returns The cached `[r, g, b, a]` tuple in `[0, 1]`.
|
|
362
|
-
*/
|
|
363
|
-
declare function parseColorToRGBA(css: string): RGBA;
|
|
364
|
-
|
|
365
|
-
export { CanvasRenderer as C, PARTICLE_OFFSET_LIFE as P, type RGBA as R, type SVGLinearGradient as S, WebGPUParticleSystemManager as W, ComputeParticleEntity as a, type ComputeParticleOptions as b, PARTICLE_OFFSET_ORIGIN_X as c, PARTICLE_OFFSET_ORIGIN_Y as d, PARTICLE_OFFSET_POSITION_X as e, PARTICLE_OFFSET_POSITION_Y as f, PARTICLE_OFFSET_SIZE as g, PARTICLE_OFFSET_VELOCITY_X as h, PARTICLE_OFFSET_VELOCITY_Y as i, PARTICLE_STRIDE_FLOATS as j, type PointRenderer as k, SVGRenderer as l, createWebGLPointRenderer as m, parseColorToRGBA as p };
|