@tsparticles/plugin-emitters 3.2.2 → 3.4.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 (51) hide show
  1. package/browser/EmitterInstance.js +11 -11
  2. package/browser/Emitters.js +8 -5
  3. package/browser/EmittersPlugin.js +8 -7
  4. package/browser/Enums/EmitterClickMode.js +4 -1
  5. package/browser/Options/Classes/Emitter.js +1 -1
  6. package/browser/Options/Classes/EmitterSize.js +2 -1
  7. package/browser/index.js +3 -2
  8. package/cjs/EmitterInstance.js +10 -10
  9. package/cjs/Emitters.js +9 -29
  10. package/cjs/EmittersPlugin.js +8 -30
  11. package/cjs/Enums/EmitterClickMode.js +5 -0
  12. package/cjs/Options/Classes/Emitter.js +1 -1
  13. package/cjs/Options/Classes/EmitterSize.js +2 -1
  14. package/cjs/index.js +4 -15
  15. package/esm/EmitterInstance.js +11 -11
  16. package/esm/Emitters.js +8 -5
  17. package/esm/EmittersPlugin.js +8 -7
  18. package/esm/Enums/EmitterClickMode.js +4 -1
  19. package/esm/Options/Classes/Emitter.js +1 -1
  20. package/esm/Options/Classes/EmitterSize.js +2 -1
  21. package/esm/index.js +3 -2
  22. package/package.json +2 -2
  23. package/report.html +1 -1
  24. package/tsparticles.plugin.emitters.js +112 -200
  25. package/tsparticles.plugin.emitters.min.js +1 -1
  26. package/tsparticles.plugin.emitters.min.js.LICENSE.txt +1 -1
  27. package/types/EmitterInstance.d.ts +1 -1
  28. package/types/EmitterShapeBase.d.ts +1 -1
  29. package/types/Emitters.d.ts +3 -3
  30. package/types/EmittersPlugin.d.ts +1 -1
  31. package/types/Enums/EmitterClickMode.d.ts +1 -1
  32. package/types/IEmitterShape.d.ts +1 -1
  33. package/umd/EmitterInstance.js +10 -10
  34. package/umd/Emitters.js +10 -31
  35. package/umd/EmittersPlugin.js +9 -32
  36. package/umd/Enums/EmitterClickMode.js +5 -0
  37. package/umd/Options/Classes/Emitter.js +1 -1
  38. package/umd/Options/Classes/EmitterSize.js +3 -2
  39. package/umd/index.js +5 -17
  40. package/113.min.js +0 -2
  41. package/113.min.js.LICENSE.txt +0 -1
  42. package/927.min.js +0 -2
  43. package/927.min.js.LICENSE.txt +0 -1
  44. package/964.min.js +0 -2
  45. package/964.min.js.LICENSE.txt +0 -1
  46. package/973.min.js +0 -2
  47. package/973.min.js.LICENSE.txt +0 -1
  48. package/dist_browser_EmitterInstance_js.js +0 -30
  49. package/dist_browser_EmittersPlugin_js.js +0 -90
  50. package/dist_browser_Emitters_js.js +0 -30
  51. package/dist_browser_ShapeManager_js.js +0 -30
@@ -9,5 +9,5 @@ export declare abstract class EmitterShapeBase<TOptions = unknown> implements IE
9
9
  protected constructor(position: ICoordinates, size: IDimension, fill: boolean, options: TOptions);
10
10
  resize(position: ICoordinates, size: IDimension): void;
11
11
  abstract init(): Promise<void>;
12
- abstract randomPosition(): Promise<IRandomPositionData | null>;
12
+ abstract randomPosition(): IRandomPositionData | null;
13
13
  }
@@ -1,7 +1,7 @@
1
1
  import { type IContainerPlugin, type ICoordinates, type IDelta, type RecursivePartial, type SingleOrMultiple } from "@tsparticles/engine";
2
- import type { Emitter } from "./Options/Classes/Emitter.js";
2
+ import { Emitter } from "./Options/Classes/Emitter.js";
3
3
  import type { EmitterContainer } from "./EmitterContainer.js";
4
- import type { EmitterInstance } from "./EmitterInstance.js";
4
+ import { EmitterInstance } from "./EmitterInstance.js";
5
5
  import type { EmitterModeOptions } from "./types.js";
6
6
  import type { EmittersEngine } from "./EmittersEngine.js";
7
7
  import type { IEmitter } from "./Options/Interfaces/IEmitter.js";
@@ -20,5 +20,5 @@ export declare class Emitters implements IContainerPlugin {
20
20
  removeEmitter(emitter: EmitterInstance): void;
21
21
  resize(): void;
22
22
  stop(): void;
23
- update(delta: IDelta): Promise<void>;
23
+ update(delta: IDelta): void;
24
24
  }
@@ -1,7 +1,7 @@
1
1
  import type { EmitterOptions, IEmitterOptions } from "./types.js";
2
2
  import { type IOptions, type IPlugin, type RecursivePartial } from "@tsparticles/engine";
3
3
  import type { EmitterContainer } from "./EmitterContainer.js";
4
- import type { Emitters } from "./Emitters.js";
4
+ import { Emitters } from "./Emitters.js";
5
5
  import type { EmittersEngine } from "./EmittersEngine.js";
6
6
  export declare class EmittersPlugin implements IPlugin {
7
7
  readonly id: string;
@@ -1,3 +1,3 @@
1
- export declare const enum EmitterClickMode {
1
+ export declare enum EmitterClickMode {
2
2
  emitter = "emitter"
3
3
  }
@@ -2,6 +2,6 @@ import type { ICoordinates, IDimension } from "@tsparticles/engine";
2
2
  import type { IRandomPositionData } from "./IRandomPositionData.js";
3
3
  export interface IEmitterShape {
4
4
  init(): Promise<void>;
5
- randomPosition(): Promise<IRandomPositionData | null>;
5
+ randomPosition(): IRandomPositionData | null;
6
6
  resize(position: ICoordinates, size: IDimension): void;
7
7
  }
@@ -166,7 +166,7 @@
166
166
  this.size = (0, engine_1.getSize)(this._size, this.container.canvas.size);
167
167
  this._shape?.resize(this.position, this.size);
168
168
  }
169
- async update(delta) {
169
+ update(delta) {
170
170
  if (this._paused) {
171
171
  return;
172
172
  }
@@ -177,7 +177,7 @@
177
177
  }
178
178
  if (!this._startParticlesAdded) {
179
179
  this._startParticlesAdded = true;
180
- await this._emitParticles(this.options.startCount);
180
+ this._emitParticles(this.options.startCount);
181
181
  }
182
182
  if (this._duration !== undefined) {
183
183
  this._currentDuration += delta.value;
@@ -217,7 +217,7 @@
217
217
  if (this._emitDelay !== undefined) {
218
218
  this._currentEmitDelay += delta.value;
219
219
  if (this._currentEmitDelay >= this._emitDelay) {
220
- await this._emit();
220
+ this._emit();
221
221
  this._currentEmitDelay -= this._emitDelay;
222
222
  }
223
223
  }
@@ -247,7 +247,7 @@
247
247
  return {
248
248
  width: elRect.width * container.retina.pixelRatio,
249
249
  height: elRect.height * container.retina.pixelRatio,
250
- mode: "precise",
250
+ mode: engine_1.PixelMode.precise,
251
251
  };
252
252
  }
253
253
  }
@@ -256,20 +256,20 @@
256
256
  const size = new EmitterSize_js_1.EmitterSize();
257
257
  size.load({
258
258
  height: 0,
259
- mode: "percent",
259
+ mode: engine_1.PixelMode.percent,
260
260
  width: 0,
261
261
  });
262
262
  return size;
263
263
  })());
264
264
  }
265
- async _emit() {
265
+ _emit() {
266
266
  if (this._paused) {
267
267
  return;
268
268
  }
269
269
  const quantity = (0, engine_1.getRangeValue)(this.options.rate.quantity);
270
- await this._emitParticles(quantity);
270
+ this._emitParticles(quantity);
271
271
  }
272
- async _emitParticles(quantity) {
272
+ _emitParticles(quantity) {
273
273
  const singleParticlesOptions = (0, engine_1.itemFromSingleOrMultiple)(this._particlesOptions);
274
274
  for (let i = 0; i < quantity; i++) {
275
275
  const particlesOptions = (0, engine_1.deepExtend)({}, singleParticlesOptions);
@@ -290,7 +290,7 @@
290
290
  const shapeOptions = this.options.shape;
291
291
  let position = this.position;
292
292
  if (this._shape) {
293
- const shapePosData = await this._shape.randomPosition();
293
+ const shapePosData = this._shape.randomPosition();
294
294
  if (shapePosData) {
295
295
  position = shapePosData.position;
296
296
  const replaceData = shapeOptions.replace;
@@ -313,7 +313,7 @@
313
313
  }
314
314
  }
315
315
  if (position) {
316
- await this.container.particles.addParticle(position, particlesOptions);
316
+ this.container.particles.addParticle(position, particlesOptions);
317
317
  }
318
318
  }
319
319
  }
package/umd/Emitters.js CHANGED
@@ -1,40 +1,19 @@
1
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
- if (k2 === undefined) k2 = k;
3
- var desc = Object.getOwnPropertyDescriptor(m, k);
4
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
- desc = { enumerable: true, get: function() { return m[k]; } };
6
- }
7
- Object.defineProperty(o, k2, desc);
8
- }) : (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- o[k2] = m[k];
11
- }));
12
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
- Object.defineProperty(o, "default", { enumerable: true, value: v });
14
- }) : function(o, v) {
15
- o["default"] = v;
16
- });
17
- var __importStar = (this && this.__importStar) || function (mod) {
18
- if (mod && mod.__esModule) return mod;
19
- var result = {};
20
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
- __setModuleDefault(result, mod);
22
- return result;
23
- };
24
1
  (function (factory) {
25
2
  if (typeof module === "object" && typeof module.exports === "object") {
26
3
  var v = factory(require, exports);
27
4
  if (v !== undefined) module.exports = v;
28
5
  }
29
6
  else if (typeof define === "function" && define.amd) {
30
- define(["require", "exports", "@tsparticles/engine"], factory);
7
+ define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Emitter.js", "./Enums/EmitterClickMode.js", "./EmitterInstance.js"], factory);
31
8
  }
32
9
  })(function (require, exports) {
33
10
  "use strict";
34
- var __syncRequire = typeof module === "object" && typeof module.exports === "object";
35
11
  Object.defineProperty(exports, "__esModule", { value: true });
36
12
  exports.Emitters = void 0;
37
13
  const engine_1 = require("@tsparticles/engine");
14
+ const Emitter_js_1 = require("./Options/Classes/Emitter.js");
15
+ const EmitterClickMode_js_1 = require("./Enums/EmitterClickMode.js");
16
+ const EmitterInstance_js_1 = require("./EmitterInstance.js");
38
17
  class Emitters {
39
18
  constructor(engine, container) {
40
19
  this.container = container;
@@ -51,7 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
51
30
  const defaultIndex = 0;
52
31
  container.getEmitter = (idxOrName) => idxOrName === undefined || (0, engine_1.isNumber)(idxOrName)
53
32
  ? this.array[idxOrName ?? defaultIndex]
54
- : this.array.find((t) => t.name === idxOrName);
33
+ : this.array.find(t => t.name === idxOrName);
55
34
  container.addEmitter = async (options, position) => this.addEmitter(options, position);
56
35
  container.removeEmitter = (idxOrName) => {
57
36
  const emitter = container.getEmitter(idxOrName);
@@ -73,16 +52,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
73
52
  };
74
53
  }
75
54
  async addEmitter(options, position) {
76
- const { Emitter } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./Options/Classes/Emitter.js"))) : new Promise((resolve_1, reject_1) => { require(["./Options/Classes/Emitter.js"], resolve_1, reject_1); }).then(__importStar)), { EmitterInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmitterInstance.js"))) : new Promise((resolve_2, reject_2) => { require(["./EmitterInstance.js"], resolve_2, reject_2); }).then(__importStar)), emitterOptions = new Emitter();
55
+ const emitterOptions = new Emitter_js_1.Emitter();
77
56
  emitterOptions.load(options);
78
- const emitter = new EmitterInstance(this._engine, this, this.container, emitterOptions, position);
57
+ const emitter = new EmitterInstance_js_1.EmitterInstance(this._engine, this, this.container, emitterOptions, position);
79
58
  await emitter.init();
80
59
  this.array.push(emitter);
81
60
  return emitter;
82
61
  }
83
62
  handleClickMode(mode) {
84
63
  const emitterOptions = this.emitters, modeEmitters = this.interactivityEmitters;
85
- if (mode !== "emitter") {
64
+ if (mode !== EmitterClickMode_js_1.EmitterClickMode.emitter) {
86
65
  return;
87
66
  }
88
67
  let emittersModeOptions;
@@ -152,9 +131,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
152
131
  stop() {
153
132
  this.array = [];
154
133
  }
155
- async update(delta) {
134
+ update(delta) {
156
135
  for (const emitter of this.array) {
157
- await emitter.update(delta);
136
+ emitter.update(delta);
158
137
  }
159
138
  }
160
139
  }
@@ -1,56 +1,33 @@
1
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
- if (k2 === undefined) k2 = k;
3
- var desc = Object.getOwnPropertyDescriptor(m, k);
4
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
- desc = { enumerable: true, get: function() { return m[k]; } };
6
- }
7
- Object.defineProperty(o, k2, desc);
8
- }) : (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- o[k2] = m[k];
11
- }));
12
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
- Object.defineProperty(o, "default", { enumerable: true, value: v });
14
- }) : function(o, v) {
15
- o["default"] = v;
16
- });
17
- var __importStar = (this && this.__importStar) || function (mod) {
18
- if (mod && mod.__esModule) return mod;
19
- var result = {};
20
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
- __setModuleDefault(result, mod);
22
- return result;
23
- };
24
1
  (function (factory) {
25
2
  if (typeof module === "object" && typeof module.exports === "object") {
26
3
  var v = factory(require, exports);
27
4
  if (v !== undefined) module.exports = v;
28
5
  }
29
6
  else if (typeof define === "function" && define.amd) {
30
- define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Emitter.js"], factory);
7
+ define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Emitter.js", "./Enums/EmitterClickMode.js", "./Emitters.js"], factory);
31
8
  }
32
9
  })(function (require, exports) {
33
10
  "use strict";
34
- var __syncRequire = typeof module === "object" && typeof module.exports === "object";
35
11
  Object.defineProperty(exports, "__esModule", { value: true });
36
12
  exports.EmittersPlugin = void 0;
37
13
  const engine_1 = require("@tsparticles/engine");
38
14
  const Emitter_js_1 = require("./Options/Classes/Emitter.js");
15
+ const EmitterClickMode_js_1 = require("./Enums/EmitterClickMode.js");
16
+ const Emitters_js_1 = require("./Emitters.js");
39
17
  class EmittersPlugin {
40
18
  constructor(engine) {
41
19
  this._engine = engine;
42
20
  this.id = "emitters";
43
21
  }
44
- async getPlugin(container) {
45
- const { Emitters } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./Emitters.js"))) : new Promise((resolve_1, reject_1) => { require(["./Emitters.js"], resolve_1, reject_1); }).then(__importStar));
46
- return new Emitters(this._engine, container);
22
+ getPlugin(container) {
23
+ return Promise.resolve(new Emitters_js_1.Emitters(this._engine, container));
47
24
  }
48
25
  loadOptions(options, source) {
49
26
  if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
50
27
  return;
51
28
  }
52
29
  if (source?.emitters) {
53
- options.emitters = (0, engine_1.executeOnSingleOrMultiple)(source.emitters, (emitter) => {
30
+ options.emitters = (0, engine_1.executeOnSingleOrMultiple)(source.emitters, emitter => {
54
31
  const tmp = new Emitter_js_1.Emitter();
55
32
  tmp.load(emitter);
56
33
  return tmp;
@@ -64,7 +41,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
64
41
  count: 1,
65
42
  enable: true,
66
43
  },
67
- value: interactivityEmitters.map((s) => {
44
+ value: interactivityEmitters.map(s => {
68
45
  const tmp = new Emitter_js_1.Emitter();
69
46
  tmp.load(s);
70
47
  return tmp;
@@ -81,7 +58,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
81
58
  count: emitterMode.random.count ?? defaultCount,
82
59
  enable: emitterMode.random.enable ?? false,
83
60
  },
84
- value: emitterMode.value.map((s) => {
61
+ value: emitterMode.value.map(s => {
85
62
  const tmp = new Emitter_js_1.Emitter();
86
63
  tmp.load(s);
87
64
  return tmp;
@@ -121,7 +98,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
121
98
  return (((0, engine_1.isArray)(emitters) && !!emitters.length) ||
122
99
  emitters !== undefined ||
123
100
  (!!options.interactivity?.events?.onClick?.mode &&
124
- (0, engine_1.isInArray)("emitter", options.interactivity.events.onClick.mode)));
101
+ (0, engine_1.isInArray)(EmitterClickMode_js_1.EmitterClickMode.emitter, options.interactivity.events.onClick.mode)));
125
102
  }
126
103
  }
127
104
  exports.EmittersPlugin = EmittersPlugin;
@@ -9,4 +9,9 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EmitterClickMode = void 0;
13
+ var EmitterClickMode;
14
+ (function (EmitterClickMode) {
15
+ EmitterClickMode["emitter"] = "emitter";
16
+ })(EmitterClickMode || (exports.EmitterClickMode = EmitterClickMode = {}));
12
17
  });
@@ -46,7 +46,7 @@
46
46
  }
47
47
  this.life.load(data.life);
48
48
  this.name = data.name;
49
- this.particles = (0, engine_1.executeOnSingleOrMultiple)(data.particles, (particles) => {
49
+ this.particles = (0, engine_1.executeOnSingleOrMultiple)(data.particles, particles => {
50
50
  return (0, engine_1.deepExtend)({}, particles);
51
51
  });
52
52
  this.rate.load(data.rate);
@@ -4,15 +4,16 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
7
+ define(["require", "exports", "@tsparticles/engine"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.EmitterSize = void 0;
13
+ const engine_1 = require("@tsparticles/engine");
13
14
  class EmitterSize {
14
15
  constructor() {
15
- this.mode = "percent";
16
+ this.mode = engine_1.PixelMode.percent;
16
17
  this.height = 0;
17
18
  this.width = 0;
18
19
  }
package/umd/index.js CHANGED
@@ -9,18 +9,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
9
9
  if (k2 === undefined) k2 = k;
10
10
  o[k2] = m[k];
11
11
  }));
12
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
- Object.defineProperty(o, "default", { enumerable: true, value: v });
14
- }) : function(o, v) {
15
- o["default"] = v;
16
- });
17
- var __importStar = (this && this.__importStar) || function (mod) {
18
- if (mod && mod.__esModule) return mod;
19
- var result = {};
20
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
- __setModuleDefault(result, mod);
22
- return result;
23
- };
24
12
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
13
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
14
  };
@@ -30,24 +18,24 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
18
  if (v !== undefined) module.exports = v;
31
19
  }
32
20
  else if (typeof define === "function" && define.amd) {
33
- define(["require", "exports", "./EmitterContainer.js", "./EmitterShapeBase.js", "./EmittersEngine.js", "./IEmitterShape.js", "./IEmitterShapeGenerator.js", "./Enums/EmitterClickMode.js", "./IRandomPositionData.js"], factory);
21
+ define(["require", "exports", "./EmittersPlugin.js", "./ShapeManager.js", "./EmitterContainer.js", "./EmitterShapeBase.js", "./EmittersEngine.js", "./IEmitterShape.js", "./IEmitterShapeGenerator.js", "./Enums/EmitterClickMode.js", "./IRandomPositionData.js"], factory);
34
22
  }
35
23
  })(function (require, exports) {
36
24
  "use strict";
37
- var __syncRequire = typeof module === "object" && typeof module.exports === "object";
38
25
  Object.defineProperty(exports, "__esModule", { value: true });
39
26
  exports.loadEmittersPlugin = void 0;
27
+ const EmittersPlugin_js_1 = require("./EmittersPlugin.js");
28
+ const ShapeManager_js_1 = require("./ShapeManager.js");
40
29
  async function loadEmittersPlugin(engine, refresh = true) {
41
30
  if (!engine.emitterShapeManager) {
42
- const { ShapeManager } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./ShapeManager.js"))) : new Promise((resolve_1, reject_1) => { require(["./ShapeManager.js"], resolve_1, reject_1); }).then(__importStar));
43
- engine.emitterShapeManager = new ShapeManager(engine);
31
+ engine.emitterShapeManager = new ShapeManager_js_1.ShapeManager(engine);
44
32
  }
45
33
  if (!engine.addEmitterShapeGenerator) {
46
34
  engine.addEmitterShapeGenerator = (name, generator) => {
47
35
  engine.emitterShapeManager?.addShapeGenerator(name, generator);
48
36
  };
49
37
  }
50
- const { EmittersPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmittersPlugin.js"))) : new Promise((resolve_2, reject_2) => { require(["./EmittersPlugin.js"], resolve_2, reject_2); }).then(__importStar)), plugin = new EmittersPlugin(engine);
38
+ const plugin = new EmittersPlugin_js_1.EmittersPlugin(engine);
51
39
  await engine.addPlugin(plugin, refresh);
52
40
  }
53
41
  exports.loadEmittersPlugin = loadEmittersPlugin;
package/113.min.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 113.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[113],{113:(e,t,r)=>{r.d(t,{ShapeManager:()=>s});const a=new Map;class s{constructor(e){this._engine=e}addShapeGenerator(e,t){this.getShapeGenerator(e)||a.set(e,t)}getShapeGenerator(e){return a.get(e)}getSupportedShapeGenerators(){return a.keys()}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles Emitters Plugin v3.2.2 by Matteo Bruni */
package/927.min.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 927.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[927],{927:(t,i,s)=>{s.d(i,{EmitterInstance:()=>r});var e=s(533),n=s(177),o=s(518);function a(t,i){t.color?t.color.value=i:t.color={value:i}}class r{constructor(t,i,s,o,a){this.emitters=i,this.container=s,this._destroy=()=>{this._mutationObserver?.disconnect(),this._mutationObserver=void 0,this._resizeObserver?.disconnect(),this._resizeObserver=void 0,this.emitters.removeEmitter(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,e.getRangeValue)(this.options.life.duration):void 0;this.container.retina.reduceFactor&&(this._lifeCount>0||this._immortal)&&void 0!==t&&t>0&&(this._duration=t*e.millisecondsToSeconds)},this._setColorAnimation=(t,i,s,n=1)=>{const o=this.container;if(!t.enable)return i;const a=(0,e.randomInRange)(t.offset),r=(0,e.getRangeValue)(this.options.rate.delay)*e.millisecondsToSeconds/o.retina.reduceFactor;return(i+(0,e.getRangeValue)(t.speed??0)*o.fpsLimit/r+a*n)%s},this._engine=t,this._currentDuration=0,this._currentEmitDelay=0,this._currentSpawnDelay=0,this._initialPosition=a,o instanceof n.Emitter?this.options=o:(this.options=new n.Emitter,this.options.load(o)),this._spawnDelay=(0,e.getRangeValue)(this.options.life.delay??0)*e.millisecondsToSeconds/this.container.retina.reduceFactor,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;let r=(0,e.deepExtend)({},this.options.particles);if(r??={},r.move??={},r.move.direction??=this.options.direction,this.options.spawnColor&&(this.spawnColor=(0,e.rangeColorToHsl)(this.options.spawnColor)),this._paused=!this.options.autoPlay,this._particlesOptions=r,this._size=this._calcSize(),this.size=(0,e.getSize)(this._size,this.container.canvas.size),this._lifeCount=this.options.life.count??-1,this._immortal=this._lifeCount<=0,this.options.domId){const t=document.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:s,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.container.retina.reduceFactor&&(this._lifeCount>0||this._immortal||!this.options.life.count)&&(this._firstSpawn||this._currentSpawnDelay>=(this._spawnDelay??0))){if(void 0===this._emitDelay){const t=(0,e.getRangeValue)(this.options.rate.delay);this._emitDelay=t*e.millisecondsToSeconds/this.container.retina.reduceFactor}(this._lifeCount>0||this._immortal)&&this._prepareToDie()}}resize(){const t=this._initialPosition;this.position=t&&(0,e.isPointInside)(t,this.container.canvas.size,e.Vector.origin)?t:this._calcPosition(),this._size=this._calcSize(),this.size=(0,e.getSize)(this._size,this.container.canvas.size),this._shape?.resize(this.position,this.size)}async update(t){this._paused||(this._firstSpawn&&(this._firstSpawn=!1,this._currentSpawnDelay=this._spawnDelay??0,this._currentEmitDelay=this._emitDelay??0),this._startParticlesAdded||(this._startParticlesAdded=!0,await 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=(0,e.getRangeValue)(this.options.life.delay??0)*e.millisecondsToSeconds/this.container.retina.reduceFactor):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&&(await this._emit(),this._currentEmitDelay-=this._emitDelay)))}_calcPosition(){if(this.options.domId){const t=document.getElementById(this.options.domId);if(t){const i=t.getBoundingClientRect(),s=this.container.retina.pixelRatio;return{x:(i.x+.5*i.width)*s,y:(i.y+.5*i.height)*s}}}return(0,e.calcPositionOrRandomFromSizeRanged)({size:this.container.canvas.size,position:this.options.position})}_calcSize(){const t=this.container;if(this.options.domId){const i=document.getElementById(this.options.domId);if(i){const s=i.getBoundingClientRect();return{width:s.width*t.retina.pixelRatio,height:s.height*t.retina.pixelRatio,mode:"precise"}}}return this.options.size??(()=>{const t=new o.r;return t.load({height:0,mode:"percent",width:0}),t})()}async _emit(){if(this._paused)return;const t=(0,e.getRangeValue)(this.options.rate.quantity);await this._emitParticles(t)}async _emitParticles(t){const i=(0,e.itemFromSingleOrMultiple)(this._particlesOptions);for(let s=0;s<t;s++){const t=(0,e.deepExtend)({},i);if(this.spawnColor){const i=this.options.spawnColor?.animation;if(i){const t={h:360,s:100,l:100},s=3.6;this.spawnColor.h=this._setColorAnimation(i.h,this.spawnColor.h,t.h,s),this.spawnColor.s=this._setColorAnimation(i.s,this.spawnColor.s,t.s),this.spawnColor.l=this._setColorAnimation(i.l,this.spawnColor.l,t.l)}a(t,this.spawnColor)}const s=this.options.shape;let n=this.position;if(this._shape){const i=await this._shape.randomPosition();if(i){n=i.position;const e=s.replace;e.color&&i.color&&a(t,i.color),e.opacity&&(t.opacity?t.opacity.value=i.opacity:t.opacity={value:i.opacity})}else n=null}n&&await this.container.particles.addParticle(n,t)}}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles Emitters Plugin v3.2.2 by Matteo Bruni */
package/964.min.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 964.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[964],{964:(t,i,e)=>{e.d(i,{EmittersPlugin:()=>a});var o=e(533),s=e(177);class a{constructor(t){this._engine=t,this.id="emitters"}async getPlugin(t){const{Emitters:i}=await e.e(973).then(e.bind(e,973));return new i(this._engine,t)}loadOptions(t,i){if(!this.needsPlugin(t)&&!this.needsPlugin(i))return;i?.emitters&&(t.emitters=(0,o.executeOnSingleOrMultiple)(i.emitters,(t=>{const i=new s.Emitter;return i.load(t),i})));const e=i?.interactivity?.modes?.emitters;if(e)if((0,o.isArray)(e))t.interactivity.modes.emitters={random:{count:1,enable:!0},value:e.map((t=>{const i=new s.Emitter;return i.load(t),i}))};else{const i=e;if(void 0!==i.value){const e=1;if((0,o.isArray)(i.value))t.interactivity.modes.emitters={random:{count:i.random.count??e,enable:i.random.enable??!1},value:i.value.map((t=>{const i=new s.Emitter;return i.load(t),i}))};else{const o=new s.Emitter;o.load(i.value),t.interactivity.modes.emitters={random:{count:i.random.count??e,enable:i.random.enable??!1},value:o}}}else{(t.interactivity.modes.emitters={random:{count:1,enable:!1},value:new s.Emitter}).value.load(e)}}}needsPlugin(t){if(!t)return!1;const i=t.emitters;return(0,o.isArray)(i)&&!!i.length||void 0!==i||!!t.interactivity?.events?.onClick?.mode&&(0,o.isInArray)("emitter",t.interactivity.events.onClick.mode)}}},177:(t,i,e)=>{e.d(i,{Emitter:()=>d});var o=e(533);class s{constructor(){this.wait=!1}load(t){t&&(void 0!==t.count&&(this.count=t.count),void 0!==t.delay&&(this.delay=(0,o.setRangeValue)(t.delay)),void 0!==t.duration&&(this.duration=(0,o.setRangeValue)(t.duration)),void 0!==t.wait&&(this.wait=t.wait))}}class a{constructor(){this.quantity=1,this.delay=.1}load(t){void 0!==t&&(void 0!==t.quantity&&(this.quantity=(0,o.setRangeValue)(t.quantity)),void 0!==t.delay&&(this.delay=(0,o.setRangeValue)(t.delay)))}}class n{constructor(){this.color=!1,this.opacity=!1}load(t){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){t&&(void 0!==t.options&&(this.options=(0,o.deepExtend)({},t.options??{})),this.replace.load(t.replace),void 0!==t.type&&(this.type=t.type))}}var l=e(518);class d{constructor(){this.autoPlay=!0,this.fill=!0,this.life=new s,this.rate=new a,this.shape=new r,this.startCount=0}load(t){t&&(void 0!==t.autoPlay&&(this.autoPlay=t.autoPlay),void 0!==t.size&&(this.size||(this.size=new l.r),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,o.executeOnSingleOrMultiple)(t.particles,(t=>(0,o.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,o.setRangeValue)(t.position.x)),void 0!==t.position.y&&(this.position.y=(0,o.setRangeValue)(t.position.y))),void 0!==t.spawnColor&&(void 0===this.spawnColor&&(this.spawnColor=new o.AnimatableColor),this.spawnColor.load(t.spawnColor)),void 0!==t.startCount&&(this.startCount=t.startCount))}}},518:(t,i,e)=>{e.d(i,{r:()=>o});class o{constructor(){this.mode="percent",this.height=0,this.width=0}load(t){void 0!==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))}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles Emitters Plugin v3.2.2 by Matteo Bruni */
package/973.min.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 973.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).push([[973],{973:(t,e,i)=>{i.d(e,{Emitters:()=>r});var s=i(533);class r{constructor(t,e){this.container=e,this._engine=t,this.array=[],this.emitters=[],this.interactivityEmitters={random:{count:1,enable:!1},value:[]};e.getEmitter=t=>void 0===t||(0,s.isNumber)(t)?this.array[t??0]:this.array.find((e=>e.name===t)),e.addEmitter=async(t,e)=>this.addEmitter(t,e),e.removeEmitter=t=>{const i=e.getEmitter(t);i&&this.removeEmitter(i)},e.playEmitter=t=>{const i=e.getEmitter(t);i&&i.externalPlay()},e.pauseEmitter=t=>{const i=e.getEmitter(t);i&&i.externalPause()}}async addEmitter(t,e){const{Emitter:s}=await Promise.resolve().then(i.bind(i,177)),{EmitterInstance:r}=await i.e(927).then(i.bind(i,927)),a=new s;a.load(t);const n=new r(this._engine,this,this.container,a,e);return await n.init(),this.array.push(n),n}handleClickMode(t){const e=this.emitters,i=this.interactivityEmitters;if("emitter"!==t)return;let r;if(i&&(0,s.isArray)(i.value)){const t=0;if(i.value.length>t&&i.random.enable){r=[];const t=[];for(let e=0;e<i.random.count;e++){const a=(0,s.arrayRandomIndex)(i.value);t.includes(a)&&t.length<i.value.length?e--:(t.push(a),r.push((0,s.itemFromArray)(i.value,a)))}}else r=i.value}else r=i?.value;const a=r??e,n=this.container.interactivity.mouse.clickPosition;(0,s.executeOnSingleOrMultiple)(a,(async t=>{await this.addEmitter(t,n)}))}async init(){if(this.emitters=this.container.actualOptions.emitters,this.interactivityEmitters=this.container.actualOptions.interactivity.modes.emitters,this.emitters)if((0,s.isArray)(this.emitters))for(const t of this.emitters)await this.addEmitter(t);else await this.addEmitter(this.emitters)}pause(){for(const t of this.array)t.pause()}play(){for(const t of this.array)t.play()}removeEmitter(t){const e=this.array.indexOf(t);e>=0&&this.array.splice(e,1)}resize(){for(const t of this.array)t.resize()}stop(){this.array=[]}async update(t){for(const e of this.array)await e.update(t)}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles Emitters Plugin v3.2.2 by Matteo Bruni */
@@ -1,30 +0,0 @@
1
- /*!
2
- * Author : Matteo Bruni
3
- * MIT license: https://opensource.org/licenses/MIT
4
- * Demo / Generator : https://particles.js.org/
5
- * GitHub : https://www.github.com/matteobruni/tsparticles
6
- * How to use? : Check the GitHub README
7
- * v3.2.2
8
- */
9
- "use strict";
10
- /*
11
- * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
- * This devtool is neither made for production nor for readable output files.
13
- * It uses "eval()" calls to create a separate source file in the browser devtools.
14
- * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
- * or disable the default devtool with "devtool: false".
16
- * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
- */
18
- (this["webpackChunk_tsparticles_plugin_emitters"] = this["webpackChunk_tsparticles_plugin_emitters"] || []).push([["dist_browser_EmitterInstance_js"],{
19
-
20
- /***/ "./dist/browser/EmitterInstance.js":
21
- /*!*****************************************!*\
22
- !*** ./dist/browser/EmitterInstance.js ***!
23
- \*****************************************/
24
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25
-
26
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterInstance: () => (/* binding */ EmitterInstance)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Emitter.js */ \"./dist/browser/Options/Classes/Emitter.js\");\n/* harmony import */ var _Options_Classes_EmitterSize_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/EmitterSize.js */ \"./dist/browser/Options/Classes/EmitterSize.js\");\n\n\n\nconst half = 0.5,\n defaultLifeDelay = 0,\n minLifeCount = 0,\n defaultSpawnDelay = 0,\n defaultEmitDelay = 0,\n defaultLifeCount = -1,\n defaultColorAnimationFactor = 1;\nfunction setParticlesOptionsColor(particlesOptions, color) {\n if (particlesOptions.color) {\n particlesOptions.color.value = color;\n } else {\n particlesOptions.color = {\n value: color\n };\n }\n}\nclass EmitterInstance {\n constructor(engine, emitters, container, options, position) {\n this.emitters = emitters;\n this.container = container;\n this._destroy = () => {\n this._mutationObserver?.disconnect();\n this._mutationObserver = undefined;\n this._resizeObserver?.disconnect();\n this._resizeObserver = undefined;\n this.emitters.removeEmitter(this);\n this._engine.dispatchEvent(\"emitterDestroyed\", {\n container: this.container,\n data: {\n emitter: this\n }\n });\n };\n this._prepareToDie = () => {\n if (this._paused) {\n return;\n }\n const duration = this.options.life?.duration !== undefined ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.life.duration) : undefined,\n minDuration = 0,\n minLifeCount = 0;\n if (this.container.retina.reduceFactor && (this._lifeCount > minLifeCount || this._immortal) && duration !== undefined && duration > minDuration) {\n this._duration = duration * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds;\n }\n };\n this._setColorAnimation = (animation, initValue, maxValue, factor = defaultColorAnimationFactor) => {\n const container = this.container;\n if (!animation.enable) {\n return initValue;\n }\n const colorOffset = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRange)(animation.offset),\n delay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.rate.delay),\n emitFactor = delay * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / container.retina.reduceFactor,\n defaultColorSpeed = 0,\n colorSpeed = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(animation.speed ?? defaultColorSpeed);\n return (initValue + colorSpeed * container.fpsLimit / emitFactor + colorOffset * factor) % maxValue;\n };\n this._engine = engine;\n this._currentDuration = 0;\n this._currentEmitDelay = 0;\n this._currentSpawnDelay = 0;\n this._initialPosition = position;\n if (options instanceof _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter) {\n this.options = options;\n } else {\n this.options = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter();\n this.options.load(options);\n }\n this._spawnDelay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.life.delay ?? defaultLifeDelay) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / this.container.retina.reduceFactor;\n this.position = this._initialPosition ?? this._calcPosition();\n this.name = this.options.name;\n this.fill = this.options.fill;\n this._firstSpawn = !this.options.life.wait;\n this._startParticlesAdded = false;\n let particlesOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, this.options.particles);\n particlesOptions ??= {};\n particlesOptions.move ??= {};\n particlesOptions.move.direction ??= this.options.direction;\n if (this.options.spawnColor) {\n this.spawnColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(this.options.spawnColor);\n }\n this._paused = !this.options.autoPlay;\n this._particlesOptions = particlesOptions;\n this._size = this._calcSize();\n this.size = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getSize)(this._size, this.container.canvas.size);\n this._lifeCount = this.options.life.count ?? defaultLifeCount;\n this._immortal = this._lifeCount <= minLifeCount;\n if (this.options.domId) {\n const element = document.getElementById(this.options.domId);\n if (element) {\n this._mutationObserver = new MutationObserver(() => {\n this.resize();\n });\n this._resizeObserver = new ResizeObserver(() => {\n this.resize();\n });\n this._mutationObserver.observe(element, {\n attributes: true,\n attributeFilter: [\"style\", \"width\", \"height\"]\n });\n this._resizeObserver.observe(element);\n }\n }\n const shapeOptions = this.options.shape,\n shapeGenerator = this._engine.emitterShapeManager?.getShapeGenerator(shapeOptions.type);\n if (shapeGenerator) {\n this._shape = shapeGenerator.generate(this.position, this.size, this.fill, shapeOptions.options);\n }\n this._engine.dispatchEvent(\"emitterCreated\", {\n container,\n data: {\n emitter: this\n }\n });\n this.play();\n }\n externalPause() {\n this._paused = true;\n this.pause();\n }\n externalPlay() {\n this._paused = false;\n this.play();\n }\n async init() {\n await this._shape?.init();\n }\n pause() {\n if (this._paused) {\n return;\n }\n delete this._emitDelay;\n }\n play() {\n if (this._paused) {\n return;\n }\n if (!(this.container.retina.reduceFactor && (this._lifeCount > minLifeCount || this._immortal || !this.options.life.count) && (this._firstSpawn || this._currentSpawnDelay >= (this._spawnDelay ?? defaultSpawnDelay)))) {\n return;\n }\n if (this._emitDelay === undefined) {\n const delay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.rate.delay);\n this._emitDelay = delay * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / this.container.retina.reduceFactor;\n }\n if (this._lifeCount > minLifeCount || this._immortal) {\n this._prepareToDie();\n }\n }\n resize() {\n const initialPosition = this._initialPosition;\n this.position = initialPosition && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isPointInside)(initialPosition, this.container.canvas.size, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.origin) ? initialPosition : this._calcPosition();\n this._size = this._calcSize();\n this.size = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getSize)(this._size, this.container.canvas.size);\n this._shape?.resize(this.position, this.size);\n }\n async update(delta) {\n if (this._paused) {\n return;\n }\n if (this._firstSpawn) {\n this._firstSpawn = false;\n this._currentSpawnDelay = this._spawnDelay ?? defaultSpawnDelay;\n this._currentEmitDelay = this._emitDelay ?? defaultEmitDelay;\n }\n if (!this._startParticlesAdded) {\n this._startParticlesAdded = true;\n await this._emitParticles(this.options.startCount);\n }\n if (this._duration !== undefined) {\n this._currentDuration += delta.value;\n if (this._currentDuration >= this._duration) {\n this.pause();\n if (this._spawnDelay !== undefined) {\n delete this._spawnDelay;\n }\n if (!this._immortal) {\n this._lifeCount--;\n }\n if (this._lifeCount > minLifeCount || this._immortal) {\n this.position = this._calcPosition();\n this._shape?.resize(this.position, this.size);\n this._spawnDelay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.life.delay ?? defaultLifeDelay) * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / this.container.retina.reduceFactor;\n } else {\n this._destroy();\n }\n this._currentDuration -= this._duration;\n delete this._duration;\n }\n }\n if (this._spawnDelay !== undefined) {\n this._currentSpawnDelay += delta.value;\n if (this._currentSpawnDelay >= this._spawnDelay) {\n this._engine.dispatchEvent(\"emitterPlay\", {\n container: this.container\n });\n this.play();\n this._currentSpawnDelay -= this._currentSpawnDelay;\n delete this._spawnDelay;\n }\n }\n if (this._emitDelay !== undefined) {\n this._currentEmitDelay += delta.value;\n if (this._currentEmitDelay >= this._emitDelay) {\n await this._emit();\n this._currentEmitDelay -= this._emitDelay;\n }\n }\n }\n _calcPosition() {\n if (this.options.domId) {\n const element = document.getElementById(this.options.domId);\n if (element) {\n const elRect = element.getBoundingClientRect(),\n pxRatio = this.container.retina.pixelRatio;\n return {\n x: (elRect.x + elRect.width * half) * pxRatio,\n y: (elRect.y + elRect.height * half) * pxRatio\n };\n }\n }\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.calcPositionOrRandomFromSizeRanged)({\n size: this.container.canvas.size,\n position: this.options.position\n });\n }\n _calcSize() {\n const container = this.container;\n if (this.options.domId) {\n const element = document.getElementById(this.options.domId);\n if (element) {\n const elRect = element.getBoundingClientRect();\n return {\n width: elRect.width * container.retina.pixelRatio,\n height: elRect.height * container.retina.pixelRatio,\n mode: \"precise\"\n };\n }\n }\n return this.options.size ?? (() => {\n const size = new _Options_Classes_EmitterSize_js__WEBPACK_IMPORTED_MODULE_2__.EmitterSize();\n size.load({\n height: 0,\n mode: \"percent\",\n width: 0\n });\n return size;\n })();\n }\n async _emit() {\n if (this._paused) {\n return;\n }\n const quantity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(this.options.rate.quantity);\n await this._emitParticles(quantity);\n }\n async _emitParticles(quantity) {\n const singleParticlesOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(this._particlesOptions);\n for (let i = 0; i < quantity; i++) {\n const particlesOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, singleParticlesOptions);\n if (this.spawnColor) {\n const hslAnimation = this.options.spawnColor?.animation;\n if (hslAnimation) {\n const maxValues = {\n h: 360,\n s: 100,\n l: 100\n },\n colorFactor = 3.6;\n this.spawnColor.h = this._setColorAnimation(hslAnimation.h, this.spawnColor.h, maxValues.h, colorFactor);\n this.spawnColor.s = this._setColorAnimation(hslAnimation.s, this.spawnColor.s, maxValues.s);\n this.spawnColor.l = this._setColorAnimation(hslAnimation.l, this.spawnColor.l, maxValues.l);\n }\n setParticlesOptionsColor(particlesOptions, this.spawnColor);\n }\n const shapeOptions = this.options.shape;\n let position = this.position;\n if (this._shape) {\n const shapePosData = await this._shape.randomPosition();\n if (shapePosData) {\n position = shapePosData.position;\n const replaceData = shapeOptions.replace;\n if (replaceData.color && shapePosData.color) {\n setParticlesOptionsColor(particlesOptions, shapePosData.color);\n }\n if (replaceData.opacity) {\n if (particlesOptions.opacity) {\n particlesOptions.opacity.value = shapePosData.opacity;\n } else {\n particlesOptions.opacity = {\n value: shapePosData.opacity\n };\n }\n }\n } else {\n position = null;\n }\n }\n if (position) {\n await this.container.particles.addParticle(position, particlesOptions);\n }\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/EmitterInstance.js?");
27
-
28
- /***/ })
29
-
30
- }]);
@@ -1,90 +0,0 @@
1
- /*!
2
- * Author : Matteo Bruni
3
- * MIT license: https://opensource.org/licenses/MIT
4
- * Demo / Generator : https://particles.js.org/
5
- * GitHub : https://www.github.com/matteobruni/tsparticles
6
- * How to use? : Check the GitHub README
7
- * v3.2.2
8
- */
9
- "use strict";
10
- /*
11
- * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
- * This devtool is neither made for production nor for readable output files.
13
- * It uses "eval()" calls to create a separate source file in the browser devtools.
14
- * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
- * or disable the default devtool with "devtool: false".
16
- * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
- */
18
- (this["webpackChunk_tsparticles_plugin_emitters"] = this["webpackChunk_tsparticles_plugin_emitters"] || []).push([["dist_browser_EmittersPlugin_js"],{
19
-
20
- /***/ "./dist/browser/EmittersPlugin.js":
21
- /*!****************************************!*\
22
- !*** ./dist/browser/EmittersPlugin.js ***!
23
- \****************************************/
24
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25
-
26
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmittersPlugin: () => (/* binding */ EmittersPlugin)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Emitter.js */ \"./dist/browser/Options/Classes/Emitter.js\");\n\n\nclass EmittersPlugin {\n constructor(engine) {\n this._engine = engine;\n this.id = \"emitters\";\n }\n async getPlugin(container) {\n const {\n Emitters\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_Emitters_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Emitters.js */ \"./dist/browser/Emitters.js\"));\n return new Emitters(this._engine, container);\n }\n loadOptions(options, source) {\n if (!this.needsPlugin(options) && !this.needsPlugin(source)) {\n return;\n }\n if (source?.emitters) {\n options.emitters = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(source.emitters, emitter => {\n const tmp = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter();\n tmp.load(emitter);\n return tmp;\n });\n }\n const interactivityEmitters = source?.interactivity?.modes?.emitters;\n if (interactivityEmitters) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(interactivityEmitters)) {\n options.interactivity.modes.emitters = {\n random: {\n count: 1,\n enable: true\n },\n value: interactivityEmitters.map(s => {\n const tmp = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter();\n tmp.load(s);\n return tmp;\n })\n };\n } else {\n const emitterMode = interactivityEmitters;\n if (emitterMode.value !== undefined) {\n const defaultCount = 1;\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(emitterMode.value)) {\n options.interactivity.modes.emitters = {\n random: {\n count: emitterMode.random.count ?? defaultCount,\n enable: emitterMode.random.enable ?? false\n },\n value: emitterMode.value.map(s => {\n const tmp = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter();\n tmp.load(s);\n return tmp;\n })\n };\n } else {\n const tmp = new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter();\n tmp.load(emitterMode.value);\n options.interactivity.modes.emitters = {\n random: {\n count: emitterMode.random.count ?? defaultCount,\n enable: emitterMode.random.enable ?? false\n },\n value: tmp\n };\n }\n } else {\n const emitterOptions = options.interactivity.modes.emitters = {\n random: {\n count: 1,\n enable: false\n },\n value: new _Options_Classes_Emitter_js__WEBPACK_IMPORTED_MODULE_1__.Emitter()\n };\n emitterOptions.value.load(interactivityEmitters);\n }\n }\n }\n }\n needsPlugin(options) {\n if (!options) {\n return false;\n }\n const emitters = options.emitters;\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(emitters) && !!emitters.length || emitters !== undefined || !!options.interactivity?.events?.onClick?.mode && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(\"emitter\", options.interactivity.events.onClick.mode);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/EmittersPlugin.js?");
27
-
28
- /***/ }),
29
-
30
- /***/ "./dist/browser/Options/Classes/Emitter.js":
31
- /*!*************************************************!*\
32
- !*** ./dist/browser/Options/Classes/Emitter.js ***!
33
- \*************************************************/
34
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
35
-
36
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Emitter: () => (/* binding */ Emitter)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _EmitterLife_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EmitterLife.js */ \"./dist/browser/Options/Classes/EmitterLife.js\");\n/* harmony import */ var _EmitterRate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./EmitterRate.js */ \"./dist/browser/Options/Classes/EmitterRate.js\");\n/* harmony import */ var _EmitterShape_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./EmitterShape.js */ \"./dist/browser/Options/Classes/EmitterShape.js\");\n/* harmony import */ var _EmitterSize_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./EmitterSize.js */ \"./dist/browser/Options/Classes/EmitterSize.js\");\n\n\n\n\n\nclass Emitter {\n constructor() {\n this.autoPlay = true;\n this.fill = true;\n this.life = new _EmitterLife_js__WEBPACK_IMPORTED_MODULE_1__.EmitterLife();\n this.rate = new _EmitterRate_js__WEBPACK_IMPORTED_MODULE_2__.EmitterRate();\n this.shape = new _EmitterShape_js__WEBPACK_IMPORTED_MODULE_3__.EmitterShape();\n this.startCount = 0;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.autoPlay !== undefined) {\n this.autoPlay = data.autoPlay;\n }\n if (data.size !== undefined) {\n if (!this.size) {\n this.size = new _EmitterSize_js__WEBPACK_IMPORTED_MODULE_4__.EmitterSize();\n }\n this.size.load(data.size);\n }\n if (data.direction !== undefined) {\n this.direction = data.direction;\n }\n this.domId = data.domId;\n if (data.fill !== undefined) {\n this.fill = data.fill;\n }\n this.life.load(data.life);\n this.name = data.name;\n this.particles = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(data.particles, particles => {\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, particles);\n });\n this.rate.load(data.rate);\n this.shape.load(data.shape);\n if (data.position !== undefined) {\n this.position = {};\n if (data.position.x !== undefined) {\n this.position.x = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.position.x);\n }\n if (data.position.y !== undefined) {\n this.position.y = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.position.y);\n }\n }\n if (data.spawnColor !== undefined) {\n if (this.spawnColor === undefined) {\n this.spawnColor = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimatableColor();\n }\n this.spawnColor.load(data.spawnColor);\n }\n if (data.startCount !== undefined) {\n this.startCount = data.startCount;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/Emitter.js?");
37
-
38
- /***/ }),
39
-
40
- /***/ "./dist/browser/Options/Classes/EmitterLife.js":
41
- /*!*****************************************************!*\
42
- !*** ./dist/browser/Options/Classes/EmitterLife.js ***!
43
- \*****************************************************/
44
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
45
-
46
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterLife: () => (/* binding */ EmitterLife)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass EmitterLife {\n constructor() {\n this.wait = false;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.count !== undefined) {\n this.count = data.count;\n }\n if (data.delay !== undefined) {\n this.delay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.delay);\n }\n if (data.duration !== undefined) {\n this.duration = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.duration);\n }\n if (data.wait !== undefined) {\n this.wait = data.wait;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/EmitterLife.js?");
47
-
48
- /***/ }),
49
-
50
- /***/ "./dist/browser/Options/Classes/EmitterRate.js":
51
- /*!*****************************************************!*\
52
- !*** ./dist/browser/Options/Classes/EmitterRate.js ***!
53
- \*****************************************************/
54
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
55
-
56
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterRate: () => (/* binding */ EmitterRate)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass EmitterRate {\n constructor() {\n this.quantity = 1;\n this.delay = 0.1;\n }\n load(data) {\n if (data === undefined) {\n return;\n }\n if (data.quantity !== undefined) {\n this.quantity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.quantity);\n }\n if (data.delay !== undefined) {\n this.delay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.delay);\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/EmitterRate.js?");
57
-
58
- /***/ }),
59
-
60
- /***/ "./dist/browser/Options/Classes/EmitterShape.js":
61
- /*!******************************************************!*\
62
- !*** ./dist/browser/Options/Classes/EmitterShape.js ***!
63
- \******************************************************/
64
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
65
-
66
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterShape: () => (/* binding */ EmitterShape)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _EmitterShapeReplace_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EmitterShapeReplace.js */ \"./dist/browser/Options/Classes/EmitterShapeReplace.js\");\n\n\nclass EmitterShape {\n constructor() {\n this.options = {};\n this.replace = new _EmitterShapeReplace_js__WEBPACK_IMPORTED_MODULE_1__.EmitterShapeReplace();\n this.type = \"square\";\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.options !== undefined) {\n this.options = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, data.options ?? {});\n }\n this.replace.load(data.replace);\n if (data.type !== undefined) {\n this.type = data.type;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/EmitterShape.js?");
67
-
68
- /***/ }),
69
-
70
- /***/ "./dist/browser/Options/Classes/EmitterShapeReplace.js":
71
- /*!*************************************************************!*\
72
- !*** ./dist/browser/Options/Classes/EmitterShapeReplace.js ***!
73
- \*************************************************************/
74
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
75
-
76
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterShapeReplace: () => (/* binding */ EmitterShapeReplace)\n/* harmony export */ });\nclass EmitterShapeReplace {\n constructor() {\n this.color = false;\n this.opacity = false;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.color !== undefined) {\n this.color = data.color;\n }\n if (data.opacity !== undefined) {\n this.opacity = data.opacity;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/EmitterShapeReplace.js?");
77
-
78
- /***/ }),
79
-
80
- /***/ "./dist/browser/Options/Classes/EmitterSize.js":
81
- /*!*****************************************************!*\
82
- !*** ./dist/browser/Options/Classes/EmitterSize.js ***!
83
- \*****************************************************/
84
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
85
-
86
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterSize: () => (/* binding */ EmitterSize)\n/* harmony export */ });\nclass EmitterSize {\n constructor() {\n this.mode = \"percent\";\n this.height = 0;\n this.width = 0;\n }\n load(data) {\n if (data === undefined) {\n return;\n }\n if (data.mode !== undefined) {\n this.mode = data.mode;\n }\n if (data.height !== undefined) {\n this.height = data.height;\n }\n if (data.width !== undefined) {\n this.width = data.width;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Options/Classes/EmitterSize.js?");
87
-
88
- /***/ })
89
-
90
- }]);