@tsparticles/fireworks 3.0.3 → 3.1.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.
@@ -1 +1 @@
1
- /*! tsParticles Fireworks v3.0.3 by Matteo Bruni */
1
+ /*! tsParticles Fireworks v3.1.0 by Matteo Bruni */
@@ -4,18 +4,18 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.0.3
7
+ * v3.1.0
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
11
- module.exports = factory(require("@tsparticles/engine"), require("@tsparticles/basic"), require("@tsparticles/updater-destroy"), require("@tsparticles/plugin-emitters"), require("@tsparticles/plugin-emitters-shape-square"), require("@tsparticles/updater-life"), require("@tsparticles/shape-line"), require("@tsparticles/updater-rotate"), require("@tsparticles/plugin-sounds"), require("@tsparticles/updater-stroke-color"), require("@tsparticles/effect-trail"));
11
+ module.exports = factory(require("@tsparticles/engine"), require("@tsparticles/basic"), require("@tsparticles/updater-destroy"), require("@tsparticles/plugin-emitters"), require("@tsparticles/plugin-emitters-shape-square"), require("@tsparticles/updater-life"), require("@tsparticles/updater-rotate"), require("@tsparticles/plugin-sounds"), require("@tsparticles/effect-trail"));
12
12
  else if(typeof define === 'function' && define.amd)
13
- define(["@tsparticles/engine", "@tsparticles/basic", "@tsparticles/updater-destroy", "@tsparticles/plugin-emitters", "@tsparticles/plugin-emitters-shape-square", "@tsparticles/updater-life", "@tsparticles/shape-line", "@tsparticles/updater-rotate", "@tsparticles/plugin-sounds", "@tsparticles/updater-stroke-color", "@tsparticles/effect-trail"], factory);
13
+ define(["@tsparticles/engine", "@tsparticles/basic", "@tsparticles/updater-destroy", "@tsparticles/plugin-emitters", "@tsparticles/plugin-emitters-shape-square", "@tsparticles/updater-life", "@tsparticles/updater-rotate", "@tsparticles/plugin-sounds", "@tsparticles/effect-trail"], factory);
14
14
  else {
15
- var a = typeof exports === 'object' ? factory(require("@tsparticles/engine"), require("@tsparticles/basic"), require("@tsparticles/updater-destroy"), require("@tsparticles/plugin-emitters"), require("@tsparticles/plugin-emitters-shape-square"), require("@tsparticles/updater-life"), require("@tsparticles/shape-line"), require("@tsparticles/updater-rotate"), require("@tsparticles/plugin-sounds"), require("@tsparticles/updater-stroke-color"), require("@tsparticles/effect-trail")) : factory(root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"]);
15
+ var a = typeof exports === 'object' ? factory(require("@tsparticles/engine"), require("@tsparticles/basic"), require("@tsparticles/updater-destroy"), require("@tsparticles/plugin-emitters"), require("@tsparticles/plugin-emitters-shape-square"), require("@tsparticles/updater-life"), require("@tsparticles/updater-rotate"), require("@tsparticles/plugin-sounds"), require("@tsparticles/effect-trail")) : factory(root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"]);
16
16
  for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
17
17
  }
18
- })(this, (__WEBPACK_EXTERNAL_MODULE__533__, __WEBPACK_EXTERNAL_MODULE__574__, __WEBPACK_EXTERNAL_MODULE__344__, __WEBPACK_EXTERNAL_MODULE__68__, __WEBPACK_EXTERNAL_MODULE__787__, __WEBPACK_EXTERNAL_MODULE__84__, __WEBPACK_EXTERNAL_MODULE__137__, __WEBPACK_EXTERNAL_MODULE__59__, __WEBPACK_EXTERNAL_MODULE__490__, __WEBPACK_EXTERNAL_MODULE__204__, __WEBPACK_EXTERNAL_MODULE__20__) => {
18
+ })(this, (__WEBPACK_EXTERNAL_MODULE__533__, __WEBPACK_EXTERNAL_MODULE__574__, __WEBPACK_EXTERNAL_MODULE__344__, __WEBPACK_EXTERNAL_MODULE__68__, __WEBPACK_EXTERNAL_MODULE__787__, __WEBPACK_EXTERNAL_MODULE__84__, __WEBPACK_EXTERNAL_MODULE__59__, __WEBPACK_EXTERNAL_MODULE__490__, __WEBPACK_EXTERNAL_MODULE__4__) => {
19
19
  return /******/ (() => { // webpackBootstrap
20
20
  /******/ "use strict";
21
21
  /******/ var __webpack_modules__ = ({
@@ -27,10 +27,10 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__574__;
27
27
 
28
28
  /***/ }),
29
29
 
30
- /***/ 20:
30
+ /***/ 4:
31
31
  /***/ ((module) => {
32
32
 
33
- module.exports = __WEBPACK_EXTERNAL_MODULE__20__;
33
+ module.exports = __WEBPACK_EXTERNAL_MODULE__4__;
34
34
 
35
35
  /***/ }),
36
36
 
@@ -62,13 +62,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__490__;
62
62
 
63
63
  /***/ }),
64
64
 
65
- /***/ 137:
66
- /***/ ((module) => {
67
-
68
- module.exports = __WEBPACK_EXTERNAL_MODULE__137__;
69
-
70
- /***/ }),
71
-
72
65
  /***/ 344:
73
66
  /***/ ((module) => {
74
67
 
@@ -88,13 +81,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__84__;
88
81
 
89
82
  module.exports = __WEBPACK_EXTERNAL_MODULE__59__;
90
83
 
91
- /***/ }),
92
-
93
- /***/ 204:
94
- /***/ ((module) => {
95
-
96
- module.exports = __WEBPACK_EXTERNAL_MODULE__204__;
97
-
98
84
  /***/ })
99
85
 
100
86
  /******/ });
@@ -246,16 +232,12 @@ var plugin_emitters_root_window_ = __webpack_require__(68);
246
232
  var plugin_emitters_shape_square_root_window_ = __webpack_require__(787);
247
233
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-life","commonjs2":"@tsparticles/updater-life","amd":"@tsparticles/updater-life","root":"window"}
248
234
  var updater_life_root_window_ = __webpack_require__(84);
249
- // EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-line","commonjs2":"@tsparticles/shape-line","amd":"@tsparticles/shape-line","root":"window"}
250
- var shape_line_root_window_ = __webpack_require__(137);
251
235
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-rotate","commonjs2":"@tsparticles/updater-rotate","amd":"@tsparticles/updater-rotate","root":"window"}
252
236
  var updater_rotate_root_window_ = __webpack_require__(59);
253
237
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/plugin-sounds","commonjs2":"@tsparticles/plugin-sounds","amd":"@tsparticles/plugin-sounds","root":"window"}
254
238
  var plugin_sounds_root_window_ = __webpack_require__(490);
255
- // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-stroke-color","commonjs2":"@tsparticles/updater-stroke-color","amd":"@tsparticles/updater-stroke-color","root":"window"}
256
- var updater_stroke_color_root_window_ = __webpack_require__(204);
257
239
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/effect-trail","commonjs2":"@tsparticles/effect-trail","amd":"@tsparticles/effect-trail","root":"window"}
258
- var effect_trail_root_window_ = __webpack_require__(20);
240
+ var effect_trail_root_window_ = __webpack_require__(4);
259
241
  ;// CONCATENATED MODULE: ./dist/browser/fireworks.js
260
242
 
261
243
 
@@ -267,13 +249,12 @@ var effect_trail_root_window_ = __webpack_require__(20);
267
249
 
268
250
 
269
251
 
270
-
271
-
252
+ const minSplitCount = 2;
272
253
  let initialized = false;
273
254
  let initializing = false;
274
255
  const explodeSoundCheck = args => {
275
256
  const data = args.data;
276
- return data.particle.shape === "circle" && !!data.particle.splitCount && data.particle.splitCount < 2;
257
+ return data.particle.shape === "circle" && !!data.particle.splitCount && data.particle.splitCount < minSplitCount;
277
258
  };
278
259
  class FireworksInstance {
279
260
  constructor(container) {
@@ -295,24 +276,23 @@ async function initPlugins() {
295
276
  }
296
277
  if (initializing) {
297
278
  return new Promise(resolve => {
298
- const interval = setInterval(() => {
299
- if (!initialized) {
300
- return;
301
- }
302
- clearInterval(interval);
303
- resolve();
304
- }, 100);
279
+ const timeout = 100,
280
+ interval = setInterval(() => {
281
+ if (!initialized) {
282
+ return;
283
+ }
284
+ clearInterval(interval);
285
+ resolve();
286
+ }, timeout);
305
287
  });
306
288
  }
307
289
  initializing = true;
308
290
  await (0,plugin_emitters_root_window_.loadEmittersPlugin)(engine_root_window_.tsParticles, false);
309
291
  await (0,plugin_emitters_shape_square_root_window_.loadEmittersShapeSquare)(engine_root_window_.tsParticles, false);
310
292
  await (0,plugin_sounds_root_window_.loadSoundsPlugin)(engine_root_window_.tsParticles, false);
311
- await (0,shape_line_root_window_.loadLineShape)(engine_root_window_.tsParticles, false);
312
293
  await (0,updater_rotate_root_window_.loadRotateUpdater)(engine_root_window_.tsParticles, false);
313
294
  await (0,updater_destroy_root_window_.loadDestroyUpdater)(engine_root_window_.tsParticles, false);
314
295
  await (0,updater_life_root_window_.loadLifeUpdater)(engine_root_window_.tsParticles, false);
315
- await (0,updater_stroke_color_root_window_.loadStrokeColorUpdater)(engine_root_window_.tsParticles, false);
316
296
  await (0,effect_trail_root_window_.loadTrailEffect)(engine_root_window_.tsParticles, false);
317
297
  await (0,basic_root_window_.loadBasic)(engine_root_window_.tsParticles, false);
318
298
  initializing = false;
@@ -329,191 +309,192 @@ async function fireworks(idOrOptions, sourceOptions) {
329
309
  id = "fireworks";
330
310
  options.load(idOrOptions);
331
311
  }
332
- const particlesOptions = {
333
- detectRetina: true,
334
- background: {
335
- color: options.background
336
- },
337
- fpsLimit: 60,
338
- emitters: {
339
- direction: "top",
340
- life: {
341
- count: 0,
342
- duration: 0.1,
343
- delay: 0.1
312
+ const identity = 1,
313
+ particlesOptions = {
314
+ detectRetina: true,
315
+ background: {
316
+ color: options.background
344
317
  },
345
- rate: {
346
- delay: (0,engine_root_window_.isNumber)(options.rate) ? 1 / options.rate : {
347
- min: 1 / (0,engine_root_window_.getRangeMin)(options.rate),
348
- max: 1 / (0,engine_root_window_.getRangeMax)(options.rate)
318
+ fpsLimit: 60,
319
+ emitters: {
320
+ direction: "top",
321
+ life: {
322
+ count: 0,
323
+ duration: 0.1,
324
+ delay: 0.1
349
325
  },
350
- quantity: 1
351
- },
352
- size: {
353
- width: 100,
354
- height: 0
355
- },
356
- position: {
357
- y: 100,
358
- x: 50
359
- }
360
- },
361
- particles: {
362
- number: {
363
- value: 0
364
- },
365
- color: {
366
- value: "#fff"
326
+ rate: {
327
+ delay: (0,engine_root_window_.isNumber)(options.rate) ? identity / options.rate : {
328
+ min: identity / (0,engine_root_window_.getRangeMin)(options.rate),
329
+ max: identity / (0,engine_root_window_.getRangeMax)(options.rate)
330
+ },
331
+ quantity: 1
332
+ },
333
+ size: {
334
+ width: 100,
335
+ height: 0
336
+ },
337
+ position: {
338
+ y: 100,
339
+ x: 50
340
+ }
367
341
  },
368
- destroy: {
369
- mode: "split",
370
- bounds: {
371
- top: (0,engine_root_window_.setRangeValue)(options.minHeight)
342
+ particles: {
343
+ number: {
344
+ value: 0
372
345
  },
373
- split: {
374
- sizeOffset: false,
375
- count: 1,
376
- factor: {
377
- value: 0.333333
378
- },
379
- rate: {
380
- value: options.splitCount
381
- },
382
- colorOffset: {
383
- s: options.saturation,
384
- l: options.brightness
346
+ color: {
347
+ value: "#fff"
348
+ },
349
+ destroy: {
350
+ mode: "split",
351
+ bounds: {
352
+ top: (0,engine_root_window_.setRangeValue)(options.minHeight)
385
353
  },
386
- particles: {
387
- color: {
388
- value: options.colors
354
+ split: {
355
+ sizeOffset: false,
356
+ count: 1,
357
+ factor: {
358
+ value: 0.333333
389
359
  },
390
- number: {
391
- value: 0
360
+ rate: {
361
+ value: options.splitCount
392
362
  },
393
- opacity: {
394
- value: {
395
- min: 0.1,
396
- max: 1
397
- },
398
- animation: {
399
- enable: true,
400
- speed: 1,
401
- sync: false,
402
- startValue: "max",
403
- destroy: "min"
404
- }
363
+ colorOffset: {
364
+ s: options.saturation,
365
+ l: options.brightness
405
366
  },
406
- effect: {
407
- type: "trail",
408
- options: {
409
- trail: {
410
- length: {
411
- min: 5,
412
- max: 10
367
+ particles: {
368
+ color: {
369
+ value: options.colors
370
+ },
371
+ number: {
372
+ value: 0
373
+ },
374
+ opacity: {
375
+ value: {
376
+ min: 0.1,
377
+ max: 1
378
+ },
379
+ animation: {
380
+ enable: true,
381
+ speed: 1,
382
+ sync: false,
383
+ startValue: "max",
384
+ destroy: "min"
385
+ }
386
+ },
387
+ effect: {
388
+ type: "trail",
389
+ options: {
390
+ trail: {
391
+ length: {
392
+ min: 5,
393
+ max: 10
394
+ }
413
395
  }
414
396
  }
415
- }
416
- },
417
- shape: {
418
- type: "circle"
419
- },
420
- size: {
421
- value: {
422
- min: 1,
423
- max: 2
424
397
  },
425
- animation: {
426
- enable: true,
427
- speed: 5,
428
- count: 1,
429
- sync: false,
430
- startValue: "min",
431
- destroy: "none"
432
- }
433
- },
434
- life: {
435
- count: 1,
436
- duration: {
398
+ shape: {
399
+ type: "circle"
400
+ },
401
+ size: {
437
402
  value: {
438
- min: 0.25,
439
- max: 0.5
403
+ min: 1,
404
+ max: 2
405
+ },
406
+ animation: {
407
+ enable: true,
408
+ speed: 5,
409
+ count: 1,
410
+ sync: false,
411
+ startValue: "min",
412
+ destroy: "none"
440
413
  }
441
- }
442
- },
443
- move: {
444
- decay: {
445
- min: 0.05,
446
- max: 0.1
447
414
  },
448
- enable: true,
449
- gravity: {
450
- enable: true,
451
- inverse: false,
452
- acceleration: (0,engine_root_window_.setRangeValue)(options.gravity)
415
+ life: {
416
+ count: 1,
417
+ duration: {
418
+ value: {
419
+ min: 0.25,
420
+ max: 0.5
421
+ }
422
+ }
453
423
  },
454
- speed: (0,engine_root_window_.setRangeValue)(options.speed),
455
- direction: "none",
456
- outModes: "destroy"
424
+ move: {
425
+ decay: {
426
+ min: 0.05,
427
+ max: 0.1
428
+ },
429
+ enable: true,
430
+ gravity: {
431
+ enable: true,
432
+ inverse: false,
433
+ acceleration: (0,engine_root_window_.setRangeValue)(options.gravity)
434
+ },
435
+ speed: (0,engine_root_window_.setRangeValue)(options.speed),
436
+ direction: "none",
437
+ outModes: "destroy"
438
+ }
457
439
  }
458
440
  }
459
- }
460
- },
461
- life: {
462
- count: 1
463
- },
464
- effect: {
465
- type: "trail",
466
- options: {
467
- trail: {
468
- length: {
469
- min: 10,
470
- max: 30
471
- },
472
- minWidth: 1,
473
- maxWidth: 1
441
+ },
442
+ life: {
443
+ count: 1
444
+ },
445
+ effect: {
446
+ type: "trail",
447
+ options: {
448
+ trail: {
449
+ length: {
450
+ min: 10,
451
+ max: 30
452
+ },
453
+ minWidth: 1,
454
+ maxWidth: 1
455
+ }
474
456
  }
475
- }
476
- },
477
- shape: {
478
- type: "circle"
479
- },
480
- size: {
481
- value: 1
482
- },
483
- opacity: {
484
- value: 0.5
485
- },
486
- rotate: {
487
- path: true
488
- },
489
- move: {
490
- enable: true,
491
- gravity: {
492
- acceleration: 15,
493
- enable: true,
494
- inverse: true,
495
- maxSpeed: 100
496
457
  },
497
- speed: {
498
- min: 10,
499
- max: 20
458
+ shape: {
459
+ type: "circle"
460
+ },
461
+ size: {
462
+ value: 1
500
463
  },
501
- outModes: {
502
- default: "destroy",
503
- top: "none"
464
+ opacity: {
465
+ value: 0.5
466
+ },
467
+ rotate: {
468
+ path: true
469
+ },
470
+ move: {
471
+ enable: true,
472
+ gravity: {
473
+ acceleration: 15,
474
+ enable: true,
475
+ inverse: true,
476
+ maxSpeed: 100
477
+ },
478
+ speed: {
479
+ min: 10,
480
+ max: 20
481
+ },
482
+ outModes: {
483
+ default: "destroy",
484
+ top: "none"
485
+ }
504
486
  }
487
+ },
488
+ sounds: {
489
+ enable: options.sounds,
490
+ events: [{
491
+ event: "particleRemoved",
492
+ filter: explodeSoundCheck,
493
+ audio: ["https://particles.js.org/audio/explosion0.mp3", "https://particles.js.org/audio/explosion1.mp3", "https://particles.js.org/audio/explosion2.mp3"]
494
+ }],
495
+ volume: 50
505
496
  }
506
- },
507
- sounds: {
508
- enable: options.sounds,
509
- events: [{
510
- event: "particleDestroyed",
511
- filter: explodeSoundCheck,
512
- audio: ["https://particles.js.org/audio/explosion0.mp3", "https://particles.js.org/audio/explosion1.mp3", "https://particles.js.org/audio/explosion2.mp3"]
513
- }],
514
- volume: 50
515
- }
516
- };
497
+ };
517
498
  const container = await engine_root_window_.tsParticles.load({
518
499
  id,
519
500
  options: particlesOptions
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.fireworks.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/basic"),require("@tsparticles/updater-destroy"),require("@tsparticles/plugin-emitters"),require("@tsparticles/plugin-emitters-shape-square"),require("@tsparticles/updater-life"),require("@tsparticles/shape-line"),require("@tsparticles/updater-rotate"),require("@tsparticles/plugin-sounds"),require("@tsparticles/updater-stroke-color"),require("@tsparticles/effect-trail"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/basic","@tsparticles/updater-destroy","@tsparticles/plugin-emitters","@tsparticles/plugin-emitters-shape-square","@tsparticles/updater-life","@tsparticles/shape-line","@tsparticles/updater-rotate","@tsparticles/plugin-sounds","@tsparticles/updater-stroke-color","@tsparticles/effect-trail"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/basic"),require("@tsparticles/updater-destroy"),require("@tsparticles/plugin-emitters"),require("@tsparticles/plugin-emitters-shape-square"),require("@tsparticles/updater-life"),require("@tsparticles/shape-line"),require("@tsparticles/updater-rotate"),require("@tsparticles/plugin-sounds"),require("@tsparticles/updater-stroke-color"),require("@tsparticles/effect-trail")):t(e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window);for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(this,((e,t,i,s,r,a,o,n,l,p,c)=>(()=>{"use strict";var u={574:e=>{e.exports=t},20:e=>{e.exports=c},533:t=>{t.exports=e},68:e=>{e.exports=s},787:e=>{e.exports=r},490:e=>{e.exports=l},137:e=>{e.exports=o},344:e=>{e.exports=i},84:e=>{e.exports=a},59:e=>{e.exports=n},204:e=>{e.exports=p}},d={};function m(e){var t=d[e];if(void 0!==t)return t.exports;var i=d[e]={exports:{}};return u[e](i,i.exports,m),i.exports}m.d=(e,t)=>{for(var i in t)m.o(t,i)&&!m.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},m.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),m.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var f={};return(()=>{m.r(f),m.d(f,{fireworks:()=>y});var e=m(533);class t{constructor(){this.background="none",this.brightness={min:-30,max:30},this.colors=["#ff595e","#ffca3a","#8ac926","#1982c4","#6a4c93"],this.gravity=5,this.minHeight={min:10,max:30},this.rate=10,this.saturation={min:-30,max:30},this.sounds=!0,this.speed={min:5,max:15},this.splitCount={min:75,max:150}}load(t){t&&(void 0!==t.background&&(this.background=t.background),void 0!==t.colors&&((0,e.isArray)(t.colors)?this.colors=[...t.colors]:this.colors=t.colors),void 0!==t.brightness&&(this.brightness=(0,e.setRangeValue)(t.brightness)),void 0!==t.gravity&&(this.gravity=(0,e.setRangeValue)(t.gravity)),void 0!==t.minHeight&&(this.minHeight=(0,e.setRangeValue)(t.minHeight)),void 0!==t.rate&&(this.rate=(0,e.setRangeValue)(t.rate)),void 0!==t.saturation&&(this.saturation=(0,e.setRangeValue)(t.saturation)),void 0!==t.sounds&&(this.sounds=t.sounds),void 0!==t.speed&&(this.speed=(0,e.setRangeValue)(t.speed)),void 0!==t.splitCount&&(this.splitCount=(0,e.setRangeValue)(t.splitCount)))}}var i=m(574),s=m(344),r=m(68),a=m(787),o=m(84),n=m(137),l=m(59),p=m(490),c=m(204),u=m(20);let d=!1,g=!1;const h=e=>{const t=e.data;return"circle"===t.particle.shape&&!!t.particle.splitCount&&t.particle.splitCount<2};class v{constructor(e){this._container=e}pause(){this._container.pause()}play(){this._container.play()}stop(){this._container.stop()}}async function y(m,f){let y;await async function(){if(!d){if(g)return new Promise((e=>{const t=setInterval((()=>{d&&(clearInterval(t),e())}),100)}));g=!0,await(0,r.loadEmittersPlugin)(e.tsParticles,!1),await(0,a.loadEmittersShapeSquare)(e.tsParticles,!1),await(0,p.loadSoundsPlugin)(e.tsParticles,!1),await(0,n.loadLineShape)(e.tsParticles,!1),await(0,l.loadRotateUpdater)(e.tsParticles,!1),await(0,s.loadDestroyUpdater)(e.tsParticles,!1),await(0,o.loadLifeUpdater)(e.tsParticles,!1),await(0,c.loadStrokeColorUpdater)(e.tsParticles,!1),await(0,u.loadTrailEffect)(e.tsParticles,!1),await(0,i.loadBasic)(e.tsParticles,!1),g=!1,d=!0}}();const w=new t;(0,e.isString)(m)?(y=m,w.load(f)):(y="fireworks",w.load(m));const x={detectRetina:!0,background:{color:w.background},fpsLimit:60,emitters:{direction:"top",life:{count:0,duration:.1,delay:.1},rate:{delay:(0,e.isNumber)(w.rate)?1/w.rate:{min:1/(0,e.getRangeMin)(w.rate),max:1/(0,e.getRangeMax)(w.rate)},quantity:1},size:{width:100,height:0},position:{y:100,x:50}},particles:{number:{value:0},color:{value:"#fff"},destroy:{mode:"split",bounds:{top:(0,e.setRangeValue)(w.minHeight)},split:{sizeOffset:!1,count:1,factor:{value:.333333},rate:{value:w.splitCount},colorOffset:{s:w.saturation,l:w.brightness},particles:{color:{value:w.colors},number:{value:0},opacity:{value:{min:.1,max:1},animation:{enable:!0,speed:1,sync:!1,startValue:"max",destroy:"min"}},effect:{type:"trail",options:{trail:{length:{min:5,max:10}}}},shape:{type:"circle"},size:{value:{min:1,max:2},animation:{enable:!0,speed:5,count:1,sync:!1,startValue:"min",destroy:"none"}},life:{count:1,duration:{value:{min:.25,max:.5}}},move:{decay:{min:.05,max:.1},enable:!0,gravity:{enable:!0,inverse:!1,acceleration:(0,e.setRangeValue)(w.gravity)},speed:(0,e.setRangeValue)(w.speed),direction:"none",outModes:"destroy"}}}},life:{count:1},effect:{type:"trail",options:{trail:{length:{min:10,max:30},minWidth:1,maxWidth:1}}},shape:{type:"circle"},size:{value:1},opacity:{value:.5},rotate:{path:!0},move:{enable:!0,gravity:{acceleration:15,enable:!0,inverse:!0,maxSpeed:100},speed:{min:10,max:20},outModes:{default:"destroy",top:"none"}}},sounds:{enable:w.sounds,events:[{event:"particleDestroyed",filter:h,audio:["https://particles.js.org/audio/explosion0.mp3","https://particles.js.org/audio/explosion1.mp3","https://particles.js.org/audio/explosion2.mp3"]}],volume:50}},b=await e.tsParticles.load({id:y,options:x});if(b)return new v(b)}y.version=e.tsParticles.version,(0,e.isSsr)()||(window.fireworks=y)})(),f})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/basic"),require("@tsparticles/updater-destroy"),require("@tsparticles/plugin-emitters"),require("@tsparticles/plugin-emitters-shape-square"),require("@tsparticles/updater-life"),require("@tsparticles/updater-rotate"),require("@tsparticles/plugin-sounds"),require("@tsparticles/effect-trail"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/basic","@tsparticles/updater-destroy","@tsparticles/plugin-emitters","@tsparticles/plugin-emitters-shape-square","@tsparticles/updater-life","@tsparticles/updater-rotate","@tsparticles/plugin-sounds","@tsparticles/effect-trail"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/basic"),require("@tsparticles/updater-destroy"),require("@tsparticles/plugin-emitters"),require("@tsparticles/plugin-emitters-shape-square"),require("@tsparticles/updater-life"),require("@tsparticles/updater-rotate"),require("@tsparticles/plugin-sounds"),require("@tsparticles/effect-trail")):t(e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window);for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(this,((e,t,i,s,a,r,o,n,l)=>(()=>{"use strict";var p={574:e=>{e.exports=t},4:e=>{e.exports=l},533:t=>{t.exports=e},68:e=>{e.exports=s},787:e=>{e.exports=a},490:e=>{e.exports=n},344:e=>{e.exports=i},84:e=>{e.exports=r},59:e=>{e.exports=o}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var i=u[e]={exports:{}};return p[e](i,i.exports,c),i.exports}c.d=(e,t)=>{for(var i in t)c.o(t,i)&&!c.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};return(()=>{c.r(d),c.d(d,{fireworks:()=>h});var e=c(533);class t{constructor(){this.background="none",this.brightness={min:-30,max:30},this.colors=["#ff595e","#ffca3a","#8ac926","#1982c4","#6a4c93"],this.gravity=5,this.minHeight={min:10,max:30},this.rate=10,this.saturation={min:-30,max:30},this.sounds=!0,this.speed={min:5,max:15},this.splitCount={min:75,max:150}}load(t){t&&(void 0!==t.background&&(this.background=t.background),void 0!==t.colors&&((0,e.isArray)(t.colors)?this.colors=[...t.colors]:this.colors=t.colors),void 0!==t.brightness&&(this.brightness=(0,e.setRangeValue)(t.brightness)),void 0!==t.gravity&&(this.gravity=(0,e.setRangeValue)(t.gravity)),void 0!==t.minHeight&&(this.minHeight=(0,e.setRangeValue)(t.minHeight)),void 0!==t.rate&&(this.rate=(0,e.setRangeValue)(t.rate)),void 0!==t.saturation&&(this.saturation=(0,e.setRangeValue)(t.saturation)),void 0!==t.sounds&&(this.sounds=t.sounds),void 0!==t.speed&&(this.speed=(0,e.setRangeValue)(t.speed)),void 0!==t.splitCount&&(this.splitCount=(0,e.setRangeValue)(t.splitCount)))}}var i=c(574),s=c(344),a=c(68),r=c(787),o=c(84),n=c(59),l=c(490),p=c(4);let u=!1,m=!1;const f=e=>{const t=e.data;return"circle"===t.particle.shape&&!!t.particle.splitCount&&t.particle.splitCount<2};class g{constructor(e){this._container=e}pause(){this._container.pause()}play(){this._container.play()}stop(){this._container.stop()}}async function h(c,d){let h;await async function(){if(!u){if(m)return new Promise((e=>{const t=setInterval((()=>{u&&(clearInterval(t),e())}),100)}));m=!0,await(0,a.loadEmittersPlugin)(e.tsParticles,!1),await(0,r.loadEmittersShapeSquare)(e.tsParticles,!1),await(0,l.loadSoundsPlugin)(e.tsParticles,!1),await(0,n.loadRotateUpdater)(e.tsParticles,!1),await(0,s.loadDestroyUpdater)(e.tsParticles,!1),await(0,o.loadLifeUpdater)(e.tsParticles,!1),await(0,p.loadTrailEffect)(e.tsParticles,!1),await(0,i.loadBasic)(e.tsParticles,!1),m=!1,u=!0}}();const v=new t;(0,e.isString)(c)?(h=c,v.load(d)):(h="fireworks",v.load(c));const y={detectRetina:!0,background:{color:v.background},fpsLimit:60,emitters:{direction:"top",life:{count:0,duration:.1,delay:.1},rate:{delay:(0,e.isNumber)(v.rate)?1/v.rate:{min:1/(0,e.getRangeMin)(v.rate),max:1/(0,e.getRangeMax)(v.rate)},quantity:1},size:{width:100,height:0},position:{y:100,x:50}},particles:{number:{value:0},color:{value:"#fff"},destroy:{mode:"split",bounds:{top:(0,e.setRangeValue)(v.minHeight)},split:{sizeOffset:!1,count:1,factor:{value:.333333},rate:{value:v.splitCount},colorOffset:{s:v.saturation,l:v.brightness},particles:{color:{value:v.colors},number:{value:0},opacity:{value:{min:.1,max:1},animation:{enable:!0,speed:1,sync:!1,startValue:"max",destroy:"min"}},effect:{type:"trail",options:{trail:{length:{min:5,max:10}}}},shape:{type:"circle"},size:{value:{min:1,max:2},animation:{enable:!0,speed:5,count:1,sync:!1,startValue:"min",destroy:"none"}},life:{count:1,duration:{value:{min:.25,max:.5}}},move:{decay:{min:.05,max:.1},enable:!0,gravity:{enable:!0,inverse:!1,acceleration:(0,e.setRangeValue)(v.gravity)},speed:(0,e.setRangeValue)(v.speed),direction:"none",outModes:"destroy"}}}},life:{count:1},effect:{type:"trail",options:{trail:{length:{min:10,max:30},minWidth:1,maxWidth:1}}},shape:{type:"circle"},size:{value:1},opacity:{value:.5},rotate:{path:!0},move:{enable:!0,gravity:{acceleration:15,enable:!0,inverse:!0,maxSpeed:100},speed:{min:10,max:20},outModes:{default:"destroy",top:"none"}}},sounds:{enable:v.sounds,events:[{event:"particleRemoved",filter:f,audio:["https://particles.js.org/audio/explosion0.mp3","https://particles.js.org/audio/explosion1.mp3","https://particles.js.org/audio/explosion2.mp3"]}],volume:50}},x=await e.tsParticles.load({id:h,options:y});if(x)return new g(x)}h.version=e.tsParticles.version,(0,e.isSsr)()||(window.fireworks=h)})(),d})()));
@@ -1 +1 @@
1
- /*! tsParticles Fireworks v3.0.3 by Matteo Bruni */
1
+ /*! tsParticles Fireworks v3.1.0 by Matteo Bruni */
package/umd/fireworks.js CHANGED
@@ -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", "./FireworkOptions.js", "@tsparticles/basic", "@tsparticles/updater-destroy", "@tsparticles/plugin-emitters", "@tsparticles/plugin-emitters-shape-square", "@tsparticles/updater-life", "@tsparticles/shape-line", "@tsparticles/updater-rotate", "@tsparticles/plugin-sounds", "@tsparticles/updater-stroke-color", "@tsparticles/effect-trail"], factory);
7
+ define(["require", "exports", "@tsparticles/engine", "./FireworkOptions.js", "@tsparticles/basic", "@tsparticles/updater-destroy", "@tsparticles/plugin-emitters", "@tsparticles/plugin-emitters-shape-square", "@tsparticles/updater-life", "@tsparticles/updater-rotate", "@tsparticles/plugin-sounds", "@tsparticles/effect-trail"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
@@ -17,16 +17,15 @@
17
17
  const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
18
18
  const plugin_emitters_shape_square_1 = require("@tsparticles/plugin-emitters-shape-square");
19
19
  const updater_life_1 = require("@tsparticles/updater-life");
20
- const shape_line_1 = require("@tsparticles/shape-line");
21
20
  const updater_rotate_1 = require("@tsparticles/updater-rotate");
22
21
  const plugin_sounds_1 = require("@tsparticles/plugin-sounds");
23
- const updater_stroke_color_1 = require("@tsparticles/updater-stroke-color");
24
22
  const effect_trail_1 = require("@tsparticles/effect-trail");
23
+ const minSplitCount = 2;
25
24
  let initialized = false;
26
25
  let initializing = false;
27
26
  const explodeSoundCheck = (args) => {
28
27
  const data = args.data;
29
- return data.particle.shape === "circle" && !!data.particle.splitCount && data.particle.splitCount < 2;
28
+ return data.particle.shape === "circle" && !!data.particle.splitCount && data.particle.splitCount < minSplitCount;
30
29
  };
31
30
  class FireworksInstance {
32
31
  constructor(container) {
@@ -48,24 +47,22 @@
48
47
  }
49
48
  if (initializing) {
50
49
  return new Promise((resolve) => {
51
- const interval = setInterval(() => {
50
+ const timeout = 100, interval = setInterval(() => {
52
51
  if (!initialized) {
53
52
  return;
54
53
  }
55
54
  clearInterval(interval);
56
55
  resolve();
57
- }, 100);
56
+ }, timeout);
58
57
  });
59
58
  }
60
59
  initializing = true;
61
60
  await (0, plugin_emitters_1.loadEmittersPlugin)(engine_1.tsParticles, false);
62
61
  await (0, plugin_emitters_shape_square_1.loadEmittersShapeSquare)(engine_1.tsParticles, false);
63
62
  await (0, plugin_sounds_1.loadSoundsPlugin)(engine_1.tsParticles, false);
64
- await (0, shape_line_1.loadLineShape)(engine_1.tsParticles, false);
65
63
  await (0, updater_rotate_1.loadRotateUpdater)(engine_1.tsParticles, false);
66
64
  await (0, updater_destroy_1.loadDestroyUpdater)(engine_1.tsParticles, false);
67
65
  await (0, updater_life_1.loadLifeUpdater)(engine_1.tsParticles, false);
68
- await (0, updater_stroke_color_1.loadStrokeColorUpdater)(engine_1.tsParticles, false);
69
66
  await (0, effect_trail_1.loadTrailEffect)(engine_1.tsParticles, false);
70
67
  await (0, basic_1.loadBasic)(engine_1.tsParticles, false);
71
68
  initializing = false;
@@ -83,7 +80,7 @@
83
80
  id = "fireworks";
84
81
  options.load(idOrOptions);
85
82
  }
86
- const particlesOptions = {
83
+ const identity = 1, particlesOptions = {
87
84
  detectRetina: true,
88
85
  background: {
89
86
  color: options.background,
@@ -98,8 +95,8 @@
98
95
  },
99
96
  rate: {
100
97
  delay: (0, engine_1.isNumber)(options.rate)
101
- ? 1 / options.rate
102
- : { min: 1 / (0, engine_1.getRangeMin)(options.rate), max: 1 / (0, engine_1.getRangeMax)(options.rate) },
98
+ ? identity / options.rate
99
+ : { min: identity / (0, engine_1.getRangeMin)(options.rate), max: identity / (0, engine_1.getRangeMax)(options.rate) },
103
100
  quantity: 1,
104
101
  },
105
102
  size: {
@@ -255,7 +252,7 @@
255
252
  enable: options.sounds,
256
253
  events: [
257
254
  {
258
- event: "particleDestroyed",
255
+ event: "particleRemoved",
259
256
  filter: explodeSoundCheck,
260
257
  audio: [
261
258
  "https://particles.js.org/audio/explosion0.mp3",