@tsparticles/plugin-emitters 4.0.0-alpha.8 → 4.0.0-beta.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/392.min.js +1 -0
- package/399.min.js +1 -0
- package/414.min.js +1 -0
- package/592.min.js +1 -0
- package/764.min.js +1 -0
- package/815.min.js +1 -0
- package/README.md +5 -0
- package/browser/EmitterInstance.js +121 -85
- package/browser/EmitterShapeBase.js +4 -0
- package/browser/EmittersInstancesManager.js +5 -3
- package/browser/EmittersInteractor.js +5 -1
- package/browser/EmittersPlugin.js +2 -1
- package/browser/EmittersPluginInstance.js +2 -0
- package/browser/Options/Classes/Emitter.js +25 -3
- package/browser/Options/Classes/EmitterLife.js +4 -0
- package/browser/Options/Classes/EmitterRate.js +2 -0
- package/browser/Options/Classes/EmitterShape.js +3 -0
- package/browser/Options/Classes/EmitterShapeReplace.js +2 -0
- package/browser/Options/Classes/EmitterSize.js +3 -0
- package/browser/Options/Classes/EmitterSpawn.js +18 -0
- package/browser/Options/Interfaces/IEmitterSpawn.js +1 -0
- package/browser/index.js +19 -9
- package/cjs/EmitterInstance.js +121 -85
- package/cjs/EmitterShapeBase.js +4 -0
- package/cjs/EmittersInstancesManager.js +5 -3
- package/cjs/EmittersInteractor.js +5 -1
- package/cjs/EmittersPlugin.js +2 -1
- package/cjs/EmittersPluginInstance.js +2 -0
- package/cjs/Options/Classes/Emitter.js +25 -3
- package/cjs/Options/Classes/EmitterLife.js +4 -0
- package/cjs/Options/Classes/EmitterRate.js +2 -0
- package/cjs/Options/Classes/EmitterShape.js +3 -0
- package/cjs/Options/Classes/EmitterShapeReplace.js +2 -0
- package/cjs/Options/Classes/EmitterSize.js +3 -0
- package/cjs/Options/Classes/EmitterSpawn.js +18 -0
- package/cjs/Options/Interfaces/IEmitterSpawn.js +1 -0
- package/cjs/index.js +19 -9
- package/dist_browser_EmitterInstance_js.js +2 -2
- package/dist_browser_EmittersInstancesManager_js.js +18 -8
- package/dist_browser_EmittersInteractor_js.js +19 -9
- package/dist_browser_EmittersPluginInstance_js.js +2 -2
- package/dist_browser_EmittersPlugin_js.js +18 -8
- package/dist_browser_ShapeManager_js.js +2 -2
- package/esm/EmitterInstance.js +121 -85
- package/esm/EmitterShapeBase.js +4 -0
- package/esm/EmittersInstancesManager.js +5 -3
- package/esm/EmittersInteractor.js +5 -1
- package/esm/EmittersPlugin.js +2 -1
- package/esm/EmittersPluginInstance.js +2 -0
- package/esm/Options/Classes/Emitter.js +25 -3
- package/esm/Options/Classes/EmitterLife.js +4 -0
- package/esm/Options/Classes/EmitterRate.js +2 -0
- package/esm/Options/Classes/EmitterShape.js +3 -0
- package/esm/Options/Classes/EmitterShapeReplace.js +2 -0
- package/esm/Options/Classes/EmitterSize.js +3 -0
- package/esm/Options/Classes/EmitterSpawn.js +18 -0
- package/esm/Options/Interfaces/IEmitterSpawn.js +1 -0
- package/esm/index.js +19 -9
- package/package.json +3 -3
- package/report.html +84 -29
- package/tsparticles.plugin.emitters.js +44 -32
- package/tsparticles.plugin.emitters.min.js +2 -2
- package/types/EmitterInstance.d.ts +11 -6
- package/types/EmittersEngine.d.ts +5 -2
- package/types/EmittersInstancesManager.d.ts +3 -3
- package/types/EmittersInteractor.d.ts +1 -0
- package/types/EmittersPlugin.d.ts +1 -1
- package/types/IEmitterShapeGenerator.d.ts +2 -2
- package/types/Options/Classes/Emitter.d.ts +4 -1
- package/types/Options/Classes/EmitterSpawn.d.ts +7 -0
- package/types/Options/Interfaces/IEmitter.d.ts +4 -1
- package/types/Options/Interfaces/IEmitterSpawn.d.ts +5 -0
- package/types/index.d.ts +1 -0
- package/umd/EmitterInstance.js +120 -84
- package/umd/EmitterShapeBase.js +4 -0
- package/umd/EmittersInstancesManager.js +5 -3
- package/umd/EmittersInteractor.js +5 -1
- package/umd/EmittersPlugin.js +2 -1
- package/umd/EmittersPluginInstance.js +2 -0
- package/umd/Options/Classes/Emitter.js +26 -4
- package/umd/Options/Classes/EmitterLife.js +4 -0
- package/umd/Options/Classes/EmitterRate.js +2 -0
- package/umd/Options/Classes/EmitterShape.js +3 -0
- package/umd/Options/Classes/EmitterShapeReplace.js +2 -0
- package/umd/Options/Classes/EmitterSize.js +3 -0
- package/umd/Options/Classes/EmitterSpawn.js +32 -0
- package/umd/Options/Interfaces/IEmitterSpawn.js +12 -0
- package/umd/index.js +20 -9
- package/129.min.js +0 -2
- package/129.min.js.LICENSE.txt +0 -1
- package/246.min.js +0 -2
- package/246.min.js.LICENSE.txt +0 -1
- package/330.min.js +0 -2
- package/330.min.js.LICENSE.txt +0 -1
- package/490.min.js +0 -2
- package/490.min.js.LICENSE.txt +0 -1
- package/849.min.js +0 -2
- package/849.min.js.LICENSE.txt +0 -1
- package/940.min.js +0 -2
- package/940.min.js.LICENSE.txt +0 -1
- package/tsparticles.plugin.emitters.min.js.LICENSE.txt +0 -1
package/umd/EmitterInstance.js
CHANGED
|
@@ -13,54 +13,55 @@
|
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const Emitter_js_1 = require("./Options/Classes/Emitter.js");
|
|
15
15
|
const EmitterSize_js_1 = require("./Options/Classes/EmitterSize.js");
|
|
16
|
-
const defaultLifeDelay = 0, minLifeCount = 0, defaultSpawnDelay = 0, defaultEmitDelay = 0, defaultLifeCount = -1, defaultColorAnimationFactor = 1, colorFactor = 3.6;
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
16
|
+
const defaultLifeDelay = 0, minLifeCount = 0, defaultSpawnDelay = 0, defaultEmitDelay = 0, defaultLifeCount = -1, defaultColorAnimationFactor = 1, colorFactor = 3.6, defaultStrokeWidth = 1;
|
|
17
|
+
function setParticlesOptionsFillColor(particlesOptions, color, opacity, enable) {
|
|
18
|
+
particlesOptions.fill = new engine_1.Fill();
|
|
19
|
+
particlesOptions.fill.color = engine_1.AnimatableColor.create(undefined, { value: color });
|
|
20
|
+
particlesOptions.fill.enable = enable;
|
|
21
|
+
particlesOptions.fill.opacity = opacity;
|
|
22
|
+
}
|
|
23
|
+
function setParticlesOptionsStrokeColor(particlesOptions, color, opacity, width) {
|
|
24
|
+
particlesOptions.stroke = new engine_1.Stroke();
|
|
25
|
+
particlesOptions.stroke.color = engine_1.AnimatableColor.create(undefined, { value: color });
|
|
26
|
+
particlesOptions.stroke.opacity = opacity;
|
|
27
|
+
particlesOptions.stroke.width = width;
|
|
26
28
|
}
|
|
27
29
|
class EmitterInstance {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this._engine = engine;
|
|
30
|
+
fill;
|
|
31
|
+
name;
|
|
32
|
+
options;
|
|
33
|
+
position;
|
|
34
|
+
size;
|
|
35
|
+
spawnFillColor;
|
|
36
|
+
spawnFillEnabled;
|
|
37
|
+
spawnFillOpacity;
|
|
38
|
+
spawnStrokeColor;
|
|
39
|
+
spawnStrokeOpacity;
|
|
40
|
+
spawnStrokeWidth;
|
|
41
|
+
_container;
|
|
42
|
+
_currentDuration;
|
|
43
|
+
_currentEmitDelay;
|
|
44
|
+
_currentSpawnDelay;
|
|
45
|
+
_duration;
|
|
46
|
+
_emitDelay;
|
|
47
|
+
_firstSpawn;
|
|
48
|
+
_immortal;
|
|
49
|
+
_initialPosition;
|
|
50
|
+
_lifeCount;
|
|
51
|
+
_mutationObserver;
|
|
52
|
+
_particlesOptions;
|
|
53
|
+
_paused;
|
|
54
|
+
_pluginManager;
|
|
55
|
+
_removeCallback;
|
|
56
|
+
_resizeObserver;
|
|
57
|
+
_shape;
|
|
58
|
+
_size;
|
|
59
|
+
_spawnDelay;
|
|
60
|
+
_startParticlesAdded;
|
|
61
|
+
constructor(pluginManager, container, removeCallback, options, position) {
|
|
62
|
+
this._pluginManager = pluginManager;
|
|
63
|
+
this._container = container;
|
|
64
|
+
this._removeCallback = removeCallback;
|
|
64
65
|
this._currentDuration = 0;
|
|
65
66
|
this._currentEmitDelay = 0;
|
|
66
67
|
this._currentSpawnDelay = 0;
|
|
@@ -84,13 +85,16 @@
|
|
|
84
85
|
const particlesOptions = (0, engine_1.deepExtend)({}, this.options.particles);
|
|
85
86
|
particlesOptions.move ??= {};
|
|
86
87
|
particlesOptions.move.direction ??= this.options.direction;
|
|
87
|
-
if (this.options.
|
|
88
|
-
this.
|
|
88
|
+
if (this.options.spawn.fill?.color) {
|
|
89
|
+
this.spawnFillColor = (0, engine_1.rangeColorToHsl)(this._pluginManager, this.options.spawn.fill.color);
|
|
90
|
+
}
|
|
91
|
+
if (this.options.spawn.stroke?.color) {
|
|
92
|
+
this.spawnStrokeColor = (0, engine_1.rangeColorToHsl)(this._pluginManager, this.options.spawn.stroke.color);
|
|
89
93
|
}
|
|
90
94
|
this._paused = !this.options.autoPlay;
|
|
91
95
|
this._particlesOptions = particlesOptions;
|
|
92
96
|
this._size = this._calcSize();
|
|
93
|
-
this.size = (0, engine_1.getSize)(this._size, this.
|
|
97
|
+
this.size = (0, engine_1.getSize)(this._size, this._container.canvas.size);
|
|
94
98
|
this._lifeCount = this.options.life.count ?? defaultLifeCount;
|
|
95
99
|
this._immortal = this._lifeCount <= minLifeCount;
|
|
96
100
|
if (this.options.domId) {
|
|
@@ -109,15 +113,12 @@
|
|
|
109
113
|
this._resizeObserver.observe(element);
|
|
110
114
|
}
|
|
111
115
|
}
|
|
112
|
-
const shapeOptions = this.options.shape, shapeGenerator = this.
|
|
116
|
+
const shapeOptions = this.options.shape, shapeGenerator = this._pluginManager.emitterShapeManager?.getShapeGenerator(shapeOptions.type);
|
|
113
117
|
if (shapeGenerator) {
|
|
114
|
-
this._shape = shapeGenerator.generate(this.position, this.size, this.fill, shapeOptions.options);
|
|
118
|
+
this._shape = shapeGenerator.generate(this._container, this.position, this.size, this.fill, shapeOptions.options);
|
|
115
119
|
}
|
|
116
|
-
this.
|
|
117
|
-
|
|
118
|
-
data: {
|
|
119
|
-
emitter: this,
|
|
120
|
-
},
|
|
120
|
+
this._container.dispatchEvent("emitterCreated", {
|
|
121
|
+
emitter: this,
|
|
121
122
|
});
|
|
122
123
|
this.play();
|
|
123
124
|
}
|
|
@@ -146,7 +147,7 @@
|
|
|
146
147
|
(this._firstSpawn || this._currentSpawnDelay >= (this._spawnDelay ?? defaultSpawnDelay)))) {
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
149
|
-
const container = this.
|
|
150
|
+
const container = this._container;
|
|
150
151
|
if (this._emitDelay === undefined) {
|
|
151
152
|
const delay = (0, engine_1.getRangeValue)(this.options.rate.delay);
|
|
152
153
|
this._emitDelay = container.retina.reduceFactor
|
|
@@ -158,7 +159,7 @@
|
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
resize() {
|
|
161
|
-
const initialPosition = this._initialPosition, container = this.
|
|
162
|
+
const initialPosition = this._initialPosition, container = this._container;
|
|
162
163
|
this.position =
|
|
163
164
|
initialPosition && (0, engine_1.isPointInside)(initialPosition, container.canvas.size, engine_1.Vector.origin)
|
|
164
165
|
? initialPosition
|
|
@@ -171,7 +172,7 @@
|
|
|
171
172
|
if (this._paused) {
|
|
172
173
|
return;
|
|
173
174
|
}
|
|
174
|
-
const container = this.
|
|
175
|
+
const container = this._container;
|
|
175
176
|
if (this._firstSpawn) {
|
|
176
177
|
this._firstSpawn = false;
|
|
177
178
|
this._currentSpawnDelay = this._spawnDelay ?? defaultSpawnDelay;
|
|
@@ -209,11 +210,9 @@
|
|
|
209
210
|
if (this._spawnDelay !== undefined) {
|
|
210
211
|
this._currentSpawnDelay += delta.value;
|
|
211
212
|
if (this._currentSpawnDelay >= this._spawnDelay) {
|
|
212
|
-
this.
|
|
213
|
-
container: this.container,
|
|
214
|
-
});
|
|
213
|
+
this._container.dispatchEvent("emitterPlay");
|
|
215
214
|
this.play();
|
|
216
|
-
this._currentSpawnDelay -= this.
|
|
215
|
+
this._currentSpawnDelay -= this._spawnDelay;
|
|
217
216
|
delete this._spawnDelay;
|
|
218
217
|
}
|
|
219
218
|
}
|
|
@@ -226,7 +225,7 @@
|
|
|
226
225
|
}
|
|
227
226
|
}
|
|
228
227
|
_calcPosition() {
|
|
229
|
-
const container = this.
|
|
228
|
+
const container = this._container;
|
|
230
229
|
if (this.options.domId) {
|
|
231
230
|
const element = (0, engine_1.safeDocument)().getElementById(this.options.domId);
|
|
232
231
|
if (element) {
|
|
@@ -243,7 +242,7 @@
|
|
|
243
242
|
});
|
|
244
243
|
}
|
|
245
244
|
_calcSize() {
|
|
246
|
-
const container = this.
|
|
245
|
+
const container = this._container;
|
|
247
246
|
if (this.options.domId) {
|
|
248
247
|
const element = (0, engine_1.safeDocument)().getElementById(this.options.domId);
|
|
249
248
|
if (element) {
|
|
@@ -266,6 +265,16 @@
|
|
|
266
265
|
return size;
|
|
267
266
|
})());
|
|
268
267
|
}
|
|
268
|
+
_destroy = () => {
|
|
269
|
+
this._mutationObserver?.disconnect();
|
|
270
|
+
this._mutationObserver = undefined;
|
|
271
|
+
this._resizeObserver?.disconnect();
|
|
272
|
+
this._resizeObserver = undefined;
|
|
273
|
+
this._removeCallback(this);
|
|
274
|
+
this._container.dispatchEvent("emitterDestroyed", {
|
|
275
|
+
emitter: this,
|
|
276
|
+
});
|
|
277
|
+
};
|
|
269
278
|
_emit() {
|
|
270
279
|
if (this._paused) {
|
|
271
280
|
return;
|
|
@@ -275,18 +284,36 @@
|
|
|
275
284
|
}
|
|
276
285
|
_emitParticles(quantity) {
|
|
277
286
|
const singleParticlesOptions = ((0, engine_1.itemFromSingleOrMultiple)(this._particlesOptions) ??
|
|
278
|
-
{}),
|
|
287
|
+
{}), fillHslAnimation = this.options.spawn.fill?.color.animation, fillEnabled = this.options.spawn.fill?.enable ?? !!this.options.spawn.fill?.color, fillOpacity = this.options.spawn.fill?.opacity === undefined
|
|
288
|
+
? engine_1.defaultOpacity
|
|
289
|
+
: (0, engine_1.getRangeValue)(this.options.spawn.fill.opacity), strokeHslAnimation = this.options.spawn.stroke?.color?.animation, strokeOpacity = this.options.spawn.stroke?.opacity === undefined
|
|
290
|
+
? engine_1.defaultOpacity
|
|
291
|
+
: (0, engine_1.getRangeValue)(this.options.spawn.stroke.opacity), strokeWidth = this.options.spawn.stroke?.width === undefined
|
|
292
|
+
? defaultStrokeWidth
|
|
293
|
+
: (0, engine_1.getRangeValue)(this.options.spawn.stroke.width), reduceFactor = this._container.retina.reduceFactor, needsFillColorAnimation = !!fillHslAnimation, needsStrokeColorAnimation = !!strokeHslAnimation, needsShapeData = !!this._shape, needsColorAnimation = needsFillColorAnimation || needsStrokeColorAnimation, needsCopy = needsColorAnimation || needsShapeData, maxValues = needsColorAnimation ? { h: engine_1.hMax, s: engine_1.sMax, l: engine_1.lMax } : null, shapeOptions = this.options.shape;
|
|
279
294
|
for (let i = 0; i < quantity * reduceFactor; i++) {
|
|
280
295
|
const particlesOptions = needsCopy
|
|
281
296
|
? (0, engine_1.deepExtend)({}, singleParticlesOptions)
|
|
282
297
|
: singleParticlesOptions;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
298
|
+
this.spawnFillOpacity = fillOpacity;
|
|
299
|
+
this.spawnFillEnabled = fillEnabled;
|
|
300
|
+
this.spawnStrokeOpacity = strokeOpacity;
|
|
301
|
+
this.spawnStrokeWidth = strokeWidth;
|
|
302
|
+
if (this.spawnFillColor) {
|
|
303
|
+
if (fillHslAnimation && maxValues) {
|
|
304
|
+
this.spawnFillColor.h = this._setColorAnimation(fillHslAnimation.h, this.spawnFillColor.h, maxValues.h, colorFactor);
|
|
305
|
+
this.spawnFillColor.s = this._setColorAnimation(fillHslAnimation.s, this.spawnFillColor.s, maxValues.s);
|
|
306
|
+
this.spawnFillColor.l = this._setColorAnimation(fillHslAnimation.l, this.spawnFillColor.l, maxValues.l);
|
|
307
|
+
}
|
|
308
|
+
setParticlesOptionsFillColor(particlesOptions, this.spawnFillColor, this.spawnFillOpacity, this.spawnFillEnabled);
|
|
309
|
+
}
|
|
310
|
+
if (this.spawnStrokeColor) {
|
|
311
|
+
if (strokeHslAnimation && maxValues) {
|
|
312
|
+
this.spawnStrokeColor.h = this._setColorAnimation(strokeHslAnimation.h, this.spawnStrokeColor.h, maxValues.h, colorFactor);
|
|
313
|
+
this.spawnStrokeColor.s = this._setColorAnimation(strokeHslAnimation.s, this.spawnStrokeColor.s, maxValues.s);
|
|
314
|
+
this.spawnStrokeColor.l = this._setColorAnimation(strokeHslAnimation.l, this.spawnStrokeColor.l, maxValues.l);
|
|
288
315
|
}
|
|
289
|
-
|
|
316
|
+
setParticlesOptionsStrokeColor(particlesOptions, this.spawnStrokeColor, this.spawnStrokeOpacity, this.spawnStrokeWidth);
|
|
290
317
|
}
|
|
291
318
|
let position = this.position;
|
|
292
319
|
if (this._shape) {
|
|
@@ -295,17 +322,7 @@
|
|
|
295
322
|
position = shapePosData.position;
|
|
296
323
|
const replaceData = shapeOptions.replace;
|
|
297
324
|
if (replaceData.color && shapePosData.color) {
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
if (replaceData.opacity) {
|
|
301
|
-
if (particlesOptions.opacity) {
|
|
302
|
-
particlesOptions.opacity.value = shapePosData.opacity;
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
particlesOptions.opacity = {
|
|
306
|
-
value: shapePosData.opacity,
|
|
307
|
-
};
|
|
308
|
-
}
|
|
325
|
+
setParticlesOptionsFillColor(particlesOptions, shapePosData.color, replaceData.opacity ? (shapePosData.opacity ?? engine_1.defaultOpacity) : engine_1.defaultOpacity, true);
|
|
309
326
|
}
|
|
310
327
|
}
|
|
311
328
|
else {
|
|
@@ -313,10 +330,29 @@
|
|
|
313
330
|
}
|
|
314
331
|
}
|
|
315
332
|
if (position) {
|
|
316
|
-
this.
|
|
333
|
+
this._container.particles.addParticle(position, particlesOptions);
|
|
317
334
|
}
|
|
318
335
|
}
|
|
319
336
|
}
|
|
337
|
+
_prepareToDie = () => {
|
|
338
|
+
if (this._paused) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
const duration = this.options.life.duration !== undefined ? (0, engine_1.getRangeValue)(this.options.life.duration) : undefined, minDuration = 0, minLifeCount = 0;
|
|
342
|
+
if ((this._lifeCount > minLifeCount || this._immortal) && duration !== undefined && duration > minDuration) {
|
|
343
|
+
this._duration = duration * engine_1.millisecondsToSeconds;
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
_setColorAnimation = (animation, initValue, maxValue, factor = defaultColorAnimationFactor) => {
|
|
347
|
+
const container = this._container;
|
|
348
|
+
if (!animation.enable) {
|
|
349
|
+
return initValue;
|
|
350
|
+
}
|
|
351
|
+
const colorOffset = (0, engine_1.randomInRangeValue)(animation.offset), delay = (0, engine_1.getRangeValue)(this.options.rate.delay), emitFactor = container.retina.reduceFactor
|
|
352
|
+
? (delay * engine_1.millisecondsToSeconds) / container.retina.reduceFactor
|
|
353
|
+
: Infinity, colorSpeed = (0, engine_1.getRangeValue)(animation.speed);
|
|
354
|
+
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset * factor) % maxValue;
|
|
355
|
+
};
|
|
320
356
|
}
|
|
321
357
|
exports.EmitterInstance = EmitterInstance;
|
|
322
358
|
});
|
package/umd/EmitterShapeBase.js
CHANGED
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.EmitterShapeBase = void 0;
|
|
13
13
|
class EmitterShapeBase {
|
|
14
|
+
fill;
|
|
15
|
+
options;
|
|
16
|
+
position;
|
|
17
|
+
size;
|
|
14
18
|
constructor(position, size, fill, options) {
|
|
15
19
|
this.position = position;
|
|
16
20
|
this.size = size;
|
|
@@ -48,14 +48,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
48
48
|
const Emitter_js_1 = require("./Options/Classes/Emitter.js");
|
|
49
49
|
const defaultIndex = 0;
|
|
50
50
|
class EmittersInstancesManager {
|
|
51
|
-
|
|
51
|
+
_containerArrays;
|
|
52
|
+
_pluginManager;
|
|
53
|
+
constructor(pluginManager) {
|
|
52
54
|
this._containerArrays = new Map();
|
|
53
|
-
this.
|
|
55
|
+
this._pluginManager = pluginManager;
|
|
54
56
|
}
|
|
55
57
|
async addEmitter(container, options, position) {
|
|
56
58
|
const emitterOptions = new Emitter_js_1.Emitter();
|
|
57
59
|
emitterOptions.load(options);
|
|
58
|
-
const { EmitterInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmitterInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./EmitterInstance.js"], resolve_1, reject_1); }).then(__importStar)), emitter = new EmitterInstance(this.
|
|
60
|
+
const { EmitterInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmitterInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./EmitterInstance.js"], resolve_1, reject_1); }).then(__importStar)), emitter = new EmitterInstance(this._pluginManager, container, (emitter) => {
|
|
59
61
|
this.removeEmitter(container, emitter);
|
|
60
62
|
}, emitterOptions, position);
|
|
61
63
|
await emitter.init();
|
|
@@ -16,9 +16,13 @@
|
|
|
16
16
|
const constants_js_1 = require("./constants.js");
|
|
17
17
|
const emittersMode = "emitters";
|
|
18
18
|
class EmittersInteractor extends plugin_interactivity_1.ExternalInteractorBase {
|
|
19
|
+
handleClickMode;
|
|
20
|
+
maxDistance;
|
|
21
|
+
_instancesManager;
|
|
19
22
|
constructor(instancesManager, container) {
|
|
20
23
|
super(container);
|
|
21
24
|
this._instancesManager = instancesManager;
|
|
25
|
+
this.maxDistance = 0;
|
|
22
26
|
this.handleClickMode = (mode, interactivityData) => {
|
|
23
27
|
const container = this.container, options = container.actualOptions, modeEmitters = options.interactivity.modes.emitters;
|
|
24
28
|
if (!modeEmitters || mode !== emittersMode) {
|
|
@@ -89,7 +93,7 @@
|
|
|
89
93
|
options.emitters.value.push(tmp);
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
|
-
else if (
|
|
96
|
+
else if ("value" in source.emitters) {
|
|
93
97
|
const emitterModeOptions = source.emitters;
|
|
94
98
|
options.emitters.random.enable = emitterModeOptions.random?.enable ?? options.emitters.random.enable;
|
|
95
99
|
options.emitters.random.count = emitterModeOptions.random?.count ?? options.emitters.random.count;
|
package/umd/EmittersPlugin.js
CHANGED
|
@@ -47,9 +47,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
47
47
|
const engine_1 = require("@tsparticles/engine");
|
|
48
48
|
const Emitter_js_1 = require("./Options/Classes/Emitter.js");
|
|
49
49
|
class EmittersPlugin {
|
|
50
|
+
id = "emitters";
|
|
51
|
+
_instancesManager;
|
|
50
52
|
constructor(instancesManager) {
|
|
51
53
|
this._instancesManager = instancesManager;
|
|
52
|
-
this.id = "emitters";
|
|
53
54
|
}
|
|
54
55
|
async getPlugin(container) {
|
|
55
56
|
const { EmittersPluginInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmittersPluginInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./EmittersPluginInstance.js"], resolve_1, reject_1); }).then(__importStar));
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
exports.EmittersPluginInstance = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
class EmittersPluginInstance {
|
|
15
|
+
container;
|
|
16
|
+
_instancesManager;
|
|
15
17
|
constructor(instancesManager, container) {
|
|
16
18
|
this.container = container;
|
|
17
19
|
this._instancesManager = instancesManager;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine", "./EmitterLife.js", "./EmitterRate.js", "./EmitterShape.js", "./EmitterSize.js"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "./EmitterLife.js", "./EmitterRate.js", "./EmitterShape.js", "./EmitterSize.js", "./EmitterSpawn.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
@@ -15,13 +15,30 @@
|
|
|
15
15
|
const EmitterRate_js_1 = require("./EmitterRate.js");
|
|
16
16
|
const EmitterShape_js_1 = require("./EmitterShape.js");
|
|
17
17
|
const EmitterSize_js_1 = require("./EmitterSize.js");
|
|
18
|
+
const EmitterSpawn_js_1 = require("./EmitterSpawn.js");
|
|
18
19
|
class Emitter {
|
|
20
|
+
autoPlay;
|
|
21
|
+
direction;
|
|
22
|
+
domId;
|
|
23
|
+
fill;
|
|
24
|
+
life;
|
|
25
|
+
name;
|
|
26
|
+
particles;
|
|
27
|
+
position;
|
|
28
|
+
rate;
|
|
29
|
+
shape;
|
|
30
|
+
size;
|
|
31
|
+
spawn;
|
|
32
|
+
spawnFillColor;
|
|
33
|
+
spawnStrokeColor;
|
|
34
|
+
startCount;
|
|
19
35
|
constructor() {
|
|
20
36
|
this.autoPlay = true;
|
|
21
37
|
this.fill = true;
|
|
22
38
|
this.life = new EmitterLife_js_1.EmitterLife();
|
|
23
39
|
this.rate = new EmitterRate_js_1.EmitterRate();
|
|
24
40
|
this.shape = new EmitterShape_js_1.EmitterShape();
|
|
41
|
+
this.spawn = new EmitterSpawn_js_1.EmitterSpawn();
|
|
25
42
|
this.startCount = 0;
|
|
26
43
|
}
|
|
27
44
|
load(data) {
|
|
@@ -49,6 +66,7 @@
|
|
|
49
66
|
});
|
|
50
67
|
this.rate.load(data.rate);
|
|
51
68
|
this.shape.load(data.shape);
|
|
69
|
+
this.spawn.load(data.spawn);
|
|
52
70
|
if (data.position !== undefined) {
|
|
53
71
|
this.position = {};
|
|
54
72
|
if (data.position.x !== undefined) {
|
|
@@ -58,9 +76,13 @@
|
|
|
58
76
|
this.position.y = (0, engine_1.setRangeValue)(data.position.y);
|
|
59
77
|
}
|
|
60
78
|
}
|
|
61
|
-
if (data.
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
79
|
+
if (data.spawnFillColor !== undefined) {
|
|
80
|
+
this.spawnFillColor ??= new engine_1.AnimatableColor();
|
|
81
|
+
this.spawnFillColor.load(data.spawnFillColor);
|
|
82
|
+
}
|
|
83
|
+
if (data.spawnStrokeColor !== undefined) {
|
|
84
|
+
this.spawnStrokeColor ??= new engine_1.AnimatableColor();
|
|
85
|
+
this.spawnStrokeColor.load(data.spawnStrokeColor);
|
|
64
86
|
}
|
|
65
87
|
if (data.startCount !== undefined) {
|
|
66
88
|
this.startCount = data.startCount;
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const EmitterShapeReplace_js_1 = require("./EmitterShapeReplace.js");
|
|
15
15
|
class EmitterShape {
|
|
16
|
+
options;
|
|
17
|
+
replace;
|
|
18
|
+
type;
|
|
16
19
|
constructor() {
|
|
17
20
|
this.options = {};
|
|
18
21
|
this.replace = new EmitterShapeReplace_js_1.EmitterShapeReplace();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EmitterSpawn = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
class EmitterSpawn {
|
|
15
|
+
fill;
|
|
16
|
+
stroke;
|
|
17
|
+
load(data) {
|
|
18
|
+
if ((0, engine_1.isNull)(data)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (data.fill) {
|
|
22
|
+
this.fill ??= new engine_1.Fill();
|
|
23
|
+
this.fill.load(data.fill);
|
|
24
|
+
}
|
|
25
|
+
if (data.stroke) {
|
|
26
|
+
this.stroke ??= new engine_1.Stroke();
|
|
27
|
+
this.stroke.load(data.stroke);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.EmitterSpawn = EmitterSpawn;
|
|
32
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
package/umd/index.js
CHANGED
|
@@ -47,22 +47,33 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
47
47
|
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
48
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
49
|
exports.loadEmittersPlugin = loadEmittersPlugin;
|
|
50
|
+
exports.ensureEmittersPluginLoaded = ensureEmittersPluginLoaded;
|
|
50
51
|
async function loadEmittersPlugin(engine) {
|
|
51
|
-
engine.checkVersion("4.0.0-
|
|
52
|
-
await engine.register(async (e) => {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
engine.checkVersion("4.0.0-beta.1");
|
|
53
|
+
await engine.pluginManager.register(async (e) => {
|
|
54
|
+
const [{ ensureInteractivityPluginLoaded }, { ShapeManager }, { EmittersInstancesManager }, { EmittersPlugin },] = await Promise.all([
|
|
55
|
+
__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/plugin-interactivity"))) : new Promise((resolve_1, reject_1) => { require(["@tsparticles/plugin-interactivity"], resolve_1, reject_1); }).then(__importStar),
|
|
56
|
+
__syncRequire ? Promise.resolve().then(() => __importStar(require("./ShapeManager.js"))) : new Promise((resolve_2, reject_2) => { require(["./ShapeManager.js"], resolve_2, reject_2); }).then(__importStar),
|
|
57
|
+
__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmittersInstancesManager.js"))) : new Promise((resolve_3, reject_3) => { require(["./EmittersInstancesManager.js"], resolve_3, reject_3); }).then(__importStar),
|
|
58
|
+
__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmittersPlugin.js"))) : new Promise((resolve_4, reject_4) => { require(["./EmittersPlugin.js"], resolve_4, reject_4); }).then(__importStar),
|
|
59
|
+
]), pluginManager = e.pluginManager, instancesManager = new EmittersInstancesManager(pluginManager);
|
|
60
|
+
ensureInteractivityPluginLoaded(e);
|
|
61
|
+
pluginManager.emitterShapeManager ??= new ShapeManager();
|
|
62
|
+
pluginManager.addEmitterShapeGenerator ??= (name, generator) => {
|
|
63
|
+
pluginManager.emitterShapeManager?.addShapeGenerator(name, generator);
|
|
58
64
|
};
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
pluginManager.addPlugin(new EmittersPlugin(instancesManager));
|
|
66
|
+
pluginManager.addInteractor?.("externalEmitters", async (container) => {
|
|
61
67
|
const { EmittersInteractor } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmittersInteractor.js"))) : new Promise((resolve_5, reject_5) => { require(["./EmittersInteractor.js"], resolve_5, reject_5); }).then(__importStar));
|
|
62
68
|
return new EmittersInteractor(instancesManager, container);
|
|
63
69
|
});
|
|
64
70
|
});
|
|
65
71
|
}
|
|
72
|
+
function ensureEmittersPluginLoaded(e) {
|
|
73
|
+
if (!e.pluginManager.addEmitterShapeGenerator) {
|
|
74
|
+
throw new Error("tsParticles Emitters Plugin is not loaded");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
66
77
|
__exportStar(require("./EmitterShapeBase.js"), exports);
|
|
67
78
|
__exportStar(require("./Enums/EmitterClickMode.js"), exports);
|
|
68
79
|
});
|
package/129.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 129.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[129],{510(t,i,e){e.d(i,{EmitterInstance:()=>r});var s=e(303),o=e(21),n=e(129);function a(t,i){t.color?t.color.value=i:t.color={value:i}}class r{constructor(t,i,e,n,a){this.container=i,this.removeCallback=e,this._destroy=()=>{this._mutationObserver?.disconnect(),this._mutationObserver=void 0,this._resizeObserver?.disconnect(),this._resizeObserver=void 0,this.removeCallback(this),this._engine.dispatchEvent("emitterDestroyed",{container:this.container,data:{emitter:this}})},this._prepareToDie=()=>{if(this._paused)return;const t=void 0!==this.options.life.duration?(0,s.getRangeValue)(this.options.life.duration):void 0;(this._lifeCount>0||this._immortal)&&void 0!==t&&t>0&&(this._duration=t*s.millisecondsToSeconds)},this._setColorAnimation=(t,i,e,o=1)=>{const n=this.container;if(!t.enable)return i;const a=(0,s.randomInRangeValue)(t.offset),r=(0,s.getRangeValue)(this.options.rate.delay),h=n.retina.reduceFactor?r*s.millisecondsToSeconds/n.retina.reduceFactor:1/0;return(i+(0,s.getRangeValue)(t.speed)*n.fpsLimit/h+a*o)%e},this._engine=t,this._currentDuration=0,this._currentEmitDelay=0,this._currentSpawnDelay=0,this._initialPosition=a,n instanceof o.v?this.options=n:(this.options=new o.v,this.options.load(n)),this._spawnDelay=i.retina.reduceFactor?(0,s.getRangeValue)(this.options.life.delay??0)*s.millisecondsToSeconds/i.retina.reduceFactor:1/0,this.position=this._initialPosition??this._calcPosition(),this.name=this.options.name,this.fill=this.options.fill,this._firstSpawn=!this.options.life.wait,this._startParticlesAdded=!1;const r=(0,s.deepExtend)({},this.options.particles);if(r.move??={},r.move.direction??=this.options.direction,this.options.spawnColor&&(this.spawnColor=(0,s.rangeColorToHsl)(this._engine,this.options.spawnColor)),this._paused=!this.options.autoPlay,this._particlesOptions=r,this._size=this._calcSize(),this.size=(0,s.getSize)(this._size,this.container.canvas.size),this._lifeCount=this.options.life.count??-1,this._immortal=this._lifeCount<=0,this.options.domId){const t=(0,s.safeDocument)().getElementById(this.options.domId);t&&(this._mutationObserver=new MutationObserver((()=>{this.resize()})),this._resizeObserver=new ResizeObserver((()=>{this.resize()})),this._mutationObserver.observe(t,{attributes:!0,attributeFilter:["style","width","height"]}),this._resizeObserver.observe(t))}const h=this.options.shape,l=this._engine.emitterShapeManager?.getShapeGenerator(h.type);l&&(this._shape=l.generate(this.position,this.size,this.fill,h.options)),this._engine.dispatchEvent("emitterCreated",{container:i,data:{emitter:this}}),this.play()}externalPause(){this._paused=!0,this.pause()}externalPlay(){this._paused=!1,this.play()}async init(){await(this._shape?.init())}pause(){this._paused||delete this._emitDelay}play(){if(this._paused)return;if(!(this._lifeCount>0||this._immortal)&&this.options.life.count||!(this._firstSpawn||this._currentSpawnDelay>=(this._spawnDelay??0)))return;const t=this.container;if(void 0===this._emitDelay){const i=(0,s.getRangeValue)(this.options.rate.delay);this._emitDelay=t.retina.reduceFactor?i*s.millisecondsToSeconds/t.retina.reduceFactor:1/0}(this._lifeCount>0||this._immortal)&&this._prepareToDie()}resize(){const t=this._initialPosition,i=this.container;this.position=t&&(0,s.isPointInside)(t,i.canvas.size,s.Vector.origin)?t:this._calcPosition(),this._size=this._calcSize(),this.size=(0,s.getSize)(this._size,i.canvas.size),this._shape?.resize(this.position,this.size)}update(t){if(this._paused)return;const i=this.container;this._firstSpawn&&(this._firstSpawn=!1,this._currentSpawnDelay=this._spawnDelay??0,this._currentEmitDelay=this._emitDelay??0),this._startParticlesAdded||(this._startParticlesAdded=!0,this._emitParticles(this.options.startCount)),void 0!==this._duration&&(this._currentDuration+=t.value,this._currentDuration>=this._duration&&(this.pause(),void 0!==this._spawnDelay&&delete this._spawnDelay,this._immortal||this._lifeCount--,this._lifeCount>0||this._immortal?(this.position=this._calcPosition(),this._shape?.resize(this.position,this.size),this._spawnDelay=i.retina.reduceFactor?(0,s.getRangeValue)(this.options.life.delay??0)*s.millisecondsToSeconds/i.retina.reduceFactor:1/0):this._destroy(),this._currentDuration-=this._duration,delete this._duration)),void 0!==this._spawnDelay&&(this._currentSpawnDelay+=t.value,this._currentSpawnDelay>=this._spawnDelay&&(this._engine.dispatchEvent("emitterPlay",{container:this.container}),this.play(),this._currentSpawnDelay-=this._currentSpawnDelay,delete this._spawnDelay)),void 0!==this._emitDelay&&(this._currentEmitDelay+=t.value,this._currentEmitDelay>=this._emitDelay&&(this._emit(),this._currentEmitDelay-=this._emitDelay))}_calcPosition(){const t=this.container;if(this.options.domId){const i=(0,s.safeDocument)().getElementById(this.options.domId);if(i){const e=i.getBoundingClientRect(),o=t.retina.pixelRatio;return{x:(e.x+e.width*s.half)*o,y:(e.y+e.height*s.half)*o}}}return(0,s.calcPositionOrRandomFromSizeRanged)({size:t.canvas.size,position:this.options.position})}_calcSize(){const t=this.container;if(this.options.domId){const i=(0,s.safeDocument)().getElementById(this.options.domId);if(i){const e=i.getBoundingClientRect();return{width:e.width*t.retina.pixelRatio,height:e.height*t.retina.pixelRatio,mode:s.PixelMode.precise}}}return this.options.size??(()=>{const t=new n.G;return t.load({height:0,mode:s.PixelMode.percent,width:0}),t})()}_emit(){if(this._paused)return;const t=(0,s.getRangeValue)(this.options.rate.quantity);this._emitParticles(t)}_emitParticles(t){const i=(0,s.itemFromSingleOrMultiple)(this._particlesOptions)??{},e=this.options.spawnColor?.animation,o=this.container.retina.reduceFactor,n=!!e,r=!!this._shape,h=n||r,l=n?{h:s.hMax,s:s.sMax,l:s.lMax}:null,c=this.options.shape;for(let n=0;n<t*o;n++){const t=h?(0,s.deepExtend)({},i):i;this.spawnColor&&(e&&l&&(this.spawnColor.h=this._setColorAnimation(e.h,this.spawnColor.h,l.h,3.6),this.spawnColor.s=this._setColorAnimation(e.s,this.spawnColor.s,l.s),this.spawnColor.l=this._setColorAnimation(e.l,this.spawnColor.l,l.l)),a(t,this.spawnColor));let o=this.position;if(this._shape){const i=this._shape.randomPosition();if(i){o=i.position;const e=c.replace;e.color&&i.color&&a(t,i.color),e.opacity&&(t.opacity?t.opacity.value=i.opacity:t.opacity={value:i.opacity})}else o=null}o&&this.container.particles.addParticle(o,t)}}}}}]);
|
package/129.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Emitters Plugin v4.0.0-alpha.8 by Matteo Bruni */
|
package/246.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 246.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[246],{21(t,i,e){e.d(i,{v:()=>h});var s=e(303);class o{constructor(){this.wait=!1}load(t){(0,s.isNull)(t)||(void 0!==t.count&&(this.count=t.count),void 0!==t.delay&&(this.delay=(0,s.setRangeValue)(t.delay)),void 0!==t.duration&&(this.duration=(0,s.setRangeValue)(t.duration)),void 0!==t.wait&&(this.wait=t.wait))}}class a{constructor(){this.quantity=1,this.delay=.1}load(t){(0,s.isNull)(t)||(void 0!==t.quantity&&(this.quantity=(0,s.setRangeValue)(t.quantity)),void 0!==t.delay&&(this.delay=(0,s.setRangeValue)(t.delay)))}}class n{constructor(){this.color=!1,this.opacity=!1}load(t){(0,s.isNull)(t)||(void 0!==t.color&&(this.color=t.color),void 0!==t.opacity&&(this.opacity=t.opacity))}}class r{constructor(){this.options={},this.replace=new n,this.type="square"}load(t){(0,s.isNull)(t)||(void 0!==t.options&&(this.options=(0,s.deepExtend)({},t.options??{})),this.replace.load(t.replace),void 0!==t.type&&(this.type=t.type))}}var l=e(129);class h{constructor(){this.autoPlay=!0,this.fill=!0,this.life=new o,this.rate=new a,this.shape=new r,this.startCount=0}load(t){(0,s.isNull)(t)||(void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.size&&(this.size??=new l.G,this.size.load(t.size)),void 0!==t.direction&&(this.direction=t.direction),this.domId=t.domId,void 0!==t.fill&&(this.fill=t.fill),this.life.load(t.life),this.name=t.name,this.particles=(0,s.executeOnSingleOrMultiple)(t.particles,(t=>(0,s.deepExtend)({},t))),this.rate.load(t.rate),this.shape.load(t.shape),void 0!==t.position&&(this.position={},void 0!==t.position.x&&(this.position.x=(0,s.setRangeValue)(t.position.x)),void 0!==t.position.y&&(this.position.y=(0,s.setRangeValue)(t.position.y))),void 0!==t.spawnColor&&(this.spawnColor??=new s.AnimatableColor,this.spawnColor.load(t.spawnColor)),void 0!==t.startCount&&(this.startCount=t.startCount))}}},129(t,i,e){e.d(i,{G:()=>o});var s=e(303);class o{constructor(){this.mode=s.PixelMode.percent,this.height=0,this.width=0}load(t){(0,s.isNull)(t)||(void 0!==t.mode&&(this.mode=t.mode),void 0!==t.height&&(this.height=t.height),void 0!==t.width&&(this.width=t.width))}}},246(t,i,e){e.d(i,{EmittersInstancesManager:()=>a});var s=e(303),o=e(21);class a{constructor(t){this._containerArrays=new Map,this._engine=t}async addEmitter(t,i,s){const a=new o.v;a.load(i);const{EmitterInstance:n}=await e.e(129).then(e.bind(e,510)),r=new n(this._engine,t,(i=>{this.removeEmitter(t,i)}),a,s);return await r.init(),this.getArray(t).push(r),r}clear(t){this.initContainer(t),this._containerArrays.set(t,[])}getArray(t){this.initContainer(t);let i=this._containerArrays.get(t);return i||(i=[],this._containerArrays.set(t,i)),i}initContainer(t){this._containerArrays.has(t)||(this._containerArrays.set(t,[]),t.getEmitter=i=>{const e=this.getArray(t);return void 0===i||(0,s.isNumber)(i)?e[i??0]:e.find((t=>t.name===i))},t.addEmitter=async(i,e)=>this.addEmitter(t,i,e),t.removeEmitter=i=>{const e=t.getEmitter?.(i);e&&this.removeEmitter(t,e)},t.playEmitter=i=>{const e=t.getEmitter?.(i);e&&e.externalPlay()},t.pauseEmitter=i=>{const e=t.getEmitter?.(i);e&&e.externalPause()})}removeEmitter(t,i){const e=this.getArray(t).indexOf(i);e>=0&&this.getArray(t).splice(e,1)}}}}]);
|
package/246.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Emitters Plugin v4.0.0-alpha.8 by Matteo Bruni */
|