@tsparticles/plugin-emitters 4.0.0-alpha.26 → 4.0.0-alpha.28

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 (49) hide show
  1. package/526.min.js +1 -0
  2. package/588.min.js +1 -0
  3. package/{371.min.js → 772.min.js} +1 -1
  4. package/784.min.js +1 -0
  5. package/795.min.js +1 -0
  6. package/{244.min.js → 803.min.js} +1 -1
  7. package/browser/EmitterInstance.js +50 -32
  8. package/browser/EmittersInteractor.js +1 -1
  9. package/browser/Options/Classes/Emitter.js +13 -4
  10. package/browser/Options/Classes/EmitterSpawn.js +18 -0
  11. package/browser/Options/Interfaces/IEmitterSpawn.js +1 -0
  12. package/browser/index.js +1 -1
  13. package/cjs/EmitterInstance.js +50 -32
  14. package/cjs/EmittersInteractor.js +1 -1
  15. package/cjs/Options/Classes/Emitter.js +13 -4
  16. package/cjs/Options/Classes/EmitterSpawn.js +18 -0
  17. package/cjs/Options/Interfaces/IEmitterSpawn.js +1 -0
  18. package/cjs/index.js +1 -1
  19. package/dist_browser_EmitterInstance_js.js +2 -2
  20. package/dist_browser_EmittersInstancesManager_js.js +12 -2
  21. package/dist_browser_EmittersInteractor_js.js +13 -3
  22. package/dist_browser_EmittersPluginInstance_js.js +1 -1
  23. package/dist_browser_EmittersPlugin_js.js +12 -2
  24. package/dist_browser_ShapeManager_js.js +1 -1
  25. package/esm/EmitterInstance.js +50 -32
  26. package/esm/EmittersInteractor.js +1 -1
  27. package/esm/Options/Classes/Emitter.js +13 -4
  28. package/esm/Options/Classes/EmitterSpawn.js +18 -0
  29. package/esm/Options/Interfaces/IEmitterSpawn.js +1 -0
  30. package/esm/index.js +1 -1
  31. package/package.json +3 -3
  32. package/report.html +1 -1
  33. package/tsparticles.plugin.emitters.js +8 -8
  34. package/tsparticles.plugin.emitters.min.js +1 -1
  35. package/types/EmitterInstance.d.ts +6 -1
  36. package/types/Options/Classes/Emitter.d.ts +4 -1
  37. package/types/Options/Classes/EmitterSpawn.d.ts +7 -0
  38. package/types/Options/Interfaces/IEmitter.d.ts +4 -1
  39. package/types/Options/Interfaces/IEmitterSpawn.d.ts +5 -0
  40. package/umd/EmitterInstance.js +49 -31
  41. package/umd/EmittersInteractor.js +1 -1
  42. package/umd/Options/Classes/Emitter.js +14 -5
  43. package/umd/Options/Classes/EmitterSpawn.js +32 -0
  44. package/umd/Options/Interfaces/IEmitterSpawn.js +12 -0
  45. package/umd/index.js +1 -1
  46. package/539.min.js +0 -1
  47. package/75.min.js +0 -1
  48. package/906.min.js +0 -1
  49. package/939.min.js +0 -1
@@ -0,0 +1,5 @@
1
+ import type { IFill, IStroke } from "@tsparticles/engine";
2
+ export interface IEmitterSpawn {
3
+ fill?: IFill;
4
+ stroke?: IStroke;
5
+ }
@@ -13,16 +13,18 @@
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 setParticlesOptionsColor(particlesOptions, color) {
18
- if (particlesOptions.color) {
19
- particlesOptions.color.value = color;
20
- }
21
- else {
22
- particlesOptions.color = {
23
- value: color,
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
30
  container;
@@ -32,7 +34,12 @@
32
34
  options;
33
35
  position;
34
36
  size;
35
- spawnColor;
37
+ spawnFillColor;
38
+ spawnFillEnabled;
39
+ spawnFillOpacity;
40
+ spawnStrokeColor;
41
+ spawnStrokeOpacity;
42
+ spawnStrokeWidth;
36
43
  _currentDuration;
37
44
  _currentEmitDelay;
38
45
  _currentSpawnDelay;
@@ -78,8 +85,11 @@
78
85
  const particlesOptions = (0, engine_1.deepExtend)({}, this.options.particles);
79
86
  particlesOptions.move ??= {};
80
87
  particlesOptions.move.direction ??= this.options.direction;
81
- if (this.options.spawnColor) {
82
- this.spawnColor = (0, engine_1.rangeColorToHsl)(this._engine, this.options.spawnColor);
88
+ if (this.options.spawn.fill?.color) {
89
+ this.spawnFillColor = (0, engine_1.rangeColorToHsl)(this._engine, this.options.spawn.fill.color);
90
+ }
91
+ if (this.options.spawn.stroke?.color) {
92
+ this.spawnStrokeColor = (0, engine_1.rangeColorToHsl)(this._engine, this.options.spawn.stroke.color);
83
93
  }
84
94
  this._paused = !this.options.autoPlay;
85
95
  this._particlesOptions = particlesOptions;
@@ -282,18 +292,36 @@
282
292
  }
283
293
  _emitParticles(quantity) {
284
294
  const singleParticlesOptions = ((0, engine_1.itemFromSingleOrMultiple)(this._particlesOptions) ??
285
- {}), hslAnimation = this.options.spawnColor?.animation, reduceFactor = this.container.retina.reduceFactor, needsColorAnimation = !!hslAnimation, needsShapeData = !!this._shape, needsCopy = needsColorAnimation || needsShapeData, maxValues = needsColorAnimation ? { h: engine_1.hMax, s: engine_1.sMax, l: engine_1.lMax } : null, shapeOptions = this.options.shape;
295
+ {}), 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
296
+ ? engine_1.defaultOpacity
297
+ : (0, engine_1.getRangeValue)(this.options.spawn.fill.opacity), strokeHslAnimation = this.options.spawn.stroke?.color?.animation, strokeOpacity = this.options.spawn.stroke?.opacity === undefined
298
+ ? engine_1.defaultOpacity
299
+ : (0, engine_1.getRangeValue)(this.options.spawn.stroke.opacity), strokeWidth = this.options.spawn.stroke?.width === undefined
300
+ ? defaultStrokeWidth
301
+ : (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;
286
302
  for (let i = 0; i < quantity * reduceFactor; i++) {
287
303
  const particlesOptions = needsCopy
288
304
  ? (0, engine_1.deepExtend)({}, singleParticlesOptions)
289
305
  : singleParticlesOptions;
290
- if (this.spawnColor) {
291
- if (hslAnimation && maxValues) {
292
- this.spawnColor.h = this._setColorAnimation(hslAnimation.h, this.spawnColor.h, maxValues.h, colorFactor);
293
- this.spawnColor.s = this._setColorAnimation(hslAnimation.s, this.spawnColor.s, maxValues.s);
294
- this.spawnColor.l = this._setColorAnimation(hslAnimation.l, this.spawnColor.l, maxValues.l);
306
+ this.spawnFillOpacity = fillOpacity;
307
+ this.spawnFillEnabled = fillEnabled;
308
+ this.spawnStrokeOpacity = strokeOpacity;
309
+ this.spawnStrokeWidth = strokeWidth;
310
+ if (this.spawnFillColor) {
311
+ if (fillHslAnimation && maxValues) {
312
+ this.spawnFillColor.h = this._setColorAnimation(fillHslAnimation.h, this.spawnFillColor.h, maxValues.h, colorFactor);
313
+ this.spawnFillColor.s = this._setColorAnimation(fillHslAnimation.s, this.spawnFillColor.s, maxValues.s);
314
+ this.spawnFillColor.l = this._setColorAnimation(fillHslAnimation.l, this.spawnFillColor.l, maxValues.l);
295
315
  }
296
- setParticlesOptionsColor(particlesOptions, this.spawnColor);
316
+ setParticlesOptionsFillColor(particlesOptions, this.spawnFillColor, this.spawnFillOpacity, this.spawnFillEnabled);
317
+ }
318
+ if (this.spawnStrokeColor) {
319
+ if (strokeHslAnimation && maxValues) {
320
+ this.spawnStrokeColor.h = this._setColorAnimation(strokeHslAnimation.h, this.spawnStrokeColor.h, maxValues.h, colorFactor);
321
+ this.spawnStrokeColor.s = this._setColorAnimation(strokeHslAnimation.s, this.spawnStrokeColor.s, maxValues.s);
322
+ this.spawnStrokeColor.l = this._setColorAnimation(strokeHslAnimation.l, this.spawnStrokeColor.l, maxValues.l);
323
+ }
324
+ setParticlesOptionsStrokeColor(particlesOptions, this.spawnStrokeColor, this.spawnStrokeOpacity, this.spawnStrokeWidth);
297
325
  }
298
326
  let position = this.position;
299
327
  if (this._shape) {
@@ -302,17 +330,7 @@
302
330
  position = shapePosData.position;
303
331
  const replaceData = shapeOptions.replace;
304
332
  if (replaceData.color && shapePosData.color) {
305
- setParticlesOptionsColor(particlesOptions, shapePosData.color);
306
- }
307
- if (replaceData.opacity) {
308
- if (particlesOptions.opacity) {
309
- particlesOptions.opacity.value = shapePosData.opacity;
310
- }
311
- else {
312
- particlesOptions.opacity = {
313
- value: shapePosData.opacity,
314
- };
315
- }
333
+ setParticlesOptionsFillColor(particlesOptions, shapePosData.color, replaceData.opacity ? (shapePosData.opacity ?? engine_1.defaultOpacity) : engine_1.defaultOpacity, true);
316
334
  }
317
335
  }
318
336
  else {
@@ -93,7 +93,7 @@
93
93
  options.emitters.value.push(tmp);
94
94
  }
95
95
  }
96
- else if (Object.hasOwn(source.emitters, "value")) {
96
+ else if ("value" in source.emitters) {
97
97
  const emitterModeOptions = source.emitters;
98
98
  options.emitters.random.enable = emitterModeOptions.random?.enable ?? options.emitters.random.enable;
99
99
  options.emitters.random.count = emitterModeOptions.random?.count ?? options.emitters.random.count;
@@ -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,6 +15,7 @@
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 {
19
20
  autoPlay;
20
21
  direction;
@@ -27,7 +28,9 @@
27
28
  rate;
28
29
  shape;
29
30
  size;
30
- spawnColor;
31
+ spawn;
32
+ spawnFillColor;
33
+ spawnStrokeColor;
31
34
  startCount;
32
35
  constructor() {
33
36
  this.autoPlay = true;
@@ -35,6 +38,7 @@
35
38
  this.life = new EmitterLife_js_1.EmitterLife();
36
39
  this.rate = new EmitterRate_js_1.EmitterRate();
37
40
  this.shape = new EmitterShape_js_1.EmitterShape();
41
+ this.spawn = new EmitterSpawn_js_1.EmitterSpawn();
38
42
  this.startCount = 0;
39
43
  }
40
44
  load(data) {
@@ -62,6 +66,7 @@
62
66
  });
63
67
  this.rate.load(data.rate);
64
68
  this.shape.load(data.shape);
69
+ this.spawn.load(data.spawn);
65
70
  if (data.position !== undefined) {
66
71
  this.position = {};
67
72
  if (data.position.x !== undefined) {
@@ -71,9 +76,13 @@
71
76
  this.position.y = (0, engine_1.setRangeValue)(data.position.y);
72
77
  }
73
78
  }
74
- if (data.spawnColor !== undefined) {
75
- this.spawnColor ??= new engine_1.AnimatableColor();
76
- this.spawnColor.load(data.spawnColor);
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);
77
86
  }
78
87
  if (data.startCount !== undefined) {
79
88
  this.startCount = data.startCount;
@@ -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
@@ -49,7 +49,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
49
49
  exports.loadEmittersPlugin = loadEmittersPlugin;
50
50
  exports.ensureEmittersPluginLoaded = ensureEmittersPluginLoaded;
51
51
  async function loadEmittersPlugin(engine) {
52
- engine.checkVersion("4.0.0-alpha.26");
52
+ engine.checkVersion("4.0.0-alpha.28");
53
53
  await engine.register(async (e) => {
54
54
  const [{ ensureInteractivityPluginLoaded }, { ShapeManager }, { EmittersInstancesManager }, { EmittersPlugin },] = await Promise.all([
55
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),
package/539.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[539],{539(t,i,e){e.r(i),e.d(i,{EmittersInstancesManager:()=>o});var s=e(303),a=e(502);class o{_containerArrays;_engine;constructor(t){this._containerArrays=new Map,this._engine=t}async addEmitter(t,i,s){let o=new a.v;o.load(i);let{EmitterInstance:r}=await e.e(906).then(e.bind(e,906)),n=new r(this._engine,t,i=>{this.removeEmitter(t,i)},o,s);return await n.init(),this.getArray(t).push(n),n}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=>{let 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=>{let e=t.getEmitter?.(i);e&&this.removeEmitter(t,e)},t.playEmitter=i=>{let e=t.getEmitter?.(i);e&&e.externalPlay()},t.pauseEmitter=i=>{let e=t.getEmitter?.(i);e&&e.externalPause()})}removeEmitter(t,i){let e=this.getArray(t).indexOf(i);e>=0&&this.getArray(t).splice(e,1)}}},502(t,i,e){e.d(i,{v:()=>h});var s=e(303);class a{count;delay;duration;wait;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 o{delay;quantity;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 r{color;opacity;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 n{options;replace;type;constructor(){this.options={},this.replace=new r,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(946);class h{autoPlay;direction;domId;fill;life;name;particles;position;rate;shape;size;spawnColor;startCount;constructor(){this.autoPlay=!0,this.fill=!0,this.life=new a,this.rate=new o,this.shape=new n,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))}}},946(t,i,e){e.d(i,{G:()=>a});var s=e(303);class a{height;mode;width;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))}}}}]);
package/75.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[75],{75(t,e,i){i.d(e,{EmittersInteractor:()=>r});var s=i(702),a=i(303),o=i(502);let n={count:1,enable:!0},l="emitters";class r extends s.ExternalInteractorBase{handleClickMode;maxDistance;_instancesManager;constructor(t,e){super(e),this._instancesManager=t,this.maxDistance=0,this.handleClickMode=(t,e)=>{let i,s=this.container.actualOptions.interactivity.modes.emitters;if(!s||t!==l)return;if((0,a.isArray)(s.value)){let t=s.value.length;if(t>0&&s.random.enable){i=[];let e=new Set;for(let o=0;o<s.random.count;o++){let n=(0,a.arrayRandomIndex)(s.value);if(e.has(n)&&e.size<t){o--;continue}e.add(n);let l=(0,a.itemFromArray)(s.value,n);l&&i.push(l)}}else i=s.value}else i=s.value;let o=i,n=e.mouse.clickPosition;(0,a.executeOnSingleOrMultiple)(o,async t=>{await this._instancesManager.addEmitter(this.container,t,n)})}}clear(){}init(){}interact(t,e){for(let t of this._instancesManager.getArray(this.container))t.update(e)}isEnabled(t,e){let i=this.container.actualOptions,s=t.mouse,o=(e?.interactivity??i.interactivity).events;return!!s.clickPosition&&!!o.onClick.enable&&(0,a.isInArray)(l,o.onClick.mode)}loadModeOptions(t,...e){for(let i of(t.emitters={random:n,value:[]},e))if(i?.emitters)if((0,a.isArray)(i.emitters))for(let e of i.emitters){let i=new o.v;i.load(e),t.emitters.value.push(i)}else if(Object.hasOwn(i.emitters,"value")){let e=i.emitters;if(t.emitters.random.enable=e.random?.enable??t.emitters.random.enable,t.emitters.random.count=e.random?.count??t.emitters.random.count,(0,a.isArray)(e.value))for(let i of e.value){let e=new o.v;e.load(i),t.emitters.value.push(e)}else{let i=new o.v;i.load(e.value),t.emitters.value.push(i)}}else{let e=new o.v;e.load(i.emitters),t.emitters.value.push(e)}}removeEmitter(t){let e=this._instancesManager.getArray(this.container).indexOf(t);e>=0&&this._instancesManager.getArray(this.container).splice(e,1)}reset(){}}},502(t,e,i){i.d(e,{v:()=>d});var s=i(303);class a{count;delay;duration;wait;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 o{delay;quantity;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{color;opacity;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 l{options;replace;type;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 r=i(946);class d{autoPlay;direction;domId;fill;life;name;particles;position;rate;shape;size;spawnColor;startCount;constructor(){this.autoPlay=!0,this.fill=!0,this.life=new a,this.rate=new o,this.shape=new l,this.startCount=0}load(t){(0,s.isNull)(t)||(void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.size&&(this.size??=new r.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))}}},946(t,e,i){i.d(e,{G:()=>a});var s=i(303);class a{height;mode;width;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))}}}}]);
package/906.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[906],{906(t,i,e){e.d(i,{EmitterInstance:()=>h});var s=e(303),o=e(502),n=e(946);let a=1;function r(t,i){t.color?t.color.value=i:t.color={value:i}}class h{container;removeCallback;fill;name;options;position;size;spawnColor;_currentDuration;_currentEmitDelay;_currentSpawnDelay;_duration;_emitDelay;_engine;_firstSpawn;_immortal;_initialPosition;_lifeCount;_mutationObserver;_particlesOptions;_paused;_resizeObserver;_shape;_size;_spawnDelay;_startParticlesAdded;constructor(t,i,e,n,a){this.container=i,this.removeCallback=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.container,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||!((this._lifeCount>0||this._immortal||!this.options.life.count)&&(this._firstSpawn||this._currentSpawnDelay>=(this._spawnDelay??0))))return;let t=this.container;if(void 0===this._emitDelay){let 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(){let 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;let 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._spawnDelay,delete this._spawnDelay)),void 0!==this._emitDelay&&(this._currentEmitDelay+=t.value,this._currentEmitDelay>=this._emitDelay&&(this._emit(),this._currentEmitDelay-=this._emitDelay))}_calcPosition(){let t=this.container;if(this.options.domId){let i=(0,s.safeDocument)().getElementById(this.options.domId);if(i){let 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(){let t,i=this.container;if(this.options.domId){let t=(0,s.safeDocument)().getElementById(this.options.domId);if(t){let e=t.getBoundingClientRect();return{width:e.width*i.retina.pixelRatio,height:e.height*i.retina.pixelRatio,mode:s.PixelMode.precise}}}return this.options.size??((t=new n.G).load({height:0,mode:s.PixelMode.percent,width:0}),t)}_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}})};_emit(){if(this._paused)return;let t=(0,s.getRangeValue)(this.options.rate.quantity);this._emitParticles(t)}_emitParticles(t){let i=(0,s.itemFromSingleOrMultiple)(this._particlesOptions)??{},e=this.options.spawnColor?.animation,o=this.container.retina.reduceFactor,n=!!e,a=!!this._shape,h=n||a,l=n?{h:s.hMax,s:s.sMax,l:s.lMax}:null,p=this.options.shape;for(let n=0;n<t*o;n++){let 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)),r(t,this.spawnColor));let o=this.position;if(this._shape){let i=this._shape.randomPosition();if(i){o=i.position;let e=p.replace;e.color&&i.color&&r(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)}}_prepareToDie=()=>{if(this._paused)return;let 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)};_setColorAnimation=(t,i,e,o=a)=>{let n=this.container;if(!t.enable)return i;let r=(0,s.randomInRangeValue)(t.offset),h=(0,s.getRangeValue)(this.options.rate.delay),l=n.retina.reduceFactor?h*s.millisecondsToSeconds/n.retina.reduceFactor:1/0;return(i+(0,s.getRangeValue)(t.speed)*n.fpsLimit/l+r*o)%e}}}}]);
package/939.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[939],{939(t,i,s){s.r(i),s.d(i,{EmittersPlugin:()=>a});var e=s(303),o=s(502);class a{id="emitters";_instancesManager;constructor(t){this._instancesManager=t}async getPlugin(t){let{EmittersPluginInstance:i}=await s.e(244).then(s.bind(s,244));return new i(this._instancesManager,t)}loadOptions(t,i,s){(this.needsPlugin(i)||this.needsPlugin(s))&&s?.emitters&&(i.emitters=(0,e.executeOnSingleOrMultiple)(s.emitters,t=>{let i=new o.v;return i.load(t),i}))}needsPlugin(t){if(!t)return!1;let i=t.emitters;return(0,e.isArray)(i)&&!!i.length||void 0!==i}}},502(t,i,s){s.d(i,{v:()=>r});var e=s(303);class o{count;delay;duration;wait;constructor(){this.wait=!1}load(t){(0,e.isNull)(t)||(void 0!==t.count&&(this.count=t.count),void 0!==t.delay&&(this.delay=(0,e.setRangeValue)(t.delay)),void 0!==t.duration&&(this.duration=(0,e.setRangeValue)(t.duration)),void 0!==t.wait&&(this.wait=t.wait))}}class a{delay;quantity;constructor(){this.quantity=1,this.delay=.1}load(t){(0,e.isNull)(t)||(void 0!==t.quantity&&(this.quantity=(0,e.setRangeValue)(t.quantity)),void 0!==t.delay&&(this.delay=(0,e.setRangeValue)(t.delay)))}}class l{color;opacity;constructor(){this.color=!1,this.opacity=!1}load(t){(0,e.isNull)(t)||(void 0!==t.color&&(this.color=t.color),void 0!==t.opacity&&(this.opacity=t.opacity))}}class n{options;replace;type;constructor(){this.options={},this.replace=new l,this.type="square"}load(t){(0,e.isNull)(t)||(void 0!==t.options&&(this.options=(0,e.deepExtend)({},t.options??{})),this.replace.load(t.replace),void 0!==t.type&&(this.type=t.type))}}var d=s(946);class r{autoPlay;direction;domId;fill;life;name;particles;position;rate;shape;size;spawnColor;startCount;constructor(){this.autoPlay=!0,this.fill=!0,this.life=new o,this.rate=new a,this.shape=new n,this.startCount=0}load(t){(0,e.isNull)(t)||(void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.size&&(this.size??=new d.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,e.executeOnSingleOrMultiple)(t.particles,t=>(0,e.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,e.setRangeValue)(t.position.x)),void 0!==t.position.y&&(this.position.y=(0,e.setRangeValue)(t.position.y))),void 0!==t.spawnColor&&(this.spawnColor??=new e.AnimatableColor,this.spawnColor.load(t.spawnColor)),void 0!==t.startCount&&(this.startCount=t.startCount))}}},946(t,i,s){s.d(i,{G:()=>o});var e=s(303);class o{height;mode;width;constructor(){this.mode=e.PixelMode.percent,this.height=0,this.width=0}load(t){(0,e.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))}}}}]);