@vfx-js/effects 1.0.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.
Files changed (71) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +58 -0
  3. package/lib/cjs/_curl-noise.d.ts +3 -0
  4. package/lib/cjs/_curl-noise.js +115 -0
  5. package/lib/cjs/_curl-noise.js.map +1 -0
  6. package/lib/cjs/_particle-common.d.ts +10 -0
  7. package/lib/cjs/_particle-common.js +98 -0
  8. package/lib/cjs/_particle-common.js.map +1 -0
  9. package/lib/cjs/bloom.d.ts +50 -0
  10. package/lib/cjs/bloom.js +452 -0
  11. package/lib/cjs/bloom.js.map +1 -0
  12. package/lib/cjs/fluid.d.ts +35 -0
  13. package/lib/cjs/fluid.js +407 -0
  14. package/lib/cjs/fluid.js.map +1 -0
  15. package/lib/cjs/halftone.d.ts +65 -0
  16. package/lib/cjs/halftone.js +272 -0
  17. package/lib/cjs/halftone.js.map +1 -0
  18. package/lib/cjs/index.d.ts +8 -0
  19. package/lib/cjs/index.js +20 -0
  20. package/lib/cjs/index.js.map +1 -0
  21. package/lib/cjs/package.json +57 -0
  22. package/lib/cjs/particle-explode.d.ts +48 -0
  23. package/lib/cjs/particle-explode.js +466 -0
  24. package/lib/cjs/particle-explode.js.map +1 -0
  25. package/lib/cjs/particle.d.ts +78 -0
  26. package/lib/cjs/particle.js +710 -0
  27. package/lib/cjs/particle.js.map +1 -0
  28. package/lib/cjs/pixelate.d.ts +11 -0
  29. package/lib/cjs/pixelate.js +48 -0
  30. package/lib/cjs/pixelate.js.map +1 -0
  31. package/lib/cjs/scanline.d.ts +11 -0
  32. package/lib/cjs/scanline.js +48 -0
  33. package/lib/cjs/scanline.js.map +1 -0
  34. package/lib/cjs/voronoi.d.ts +35 -0
  35. package/lib/cjs/voronoi.js +266 -0
  36. package/lib/cjs/voronoi.js.map +1 -0
  37. package/lib/esm/_curl-noise.d.ts +3 -0
  38. package/lib/esm/_curl-noise.js +112 -0
  39. package/lib/esm/_curl-noise.js.map +1 -0
  40. package/lib/esm/_particle-common.d.ts +10 -0
  41. package/lib/esm/_particle-common.js +91 -0
  42. package/lib/esm/_particle-common.js.map +1 -0
  43. package/lib/esm/bloom.d.ts +50 -0
  44. package/lib/esm/bloom.js +448 -0
  45. package/lib/esm/bloom.js.map +1 -0
  46. package/lib/esm/fluid.d.ts +35 -0
  47. package/lib/esm/fluid.js +403 -0
  48. package/lib/esm/fluid.js.map +1 -0
  49. package/lib/esm/halftone.d.ts +65 -0
  50. package/lib/esm/halftone.js +268 -0
  51. package/lib/esm/halftone.js.map +1 -0
  52. package/lib/esm/index.d.ts +8 -0
  53. package/lib/esm/index.js +9 -0
  54. package/lib/esm/index.js.map +1 -0
  55. package/lib/esm/package.json +57 -0
  56. package/lib/esm/particle-explode.d.ts +48 -0
  57. package/lib/esm/particle-explode.js +462 -0
  58. package/lib/esm/particle-explode.js.map +1 -0
  59. package/lib/esm/particle.d.ts +78 -0
  60. package/lib/esm/particle.js +706 -0
  61. package/lib/esm/particle.js.map +1 -0
  62. package/lib/esm/pixelate.d.ts +11 -0
  63. package/lib/esm/pixelate.js +44 -0
  64. package/lib/esm/pixelate.js.map +1 -0
  65. package/lib/esm/scanline.d.ts +11 -0
  66. package/lib/esm/scanline.js +44 -0
  67. package/lib/esm/scanline.js.map +1 -0
  68. package/lib/esm/voronoi.d.ts +35 -0
  69. package/lib/esm/voronoi.js +262 -0
  70. package/lib/esm/voronoi.js.map +1 -0
  71. package/package.json +69 -0
@@ -0,0 +1,706 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
+ if (kind === "m") throw new TypeError("Private method is not writable");
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
+ };
12
+ var _ParticleEffect_instances, _ParticleEffect_params, _ParticleEffect_posTex, _ParticleEffect_colorTex, _ParticleEffect_velTex, _ParticleEffect_stampTex, _ParticleEffect_trail, _ParticleEffect_initialized, _ParticleEffect_stateSize, _ParticleEffect_stateCapacity, _ParticleEffect_spawnUniform, _ParticleEffect_spawnRawTex, _ParticleEffect_spawnTexHandle, _ParticleEffect_spawnGeometry, _ParticleEffect_particleGeometry, _ParticleEffect_gl, _ParticleEffect_contextRestoredUnsub, _ParticleEffect_nextSlot, _ParticleEffect_birthAccumulator, _ParticleEffect_screenBirthAccumulator, _ParticleEffect_lastMouseUv, _ParticleEffect_lastMoveTime, _ParticleEffect_allocStateRTs, _ParticleEffect_disposeStateRTs, _ParticleEffect_createSpawnTex, _ParticleEffect_allocSpawnTextures, _ParticleEffect_uploadSpawnTextures, _ParticleEffect_scheduleSpawns, _ParticleEffect_cap;
13
+ import { GLSL_CURL_NOISE, LIFE_JITTER_MAX, LIFE_JITTER_MIN, } from "./_curl-noise";
14
+ import { clampDt, FRAG_CLEAR, FRAG_PARTICLE, FRAG_TRAIL_COMPOSITE, GLSL_HASH, hexToRgb, QUAD_VERTS, sanitizeCount, stateSizeFromCount, } from "./_particle-common";
15
+ // State texture footprint: 4 internal buffers total (pos persistent =
16
+ // 2 internal, color + vel single = 1 each) × stateSize² × 16 B =
17
+ // 64 MB at 1024 (RGBA32F) / 32 MB at RGBA16F fallback at the 1M cap.
18
+ // color/vel can be single-buffer because only the spawn pass writes
19
+ // to them and the other texels persist naturally.
20
+ // Per-frame spawn budget. Spawn entries are uploaded to a square data
21
+ // texture (vec4 per entry: slotId, uvX, uvY, dirAngle) sampled by the
22
+ // gl.POINTS spawn pass. dirAngle = theta in [0, 2π) for mouse spawns,
23
+ // -1 sentinel for screen spawns (no radial impulse). lifeJitter is
24
+ // derived on the GPU via hash. 64×64 = 4096 spawns/frame ≈ 245k
25
+ // spawns/sec at 60 fps.
26
+ const SPAWN_TEX_SIZE = 64;
27
+ const MAX_SPAWNS_PER_FRAME = SPAWN_TEX_SIZE * SPAWN_TEX_SIZE;
28
+ // Active mouse if it moved within this window (sec) — otherwise spawn
29
+ // only when `params.spawnOnIdle` is set.
30
+ const IDLE_THRESHOLD = 0.1;
31
+ const SPAWN_TEX_SIZE_VEC = [SPAWN_TEX_SIZE, SPAWN_TEX_SIZE];
32
+ // Vertex index per spawn slot. Read in VERT_SPAWN as `int(position)` to
33
+ // pick the right entry in uSpawnTex without depending on gl_VertexID,
34
+ // and to give EffectGeometry a `position` attribute it can count.
35
+ const SPAWN_VERTEX_INDICES = new Float32Array(MAX_SPAWNS_PER_FRAME);
36
+ for (let i = 0; i < MAX_SPAWNS_PER_FRAME; i++) {
37
+ SPAWN_VERTEX_INDICES[i] = i;
38
+ }
39
+ // age = 2.0 keeps every slot dead until UPDATE writes a fresh particle.
40
+ const FRAG_INIT_POS = `#version 300 es
41
+ precision highp float;
42
+ out vec4 outColor;
43
+ void main() {
44
+ outColor = vec4(0.0, 0.0, 0.0, 2.0);
45
+ }
46
+ `;
47
+ const FRAG_INIT_COLOR = `#version 300 es
48
+ precision highp float;
49
+ out vec4 outColor;
50
+ void main() {
51
+ outColor = vec4(0.0);
52
+ }
53
+ `;
54
+ const VERT_PARTICLE = `#version 300 es
55
+ precision highp float;
56
+ in vec2 position;
57
+
58
+ uniform sampler2D posTex;
59
+ uniform sampler2D colorTex;
60
+ uniform vec2 stateSize;
61
+ uniform float pointSize;
62
+ uniform vec2 elementPixel;
63
+ uniform int particleCount;
64
+ uniform float alpha;
65
+ uniform float alphaDecay;
66
+ uniform float fadeIn;
67
+ uniform float fog;
68
+ uniform vec4 contentRectUv;
69
+
70
+ out vec2 vCorner;
71
+ out vec4 vColor;
72
+
73
+ void main() {
74
+ int id = gl_InstanceID;
75
+ if (id >= particleCount) {
76
+ gl_Position = vec4(2.0, 2.0, 2.0, 1.0);
77
+ vCorner = vec2(0.0);
78
+ vColor = vec4(0.0);
79
+ return;
80
+ }
81
+ int sx = id % int(stateSize.x);
82
+ int sy = id / int(stateSize.x);
83
+ vec2 stateUv = (vec2(float(sx), float(sy)) + 0.5) / stateSize;
84
+ vec4 s = texture(posTex, stateUv);
85
+ vec4 c = texture(colorTex, stateUv);
86
+
87
+ float age = s.w;
88
+ // smoothstep rise to ~1 at age=fadeIn, then pow-shaped decay to 0
89
+ // at age=1. Small fadeIn keeps the radial-emit phase visible;
90
+ // larger values restore the slow fade-in look.
91
+ float rise = fadeIn > 0.0 ? smoothstep(0.0, fadeIn, age) : 1.0;
92
+ float fall = pow(max(1.0 - age, 0.0), alphaDecay);
93
+ float lifeAlpha = rise * fall;
94
+ if (lifeAlpha <= 0.0) {
95
+ gl_Position = vec4(2.0, 2.0, 2.0, 1.0);
96
+ vCorner = vec2(0.0);
97
+ vColor = vec4(0.0);
98
+ return;
99
+ }
100
+
101
+ float fogFactor = fog > 0.0
102
+ ? mix(1.0, smoothstep(1.0, -0.5, s.z), fog)
103
+ : 1.0;
104
+
105
+ vec2 bufferUv = contentRectUv.xy + s.xy * contentRectUv.zw;
106
+ vec2 ndcPos = bufferUv * 2.0 - 1.0;
107
+
108
+ vec2 bufferPixel = elementPixel / max(contentRectUv.zw, vec2(1e-6));
109
+ vec2 ndcOffset = position * pointSize * 2.0 / bufferPixel;
110
+ gl_Position = vec4(ndcPos + ndcOffset, 0.0, 1.0);
111
+
112
+ vCorner = position;
113
+ vColor = vec4(c.rgb, lifeAlpha * alpha * fogFactor);
114
+ }
115
+ `;
116
+ const FRAG_OUTPUT = `#version 300 es
117
+ precision highp float;
118
+ in vec2 uv;
119
+ in vec2 uvSrc;
120
+ out vec4 outColor;
121
+
122
+ uniform sampler2D src;
123
+ uniform sampler2D trail;
124
+ uniform float srcOpacity;
125
+
126
+ void main() {
127
+ // src is element-sized; the trail buffer extends to the canvas, so
128
+ // mask src outside [0,1].
129
+ vec2 inside = step(vec2(0.0), uvSrc) * step(uvSrc, vec2(1.0));
130
+ float srcMask = inside.x * inside.y;
131
+ vec4 base = texture(src, clamp(uvSrc, 0.0, 1.0))
132
+ * srcOpacity * srcMask;
133
+ vec4 t = texture(trail, uv);
134
+ outColor = vec4(base.rgb * (1.0 - t.a) + t.rgb, max(base.a, t.a));
135
+ }
136
+ `;
137
+ // Full-screen advect pass. Reads posTex (and colorTex.w for life
138
+ // jitter), blends a radial impulse (from velTex, set at spawn) with the
139
+ // curl-noise field as the particle ages. Spawns are written separately
140
+ // by the gl.POINTS spawn pass below.
141
+ const FRAG_ADVECT_POS = `#version 300 es
142
+ precision highp float;
143
+ in vec2 uv;
144
+ out vec4 outColor;
145
+
146
+ uniform sampler2D posTex;
147
+ uniform sampler2D colorTex;
148
+ uniform sampler2D velTex;
149
+ uniform vec2 elementPixel;
150
+ uniform float time;
151
+ uniform float dt;
152
+ uniform float noiseSpeed;
153
+ uniform float emitSpeed;
154
+ uniform float noiseDelay;
155
+ uniform float noiseScale;
156
+ uniform float noiseAnimation;
157
+ uniform float speedDecay;
158
+ uniform float life;
159
+ ${GLSL_CURL_NOISE}
160
+
161
+ void main() {
162
+ vec4 s = texture(posTex, uv);
163
+ float age = s.w;
164
+ if (age >= 1.0) {
165
+ outColor = s;
166
+ return;
167
+ }
168
+
169
+ vec3 curlV = sampleCurl(s.xyz, elementPixel, noiseScale, time * noiseAnimation);
170
+
171
+ // velTex.xy is a unit direction in pixel space (0 for screen
172
+ // spawns). Multiplying by shortAxis/elementPixel converts to a
173
+ // uv-space velocity that's isotropic in screen px (circular blast
174
+ // on non-square elements) and short-axis-normalized so emitSpeed
175
+ // and noiseSpeed share the same uv/sec scale.
176
+ vec2 radialDirPx = texture(velTex, uv).xy;
177
+ float shortAxis = min(elementPixel.x, elementPixel.y);
178
+ vec3 radialV = vec3(
179
+ radialDirPx * shortAxis / max(elementPixel, vec2(1.0)),
180
+ 0.0
181
+ );
182
+
183
+ float blend = noiseDelay > 0.0 ? smoothstep(0.0, noiseDelay, age) : 1.0;
184
+ vec3 v = mix(radialV * emitSpeed, curlV * noiseSpeed, blend);
185
+
186
+ float taper = pow(clamp(1.0 - age, 0.0, 1.0), speedDecay);
187
+ vec3 pos = s.xyz + v * dt * taper;
188
+
189
+ float lifeMul = max(texture(colorTex, uv).w, 1e-3);
190
+ age += dt / (max(life, 1e-3) * lifeMul);
191
+
192
+ outColor = vec4(pos, age);
193
+ }
194
+ `;
195
+ // Spawn pass: gl.POINTS, one point per spawn entry. Each vertex pulls
196
+ // (slotId, uvX, uvY, dirAngle) from uSpawnTex, computes the target
197
+ // state texel center as gl_Position, and writes a single texel of the
198
+ // pos / color / vel RT. The `position` attribute carries the spawn-slot
199
+ // index (0..MAX-1) and gives EffectGeometry its vertex count.
200
+ const VERT_SPAWN = `#version 300 es
201
+ precision highp float;
202
+ in float position;
203
+
204
+ uniform sampler2D uSpawnTex;
205
+ uniform vec2 uSpawnTexSize;
206
+ uniform int uSpawnCount;
207
+ uniform vec2 stateSize;
208
+
209
+ out vec4 vSpawn;
210
+
211
+ void main() {
212
+ int idx = int(position);
213
+ if (idx >= uSpawnCount) {
214
+ gl_Position = vec4(2.0, 2.0, 2.0, 1.0);
215
+ gl_PointSize = 0.0;
216
+ vSpawn = vec4(0.0);
217
+ return;
218
+ }
219
+ int sx = idx % int(uSpawnTexSize.x);
220
+ int sy = idx / int(uSpawnTexSize.x);
221
+ vec4 s = texelFetch(uSpawnTex, ivec2(sx, sy), 0);
222
+ int slot = int(s.x);
223
+ int tx = slot % int(stateSize.x);
224
+ int ty = slot / int(stateSize.x);
225
+ vec2 ndc = (vec2(float(tx), float(ty)) + 0.5) / stateSize * 2.0 - 1.0;
226
+ gl_Position = vec4(ndc, 0.0, 1.0);
227
+ gl_PointSize = 1.0;
228
+ vSpawn = s;
229
+ }
230
+ `;
231
+ const FRAG_SPAWN_POS = `#version 300 es
232
+ precision highp float;
233
+ in vec4 vSpawn;
234
+ out vec4 outColor;
235
+
236
+ uniform sampler2D src;
237
+ uniform float alphaThreshold;
238
+
239
+ void main() {
240
+ vec2 spawnUv = vSpawn.yz;
241
+ vec2 inside = step(vec2(0.0), spawnUv) * step(spawnUv, vec2(1.0));
242
+ float visible = inside.x * inside.y;
243
+ float a = texture(src, clamp(spawnUv, 0.0, 1.0)).a * visible;
244
+ if (a < alphaThreshold) {
245
+ outColor = vec4(0.0, 0.0, 0.0, 2.0); // born dead
246
+ return;
247
+ }
248
+ outColor = vec4(spawnUv, 0.0, 0.0);
249
+ }
250
+ `;
251
+ // lifeJitter is hashed from the spawn entry (slot id + uv) to keep
252
+ // every spawn varied without a CPU-side random.
253
+ const FRAG_SPAWN_COLOR = `#version 300 es
254
+ precision highp float;
255
+ in vec4 vSpawn;
256
+ out vec4 outColor;
257
+
258
+ uniform sampler2D src;
259
+ uniform vec3 color;
260
+ uniform float colorMix;
261
+ uniform vec2 lifeJitterRange;
262
+ ${GLSL_HASH}
263
+
264
+ void main() {
265
+ vec4 c = texture(src, clamp(vSpawn.yz, 0.0, 1.0));
266
+ float h = hash21(vSpawn.yz + vec2(vSpawn.x) * 1.7);
267
+ float lifeJitter = mix(lifeJitterRange.x, lifeJitterRange.y, h);
268
+ outColor = vec4(mix(c.rgb, color, colorMix), lifeJitter);
269
+ }
270
+ `;
271
+ // Writes the radial direction (unit vector in pixel space) per spawn
272
+ // slot from vSpawn.w (theta). Screen spawns carry -1 sentinel and get
273
+ // zero velocity so they receive only curl-noise advection.
274
+ const FRAG_SPAWN_VEL = `#version 300 es
275
+ precision highp float;
276
+ in vec4 vSpawn;
277
+ out vec4 outColor;
278
+ void main() {
279
+ float theta = vSpawn.w;
280
+ vec2 dir = theta >= 0.0 ? vec2(cos(theta), sin(theta)) : vec2(0.0);
281
+ outColor = vec4(dir, 0.0, 0.0);
282
+ }
283
+ `;
284
+ const DEFAULT_PARAMS = {
285
+ count: 1024 * 1024,
286
+ birthRate: 30000,
287
+ screenBirthRate: 10000,
288
+ life: 1.0,
289
+ noiseSpeed: 0.3,
290
+ emitSpeed: 1.0,
291
+ noiseDelay: 0.15,
292
+ noiseScale: 1,
293
+ noiseAnimation: 0.3,
294
+ pointSize: 10.0,
295
+ alpha: 1,
296
+ radius: 300,
297
+ speedDecay: 1.0,
298
+ alphaDecay: 5.0,
299
+ fadeIn: 0.05,
300
+ alphaThreshold: 0.05,
301
+ spawnOnIdle: true,
302
+ srcOpacity: 0.0,
303
+ trailFade: 0.75,
304
+ fog: 0.5,
305
+ color: 0xffffff,
306
+ colorMix: 0.0,
307
+ blend: "add",
308
+ };
309
+ export class ParticleEffect {
310
+ /** Read-only view of the current params. Use `setParam(key, value)`
311
+ * to mutate so values like `count` are sanitized. (External tools
312
+ * such as tweakpane bind directly to the underlying object and
313
+ * skip the validation; the type marker is for programmatic use.) */
314
+ get params() {
315
+ return __classPrivateFieldGet(this, _ParticleEffect_params, "f");
316
+ }
317
+ constructor(initial = {}) {
318
+ _ParticleEffect_instances.add(this);
319
+ _ParticleEffect_params.set(this, void 0);
320
+ _ParticleEffect_posTex.set(this, null);
321
+ _ParticleEffect_colorTex.set(this, null);
322
+ _ParticleEffect_velTex.set(this, null);
323
+ _ParticleEffect_stampTex.set(this, null);
324
+ _ParticleEffect_trail.set(this, null);
325
+ _ParticleEffect_initialized.set(this, false);
326
+ _ParticleEffect_stateSize.set(this, void 0);
327
+ _ParticleEffect_stateCapacity.set(this, void 0);
328
+ _ParticleEffect_spawnUniform.set(this, new Float32Array(MAX_SPAWNS_PER_FRAME * 4));
329
+ _ParticleEffect_spawnRawTex.set(this, null);
330
+ _ParticleEffect_spawnTexHandle.set(this, null);
331
+ _ParticleEffect_spawnGeometry.set(this, null);
332
+ _ParticleEffect_particleGeometry.set(this, null);
333
+ _ParticleEffect_gl.set(this, null);
334
+ _ParticleEffect_contextRestoredUnsub.set(this, null);
335
+ _ParticleEffect_nextSlot.set(this, 0);
336
+ _ParticleEffect_birthAccumulator.set(this, 0);
337
+ _ParticleEffect_screenBirthAccumulator.set(this, 0);
338
+ _ParticleEffect_lastMouseUv.set(this, null);
339
+ _ParticleEffect_lastMoveTime.set(this, -Infinity);
340
+ __classPrivateFieldSet(this, _ParticleEffect_params, { ...DEFAULT_PARAMS, ...initial }, "f");
341
+ __classPrivateFieldGet(this, _ParticleEffect_params, "f").count = sanitizeCount(__classPrivateFieldGet(this, _ParticleEffect_params, "f").count);
342
+ __classPrivateFieldSet(this, _ParticleEffect_stateSize, stateSizeFromCount(__classPrivateFieldGet(this, _ParticleEffect_params, "f").count), "f");
343
+ __classPrivateFieldSet(this, _ParticleEffect_stateCapacity, __classPrivateFieldGet(this, _ParticleEffect_stateSize, "f") * __classPrivateFieldGet(this, _ParticleEffect_stateSize, "f"), "f");
344
+ }
345
+ get maxCount() {
346
+ return __classPrivateFieldGet(this, _ParticleEffect_stateCapacity, "f");
347
+ }
348
+ /** Validated bulk setter. Pass any subset of params; bad inputs
349
+ * (NaN / negative `count`, etc) are coerced to valid values
350
+ * before applying. */
351
+ setParam(updates) {
352
+ const target = __classPrivateFieldGet(this, _ParticleEffect_params, "f");
353
+ for (const [k, v] of Object.entries(updates)) {
354
+ if (v === undefined) {
355
+ continue;
356
+ }
357
+ target[k] = k === "count" ? sanitizeCount(v) : v;
358
+ }
359
+ }
360
+ init(ctx) {
361
+ __classPrivateFieldGet(this, _ParticleEffect_instances, "m", _ParticleEffect_allocStateRTs).call(this, ctx);
362
+ __classPrivateFieldSet(this, _ParticleEffect_stampTex, ctx.createRenderTarget({
363
+ float: false,
364
+ wrap: "clamp",
365
+ filter: "linear",
366
+ }), "f");
367
+ __classPrivateFieldSet(this, _ParticleEffect_trail, ctx.createRenderTarget({
368
+ float: false,
369
+ persistent: true,
370
+ wrap: "clamp",
371
+ filter: "linear",
372
+ }), "f");
373
+ __classPrivateFieldSet(this, _ParticleEffect_particleGeometry, {
374
+ attributes: { position: QUAD_VERTS },
375
+ }, "f");
376
+ __classPrivateFieldSet(this, _ParticleEffect_spawnGeometry, {
377
+ mode: "points",
378
+ attributes: {
379
+ position: { data: SPAWN_VERTEX_INDICES, itemSize: 1 },
380
+ },
381
+ }, "f");
382
+ __classPrivateFieldSet(this, _ParticleEffect_gl, ctx.gl, "f");
383
+ __classPrivateFieldGet(this, _ParticleEffect_instances, "m", _ParticleEffect_allocSpawnTextures).call(this, ctx);
384
+ __classPrivateFieldSet(this, _ParticleEffect_contextRestoredUnsub, ctx.onContextRestored(() => {
385
+ __classPrivateFieldSet(this, _ParticleEffect_gl, ctx.gl, "f");
386
+ __classPrivateFieldGet(this, _ParticleEffect_instances, "m", _ParticleEffect_allocSpawnTextures).call(this, ctx);
387
+ __classPrivateFieldSet(this, _ParticleEffect_initialized, false, "f");
388
+ }), "f");
389
+ }
390
+ render(ctx) {
391
+ if (!__classPrivateFieldGet(this, _ParticleEffect_posTex, "f") ||
392
+ !__classPrivateFieldGet(this, _ParticleEffect_colorTex, "f") ||
393
+ !__classPrivateFieldGet(this, _ParticleEffect_velTex, "f") ||
394
+ !__classPrivateFieldGet(this, _ParticleEffect_stampTex, "f") ||
395
+ !__classPrivateFieldGet(this, _ParticleEffect_trail, "f") ||
396
+ !__classPrivateFieldGet(this, _ParticleEffect_particleGeometry, "f") ||
397
+ !__classPrivateFieldGet(this, _ParticleEffect_spawnGeometry, "f") ||
398
+ !__classPrivateFieldGet(this, _ParticleEffect_spawnTexHandle, "f") ||
399
+ !__classPrivateFieldGet(this, _ParticleEffect_spawnRawTex, "f")) {
400
+ return;
401
+ }
402
+ // Resize state RTs if `params.count` crossed a power-of-two
403
+ // boundary. dispose-then-create keeps peak GPU memory minimal;
404
+ // the FRAG_INIT pass below seeds the fresh RTs.
405
+ const newSize = stateSizeFromCount(this.params.count);
406
+ if (newSize !== __classPrivateFieldGet(this, _ParticleEffect_stateSize, "f")) {
407
+ __classPrivateFieldGet(this, _ParticleEffect_instances, "m", _ParticleEffect_disposeStateRTs).call(this);
408
+ __classPrivateFieldSet(this, _ParticleEffect_stateSize, newSize, "f");
409
+ __classPrivateFieldSet(this, _ParticleEffect_stateCapacity, newSize * newSize, "f");
410
+ __classPrivateFieldGet(this, _ParticleEffect_instances, "m", _ParticleEffect_allocStateRTs).call(this, ctx);
411
+ __classPrivateFieldSet(this, _ParticleEffect_nextSlot, 0, "f");
412
+ __classPrivateFieldSet(this, _ParticleEffect_initialized, false, "f");
413
+ }
414
+ if (!__classPrivateFieldGet(this, _ParticleEffect_initialized, "f")) {
415
+ // posTex's "stale" half gets overwritten on the first
416
+ // advect+swap, so a single init draw is enough. color/vel
417
+ // are single-buffer; one clear gives every dead slot known
418
+ // contents until the spawn pass writes it.
419
+ ctx.draw({ frag: FRAG_INIT_POS, target: __classPrivateFieldGet(this, _ParticleEffect_posTex, "f") });
420
+ ctx.draw({ frag: FRAG_INIT_COLOR, target: __classPrivateFieldGet(this, _ParticleEffect_colorTex, "f") });
421
+ ctx.draw({ frag: FRAG_INIT_COLOR, target: __classPrivateFieldGet(this, _ParticleEffect_velTex, "f") });
422
+ __classPrivateFieldSet(this, _ParticleEffect_initialized, true, "f");
423
+ }
424
+ const dt = clampDt(ctx.deltaTime);
425
+ const elementPixel = [
426
+ ctx.dims.elementPixel[0],
427
+ ctx.dims.elementPixel[1],
428
+ ];
429
+ const stateSizeVec = [
430
+ __classPrivateFieldGet(this, _ParticleEffect_stateSize, "f"),
431
+ __classPrivateFieldGet(this, _ParticleEffect_stateSize, "f"),
432
+ ];
433
+ const nSpawn = __classPrivateFieldGet(this, _ParticleEffect_instances, "m", _ParticleEffect_scheduleSpawns).call(this, ctx, dt, elementPixel);
434
+ if (nSpawn > 0) {
435
+ __classPrivateFieldGet(this, _ParticleEffect_instances, "m", _ParticleEffect_uploadSpawnTextures).call(this, ctx);
436
+ }
437
+ // advect skips its swap when a spawn pass follows, so both
438
+ // passes write into the same internal buffer of the persistent
439
+ // posTex. The spawn pass (or advect itself when nSpawn === 0)
440
+ // triggers the per-frame swap.
441
+ const advectSwap = nSpawn === 0;
442
+ ctx.draw({
443
+ frag: FRAG_ADVECT_POS,
444
+ uniforms: {
445
+ posTex: __classPrivateFieldGet(this, _ParticleEffect_posTex, "f"),
446
+ colorTex: __classPrivateFieldGet(this, _ParticleEffect_colorTex, "f"),
447
+ velTex: __classPrivateFieldGet(this, _ParticleEffect_velTex, "f"),
448
+ elementPixel,
449
+ time: ctx.time,
450
+ dt,
451
+ noiseSpeed: this.params.noiseSpeed,
452
+ emitSpeed: this.params.emitSpeed,
453
+ noiseDelay: this.params.noiseDelay,
454
+ noiseScale: this.params.noiseScale,
455
+ noiseAnimation: this.params.noiseAnimation,
456
+ speedDecay: this.params.speedDecay,
457
+ life: this.params.life,
458
+ },
459
+ target: __classPrivateFieldGet(this, _ParticleEffect_posTex, "f"),
460
+ swap: advectSwap,
461
+ });
462
+ if (nSpawn > 0) {
463
+ const spawnUniforms = {
464
+ uSpawnTex: __classPrivateFieldGet(this, _ParticleEffect_spawnTexHandle, "f"),
465
+ uSpawnTexSize: SPAWN_TEX_SIZE_VEC,
466
+ uSpawnCount: nSpawn,
467
+ stateSize: stateSizeVec,
468
+ };
469
+ ctx.draw({
470
+ vert: VERT_SPAWN,
471
+ frag: FRAG_SPAWN_POS,
472
+ geometry: __classPrivateFieldGet(this, _ParticleEffect_spawnGeometry, "f"),
473
+ uniforms: {
474
+ ...spawnUniforms,
475
+ src: ctx.src,
476
+ alphaThreshold: this.params.alphaThreshold,
477
+ },
478
+ target: __classPrivateFieldGet(this, _ParticleEffect_posTex, "f"),
479
+ blend: "none",
480
+ });
481
+ ctx.draw({
482
+ vert: VERT_SPAWN,
483
+ frag: FRAG_SPAWN_COLOR,
484
+ geometry: __classPrivateFieldGet(this, _ParticleEffect_spawnGeometry, "f"),
485
+ uniforms: {
486
+ ...spawnUniforms,
487
+ src: ctx.src,
488
+ color: hexToRgb(this.params.color),
489
+ colorMix: this.params.colorMix,
490
+ lifeJitterRange: [LIFE_JITTER_MIN, LIFE_JITTER_MAX],
491
+ },
492
+ target: __classPrivateFieldGet(this, _ParticleEffect_colorTex, "f"),
493
+ blend: "none",
494
+ });
495
+ ctx.draw({
496
+ vert: VERT_SPAWN,
497
+ frag: FRAG_SPAWN_VEL,
498
+ geometry: __classPrivateFieldGet(this, _ParticleEffect_spawnGeometry, "f"),
499
+ uniforms: spawnUniforms,
500
+ target: __classPrivateFieldGet(this, _ParticleEffect_velTex, "f"),
501
+ blend: "none",
502
+ });
503
+ }
504
+ const cap = __classPrivateFieldGet(this, _ParticleEffect_instances, "m", _ParticleEffect_cap).call(this);
505
+ __classPrivateFieldGet(this, _ParticleEffect_particleGeometry, "f").instanceCount = cap;
506
+ ctx.draw({ frag: FRAG_CLEAR, target: __classPrivateFieldGet(this, _ParticleEffect_stampTex, "f") });
507
+ ctx.draw({
508
+ vert: VERT_PARTICLE,
509
+ frag: FRAG_PARTICLE,
510
+ uniforms: {
511
+ posTex: __classPrivateFieldGet(this, _ParticleEffect_posTex, "f"),
512
+ colorTex: __classPrivateFieldGet(this, _ParticleEffect_colorTex, "f"),
513
+ stateSize: stateSizeVec,
514
+ pointSize: this.params.pointSize,
515
+ elementPixel,
516
+ particleCount: cap,
517
+ alpha: this.params.alpha,
518
+ alphaDecay: this.params.alphaDecay,
519
+ fadeIn: this.params.fadeIn,
520
+ fog: this.params.fog,
521
+ },
522
+ geometry: __classPrivateFieldGet(this, _ParticleEffect_particleGeometry, "f"),
523
+ target: __classPrivateFieldGet(this, _ParticleEffect_stampTex, "f"),
524
+ blend: this.params.blend === "normal" ? "premultiplied" : "additive",
525
+ });
526
+ ctx.draw({
527
+ frag: FRAG_TRAIL_COMPOSITE,
528
+ uniforms: {
529
+ trailPrev: __classPrivateFieldGet(this, _ParticleEffect_trail, "f"),
530
+ particleStamp: __classPrivateFieldGet(this, _ParticleEffect_stampTex, "f"),
531
+ trailFade: this.params.trailFade,
532
+ blendMode: this.params.blend === "normal" ? 1 : 0,
533
+ },
534
+ target: __classPrivateFieldGet(this, _ParticleEffect_trail, "f"),
535
+ });
536
+ ctx.draw({
537
+ frag: FRAG_OUTPUT,
538
+ uniforms: {
539
+ src: ctx.src,
540
+ trail: __classPrivateFieldGet(this, _ParticleEffect_trail, "f"),
541
+ srcOpacity: this.params.srcOpacity,
542
+ },
543
+ target: ctx.target,
544
+ });
545
+ }
546
+ dispose() {
547
+ __classPrivateFieldGet(this, _ParticleEffect_contextRestoredUnsub, "f")?.call(this);
548
+ __classPrivateFieldSet(this, _ParticleEffect_contextRestoredUnsub, null, "f");
549
+ if (__classPrivateFieldGet(this, _ParticleEffect_gl, "f") && __classPrivateFieldGet(this, _ParticleEffect_spawnRawTex, "f")) {
550
+ __classPrivateFieldGet(this, _ParticleEffect_gl, "f").deleteTexture(__classPrivateFieldGet(this, _ParticleEffect_spawnRawTex, "f"));
551
+ }
552
+ __classPrivateFieldSet(this, _ParticleEffect_spawnRawTex, null, "f");
553
+ __classPrivateFieldSet(this, _ParticleEffect_spawnTexHandle, null, "f");
554
+ __classPrivateFieldSet(this, _ParticleEffect_spawnGeometry, null, "f");
555
+ __classPrivateFieldSet(this, _ParticleEffect_gl, null, "f");
556
+ __classPrivateFieldGet(this, _ParticleEffect_instances, "m", _ParticleEffect_disposeStateRTs).call(this);
557
+ __classPrivateFieldGet(this, _ParticleEffect_stampTex, "f")?.dispose();
558
+ __classPrivateFieldGet(this, _ParticleEffect_trail, "f")?.dispose();
559
+ __classPrivateFieldSet(this, _ParticleEffect_stampTex, null, "f");
560
+ __classPrivateFieldSet(this, _ParticleEffect_trail, null, "f");
561
+ __classPrivateFieldSet(this, _ParticleEffect_particleGeometry, null, "f");
562
+ __classPrivateFieldSet(this, _ParticleEffect_initialized, false, "f");
563
+ }
564
+ outputRect(dims) {
565
+ return dims.canvasRect;
566
+ }
567
+ }
568
+ _ParticleEffect_params = new WeakMap(), _ParticleEffect_posTex = new WeakMap(), _ParticleEffect_colorTex = new WeakMap(), _ParticleEffect_velTex = new WeakMap(), _ParticleEffect_stampTex = new WeakMap(), _ParticleEffect_trail = new WeakMap(), _ParticleEffect_initialized = new WeakMap(), _ParticleEffect_stateSize = new WeakMap(), _ParticleEffect_stateCapacity = new WeakMap(), _ParticleEffect_spawnUniform = new WeakMap(), _ParticleEffect_spawnRawTex = new WeakMap(), _ParticleEffect_spawnTexHandle = new WeakMap(), _ParticleEffect_spawnGeometry = new WeakMap(), _ParticleEffect_particleGeometry = new WeakMap(), _ParticleEffect_gl = new WeakMap(), _ParticleEffect_contextRestoredUnsub = new WeakMap(), _ParticleEffect_nextSlot = new WeakMap(), _ParticleEffect_birthAccumulator = new WeakMap(), _ParticleEffect_screenBirthAccumulator = new WeakMap(), _ParticleEffect_lastMouseUv = new WeakMap(), _ParticleEffect_lastMoveTime = new WeakMap(), _ParticleEffect_instances = new WeakSet(), _ParticleEffect_allocStateRTs = function _ParticleEffect_allocStateRTs(ctx) {
569
+ const stateOpts = {
570
+ size: [__classPrivateFieldGet(this, _ParticleEffect_stateSize, "f"), __classPrivateFieldGet(this, _ParticleEffect_stateSize, "f")],
571
+ float: true,
572
+ wrap: "clamp",
573
+ filter: "nearest",
574
+ };
575
+ // pos uses auto-ping-pong (`persistent: true`); advect runs
576
+ // with `swap: false` so the subsequent spawn pass lands in the
577
+ // same internal buffer. color/vel are single-buffer — only the
578
+ // spawn pass writes them, other texels persist naturally.
579
+ __classPrivateFieldSet(this, _ParticleEffect_posTex, ctx.createRenderTarget({
580
+ ...stateOpts,
581
+ persistent: true,
582
+ }), "f");
583
+ __classPrivateFieldSet(this, _ParticleEffect_colorTex, ctx.createRenderTarget(stateOpts), "f");
584
+ __classPrivateFieldSet(this, _ParticleEffect_velTex, ctx.createRenderTarget(stateOpts), "f");
585
+ }, _ParticleEffect_disposeStateRTs = function _ParticleEffect_disposeStateRTs() {
586
+ __classPrivateFieldGet(this, _ParticleEffect_posTex, "f")?.dispose();
587
+ __classPrivateFieldGet(this, _ParticleEffect_colorTex, "f")?.dispose();
588
+ __classPrivateFieldGet(this, _ParticleEffect_velTex, "f")?.dispose();
589
+ __classPrivateFieldSet(this, _ParticleEffect_posTex, null, "f");
590
+ __classPrivateFieldSet(this, _ParticleEffect_colorTex, null, "f");
591
+ __classPrivateFieldSet(this, _ParticleEffect_velTex, null, "f");
592
+ }, _ParticleEffect_createSpawnTex = function _ParticleEffect_createSpawnTex(ctx) {
593
+ const gl = ctx.gl;
594
+ const tex = gl.createTexture();
595
+ if (!tex) {
596
+ throw new Error("[ParticleEffect] Failed to create spawn texture");
597
+ }
598
+ gl.bindTexture(gl.TEXTURE_2D, tex);
599
+ // Counteract the global UNPACK_FLIP_Y_WEBGL=true that the
600
+ // framework sets for DOM source uploads — our spawn data is a
601
+ // raw float buffer with row 0 at the top, no flip wanted.
602
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
603
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, SPAWN_TEX_SIZE, SPAWN_TEX_SIZE, 0, gl.RGBA, gl.FLOAT, null);
604
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
605
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
606
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
607
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
608
+ gl.bindTexture(gl.TEXTURE_2D, null);
609
+ const handle = ctx.wrapTexture(tex, {
610
+ size: [SPAWN_TEX_SIZE, SPAWN_TEX_SIZE],
611
+ filter: "nearest",
612
+ wrap: "clamp",
613
+ });
614
+ return { raw: tex, handle };
615
+ }, _ParticleEffect_allocSpawnTextures = function _ParticleEffect_allocSpawnTextures(ctx) {
616
+ const a = __classPrivateFieldGet(this, _ParticleEffect_instances, "m", _ParticleEffect_createSpawnTex).call(this, ctx);
617
+ __classPrivateFieldSet(this, _ParticleEffect_spawnRawTex, a.raw, "f");
618
+ __classPrivateFieldSet(this, _ParticleEffect_spawnTexHandle, a.handle, "f");
619
+ }, _ParticleEffect_uploadSpawnTextures = function _ParticleEffect_uploadSpawnTextures(ctx) {
620
+ if (!__classPrivateFieldGet(this, _ParticleEffect_spawnRawTex, "f")) {
621
+ return;
622
+ }
623
+ const gl = ctx.gl;
624
+ // Reset framework's global UNPACK_FLIP_Y_WEBGL=true (set for
625
+ // DOM source uploads) so row 0 of our raw float buffer maps to
626
+ // row 0 of the texture.
627
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
628
+ gl.bindTexture(gl.TEXTURE_2D, __classPrivateFieldGet(this, _ParticleEffect_spawnRawTex, "f"));
629
+ gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, SPAWN_TEX_SIZE, SPAWN_TEX_SIZE, gl.RGBA, gl.FLOAT, __classPrivateFieldGet(this, _ParticleEffect_spawnUniform, "f"));
630
+ gl.bindTexture(gl.TEXTURE_2D, null);
631
+ }, _ParticleEffect_scheduleSpawns = function _ParticleEffect_scheduleSpawns(ctx, dt, elementPixel) {
632
+ const mouseUv = [
633
+ ctx.mouse[0] / Math.max(1, elementPixel[0]),
634
+ ctx.mouse[1] / Math.max(1, elementPixel[1]),
635
+ ];
636
+ const moved = !__classPrivateFieldGet(this, _ParticleEffect_lastMouseUv, "f") ||
637
+ Math.abs(mouseUv[0] - __classPrivateFieldGet(this, _ParticleEffect_lastMouseUv, "f")[0]) > 1e-6 ||
638
+ Math.abs(mouseUv[1] - __classPrivateFieldGet(this, _ParticleEffect_lastMouseUv, "f")[1]) > 1e-6;
639
+ if (moved) {
640
+ __classPrivateFieldSet(this, _ParticleEffect_lastMoveTime, ctx.time, "f");
641
+ }
642
+ __classPrivateFieldSet(this, _ParticleEffect_lastMouseUv, mouseUv, "f");
643
+ const visible = ctx.intersection > 0;
644
+ const recent = ctx.time - __classPrivateFieldGet(this, _ParticleEffect_lastMoveTime, "f") < IDLE_THRESHOLD;
645
+ const mouseActive = visible && (recent || this.params.spawnOnIdle);
646
+ // Cap accumulators at the per-frame budget so a birthRate that
647
+ // exceeds MAX_SPAWNS_PER_FRAME × fps doesn't queue indefinitely
648
+ // and bleed spawns past when the user expects (e.g., still
649
+ // emitting after the cursor stops on a high birthRate setting).
650
+ if (mouseActive) {
651
+ __classPrivateFieldSet(this, _ParticleEffect_birthAccumulator, Math.min(__classPrivateFieldGet(this, _ParticleEffect_birthAccumulator, "f") + this.params.birthRate * dt, MAX_SPAWNS_PER_FRAME), "f");
652
+ }
653
+ else {
654
+ __classPrivateFieldSet(this, _ParticleEffect_birthAccumulator, 0, "f");
655
+ }
656
+ if (visible) {
657
+ __classPrivateFieldSet(this, _ParticleEffect_screenBirthAccumulator, Math.min(__classPrivateFieldGet(this, _ParticleEffect_screenBirthAccumulator, "f") + this.params.screenBirthRate * dt, MAX_SPAWNS_PER_FRAME), "f");
658
+ }
659
+ else {
660
+ __classPrivateFieldSet(this, _ParticleEffect_screenBirthAccumulator, 0, "f");
661
+ }
662
+ // Mouse takes priority for the per-frame slot budget — when the
663
+ // user is dragging fast we'd rather show that than the ambient.
664
+ const nMouse = Math.min(MAX_SPAWNS_PER_FRAME, Math.floor(__classPrivateFieldGet(this, _ParticleEffect_birthAccumulator, "f")));
665
+ const nScreen = Math.min(MAX_SPAWNS_PER_FRAME - nMouse, Math.floor(__classPrivateFieldGet(this, _ParticleEffect_screenBirthAccumulator, "f")));
666
+ __classPrivateFieldSet(this, _ParticleEffect_birthAccumulator, __classPrivateFieldGet(this, _ParticleEffect_birthAccumulator, "f") - nMouse, "f");
667
+ __classPrivateFieldSet(this, _ParticleEffect_screenBirthAccumulator, __classPrivateFieldGet(this, _ParticleEffect_screenBirthAccumulator, "f") - nScreen, "f");
668
+ const total = nMouse + nScreen;
669
+ if (total === 0) {
670
+ return 0;
671
+ }
672
+ const cap = __classPrivateFieldGet(this, _ParticleEffect_instances, "m", _ParticleEffect_cap).call(this);
673
+ const elemPxX = Math.max(1, elementPixel[0]);
674
+ const elemPxY = Math.max(1, elementPixel[1]);
675
+ const buf = __classPrivateFieldGet(this, _ParticleEffect_spawnUniform, "f");
676
+ let i = 0;
677
+ // .w = theta in [0, 2π) for mouse spawns. FRAG_SPAWN_VEL turns
678
+ // it into a unit (cosθ, sinθ) in pixel space; FRAG_ADVECT_POS
679
+ // divides by elementPixel for circular symmetry on non-square
680
+ // elements.
681
+ for (; i < nMouse; i++) {
682
+ const r = Math.sqrt(Math.random()) * this.params.radius;
683
+ const theta = Math.random() * Math.PI * 2;
684
+ const dx = Math.cos(theta) * r;
685
+ const dy = Math.sin(theta) * r;
686
+ const o = i * 4;
687
+ buf[o + 0] = __classPrivateFieldGet(this, _ParticleEffect_nextSlot, "f");
688
+ buf[o + 1] = mouseUv[0] + dx / elemPxX;
689
+ buf[o + 2] = mouseUv[1] + dy / elemPxY;
690
+ buf[o + 3] = theta;
691
+ __classPrivateFieldSet(this, _ParticleEffect_nextSlot, (__classPrivateFieldGet(this, _ParticleEffect_nextSlot, "f") + 1) % cap, "f");
692
+ }
693
+ // .w = -1 sentinel: no radial impulse (curl-noise only).
694
+ for (let j = 0; j < nScreen; j++, i++) {
695
+ const o = i * 4;
696
+ buf[o + 0] = __classPrivateFieldGet(this, _ParticleEffect_nextSlot, "f");
697
+ buf[o + 1] = Math.random();
698
+ buf[o + 2] = Math.random();
699
+ buf[o + 3] = -1;
700
+ __classPrivateFieldSet(this, _ParticleEffect_nextSlot, (__classPrivateFieldGet(this, _ParticleEffect_nextSlot, "f") + 1) % cap, "f");
701
+ }
702
+ return total;
703
+ }, _ParticleEffect_cap = function _ParticleEffect_cap() {
704
+ return Math.max(1, Math.min(__classPrivateFieldGet(this, _ParticleEffect_stateCapacity, "f"), Math.floor(this.params.count)));
705
+ };
706
+ //# sourceMappingURL=particle.js.map