@tsparticles/fireworks 3.0.1 → 3.0.3

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.1 by Matteo Bruni */
1
+ /*! tsParticles Fireworks v3.0.3 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.1
7
+ * v3.0.3
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/updater-life"), require("@tsparticles/shape-line"), require("@tsparticles/updater-rotate"), require("@tsparticles/plugin-sounds"), require("@tsparticles/updater-stroke-color"));
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"));
12
12
  else if(typeof define === 'function' && define.amd)
13
- define(["@tsparticles/engine", "@tsparticles/basic", "@tsparticles/updater-destroy", "@tsparticles/plugin-emitters", "@tsparticles/updater-life", "@tsparticles/shape-line", "@tsparticles/updater-rotate", "@tsparticles/plugin-sounds", "@tsparticles/updater-stroke-color"], factory);
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);
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/updater-life"), require("@tsparticles/shape-line"), require("@tsparticles/updater-rotate"), require("@tsparticles/plugin-sounds"), require("@tsparticles/updater-stroke-color")) : factory(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/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"]);
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__84__, __WEBPACK_EXTERNAL_MODULE__137__, __WEBPACK_EXTERNAL_MODULE__59__, __WEBPACK_EXTERNAL_MODULE__490__, __WEBPACK_EXTERNAL_MODULE__204__) => {
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__) => {
19
19
  return /******/ (() => { // webpackBootstrap
20
20
  /******/ "use strict";
21
21
  /******/ var __webpack_modules__ = ({
@@ -27,6 +27,13 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__574__;
27
27
 
28
28
  /***/ }),
29
29
 
30
+ /***/ 20:
31
+ /***/ ((module) => {
32
+
33
+ module.exports = __WEBPACK_EXTERNAL_MODULE__20__;
34
+
35
+ /***/ }),
36
+
30
37
  /***/ 533:
31
38
  /***/ ((module) => {
32
39
 
@@ -41,6 +48,13 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__68__;
41
48
 
42
49
  /***/ }),
43
50
 
51
+ /***/ 787:
52
+ /***/ ((module) => {
53
+
54
+ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
55
+
56
+ /***/ }),
57
+
44
58
  /***/ 490:
45
59
  /***/ ((module) => {
46
60
 
@@ -156,6 +170,7 @@ var engine_root_window_ = __webpack_require__(533);
156
170
 
157
171
  class FireworkOptions {
158
172
  constructor() {
173
+ this.background = "none";
159
174
  this.brightness = {
160
175
  min: -30,
161
176
  max: 30
@@ -166,7 +181,7 @@ class FireworkOptions {
166
181
  min: 10,
167
182
  max: 30
168
183
  };
169
- this.rate = 20;
184
+ this.rate = 10;
170
185
  this.saturation = {
171
186
  min: -30,
172
187
  max: 30
@@ -185,6 +200,9 @@ class FireworkOptions {
185
200
  if (!data) {
186
201
  return;
187
202
  }
203
+ if (data.background !== undefined) {
204
+ this.background = data.background;
205
+ }
188
206
  if (data.colors !== undefined) {
189
207
  if ((0,engine_root_window_.isArray)(data.colors)) {
190
208
  this.colors = [...data.colors];
@@ -224,6 +242,8 @@ var basic_root_window_ = __webpack_require__(574);
224
242
  var updater_destroy_root_window_ = __webpack_require__(344);
225
243
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/plugin-emitters","commonjs2":"@tsparticles/plugin-emitters","amd":"@tsparticles/plugin-emitters","root":"window"}
226
244
  var plugin_emitters_root_window_ = __webpack_require__(68);
245
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/plugin-emitters-shape-square","commonjs2":"@tsparticles/plugin-emitters-shape-square","amd":"@tsparticles/plugin-emitters-shape-square","root":"window"}
246
+ var plugin_emitters_shape_square_root_window_ = __webpack_require__(787);
227
247
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-life","commonjs2":"@tsparticles/updater-life","amd":"@tsparticles/updater-life","root":"window"}
228
248
  var updater_life_root_window_ = __webpack_require__(84);
229
249
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-line","commonjs2":"@tsparticles/shape-line","amd":"@tsparticles/shape-line","root":"window"}
@@ -234,6 +254,8 @@ var updater_rotate_root_window_ = __webpack_require__(59);
234
254
  var plugin_sounds_root_window_ = __webpack_require__(490);
235
255
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-stroke-color","commonjs2":"@tsparticles/updater-stroke-color","amd":"@tsparticles/updater-stroke-color","root":"window"}
236
256
  var updater_stroke_color_root_window_ = __webpack_require__(204);
257
+ // 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);
237
259
  ;// CONCATENATED MODULE: ./dist/browser/fireworks.js
238
260
 
239
261
 
@@ -245,11 +267,13 @@ var updater_stroke_color_root_window_ = __webpack_require__(204);
245
267
 
246
268
 
247
269
 
270
+
271
+
248
272
  let initialized = false;
249
273
  let initializing = false;
250
274
  const explodeSoundCheck = args => {
251
275
  const data = args.data;
252
- return data.particle.shape === "line";
276
+ return data.particle.shape === "circle" && !!data.particle.splitCount && data.particle.splitCount < 2;
253
277
  };
254
278
  class FireworksInstance {
255
279
  constructor(container) {
@@ -282,12 +306,14 @@ async function initPlugins() {
282
306
  }
283
307
  initializing = true;
284
308
  await (0,plugin_emitters_root_window_.loadEmittersPlugin)(engine_root_window_.tsParticles, false);
309
+ await (0,plugin_emitters_shape_square_root_window_.loadEmittersShapeSquare)(engine_root_window_.tsParticles, false);
285
310
  await (0,plugin_sounds_root_window_.loadSoundsPlugin)(engine_root_window_.tsParticles, false);
286
311
  await (0,shape_line_root_window_.loadLineShape)(engine_root_window_.tsParticles, false);
287
312
  await (0,updater_rotate_root_window_.loadRotateUpdater)(engine_root_window_.tsParticles, false);
288
313
  await (0,updater_destroy_root_window_.loadDestroyUpdater)(engine_root_window_.tsParticles, false);
289
314
  await (0,updater_life_root_window_.loadLifeUpdater)(engine_root_window_.tsParticles, false);
290
315
  await (0,updater_stroke_color_root_window_.loadStrokeColorUpdater)(engine_root_window_.tsParticles, false);
316
+ await (0,effect_trail_root_window_.loadTrailEffect)(engine_root_window_.tsParticles, false);
291
317
  await (0,basic_root_window_.loadBasic)(engine_root_window_.tsParticles, false);
292
318
  initializing = false;
293
319
  initialized = true;
@@ -306,9 +332,9 @@ async function fireworks(idOrOptions, sourceOptions) {
306
332
  const particlesOptions = {
307
333
  detectRetina: true,
308
334
  background: {
309
- color: "#000"
335
+ color: options.background
310
336
  },
311
- fpsLimit: 120,
337
+ fpsLimit: 60,
312
338
  emitters: {
313
339
  direction: "top",
314
340
  life: {
@@ -337,7 +363,7 @@ async function fireworks(idOrOptions, sourceOptions) {
337
363
  value: 0
338
364
  },
339
365
  color: {
340
- value: options.colors
366
+ value: "#fff"
341
367
  },
342
368
  destroy: {
343
369
  mode: "split",
@@ -358,8 +384,8 @@ async function fireworks(idOrOptions, sourceOptions) {
358
384
  l: options.brightness
359
385
  },
360
386
  particles: {
361
- stroke: {
362
- width: 0
387
+ color: {
388
+ value: options.colors
363
389
  },
364
390
  number: {
365
391
  value: 0
@@ -371,12 +397,23 @@ async function fireworks(idOrOptions, sourceOptions) {
371
397
  },
372
398
  animation: {
373
399
  enable: true,
374
- speed: 0.7,
400
+ speed: 1,
375
401
  sync: false,
376
402
  startValue: "max",
377
403
  destroy: "min"
378
404
  }
379
405
  },
406
+ effect: {
407
+ type: "trail",
408
+ options: {
409
+ trail: {
410
+ length: {
411
+ min: 5,
412
+ max: 10
413
+ }
414
+ }
415
+ }
416
+ },
380
417
  shape: {
381
418
  type: "circle"
382
419
  },
@@ -424,32 +461,27 @@ async function fireworks(idOrOptions, sourceOptions) {
424
461
  life: {
425
462
  count: 1
426
463
  },
427
- shape: {
428
- type: "line",
464
+ effect: {
465
+ type: "trail",
429
466
  options: {
430
- line: {
431
- cap: "round"
467
+ trail: {
468
+ length: {
469
+ min: 10,
470
+ max: 30
471
+ },
472
+ minWidth: 1,
473
+ maxWidth: 1
432
474
  }
433
475
  }
434
476
  },
477
+ shape: {
478
+ type: "circle"
479
+ },
435
480
  size: {
436
- value: {
437
- min: 0.1,
438
- max: 50
439
- },
440
- animation: {
441
- enable: true,
442
- sync: true,
443
- speed: 90,
444
- startValue: "max",
445
- destroy: "min"
446
- }
481
+ value: 1
447
482
  },
448
- stroke: {
449
- color: {
450
- value: "#ffffff"
451
- },
452
- width: 0.5
483
+ opacity: {
484
+ value: 0.5
453
485
  },
454
486
  rotate: {
455
487
  path: true
@@ -469,20 +501,13 @@ async function fireworks(idOrOptions, sourceOptions) {
469
501
  outModes: {
470
502
  default: "destroy",
471
503
  top: "none"
472
- },
473
- trail: {
474
- fill: {
475
- color: "#000"
476
- },
477
- enable: true,
478
- length: 10
479
504
  }
480
505
  }
481
506
  },
482
507
  sounds: {
483
508
  enable: options.sounds,
484
509
  events: [{
485
- event: "particleRemoved",
510
+ event: "particleDestroyed",
486
511
  filter: explodeSoundCheck,
487
512
  audio: ["https://particles.js.org/audio/explosion0.mp3", "https://particles.js.org/audio/explosion1.mp3", "https://particles.js.org/audio/explosion2.mp3"]
488
513
  }],
@@ -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/updater-life"),require("@tsparticles/shape-line"),require("@tsparticles/updater-rotate"),require("@tsparticles/plugin-sounds"),require("@tsparticles/updater-stroke-color"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/basic","@tsparticles/updater-destroy","@tsparticles/plugin-emitters","@tsparticles/updater-life","@tsparticles/shape-line","@tsparticles/updater-rotate","@tsparticles/plugin-sounds","@tsparticles/updater-stroke-color"],t);else{var s="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/basic"),require("@tsparticles/updater-destroy"),require("@tsparticles/plugin-emitters"),require("@tsparticles/updater-life"),require("@tsparticles/shape-line"),require("@tsparticles/updater-rotate"),require("@tsparticles/plugin-sounds"),require("@tsparticles/updater-stroke-color")):t(e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window);for(var i in s)("object"==typeof exports?exports:e)[i]=s[i]}}(this,((e,t,s,i,r,a,o,n,l)=>(()=>{"use strict";var p={574:e=>{e.exports=t},533:t=>{t.exports=e},68:e=>{e.exports=i},490:e=>{e.exports=n},137:e=>{e.exports=a},344:e=>{e.exports=s},84:e=>{e.exports=r},59:e=>{e.exports=o},204:e=>{e.exports=l}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var s=u[e]={exports:{}};return p[e](s,s.exports,c),s.exports}c.d=(e,t)=>{for(var s in t)c.o(t,s)&&!c.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},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.brightness={min:-30,max:30},this.colors=["#ff595e","#ffca3a","#8ac926","#1982c4","#6a4c93"],this.gravity=5,this.minHeight={min:10,max:30},this.rate=20,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.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 s=c(574),i=c(344),r=c(68),a=c(84),o=c(137),n=c(59),l=c(490),p=c(204);let u=!1,m=!1;const f=e=>"line"===e.data.particle.shape;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,r.loadEmittersPlugin)(e.tsParticles,!1),await(0,l.loadSoundsPlugin)(e.tsParticles,!1),await(0,o.loadLineShape)(e.tsParticles,!1),await(0,n.loadRotateUpdater)(e.tsParticles,!1),await(0,i.loadDestroyUpdater)(e.tsParticles,!1),await(0,a.loadLifeUpdater)(e.tsParticles,!1),await(0,p.loadStrokeColorUpdater)(e.tsParticles,!1),await(0,s.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:"#000"},fpsLimit:120,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:v.colors},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:{stroke:{width:0},number:{value:0},opacity:{value:{min:.1,max:1},animation:{enable:!0,speed:.7,sync:!1,startValue:"max",destroy:"min"}},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},shape:{type:"line",options:{line:{cap:"round"}}},size:{value:{min:.1,max:50},animation:{enable:!0,sync:!0,speed:90,startValue:"max",destroy:"min"}},stroke:{color:{value:"#ffffff"},width:.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"},trail:{fill:{color:"#000"},enable:!0,length:10}}},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}},w=await e.tsParticles.load({id:h,options:y});if(w)return new g(w)}h.version=e.tsParticles.version,(0,e.isSsr)()||(window.fireworks=h)})(),d})()));
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})()));
@@ -1 +1 @@
1
- /*! tsParticles Fireworks v3.0.1 by Matteo Bruni */
1
+ /*! tsParticles Fireworks v3.0.3 by Matteo Bruni */
@@ -1,6 +1,7 @@
1
1
  import { type IOptionLoader, type RangeValue, type RecursivePartial, type SingleOrMultiple } from "@tsparticles/engine";
2
2
  import type { IFireworkOptions } from "./IFireworkOptions.js";
3
3
  export declare class FireworkOptions implements IFireworkOptions, IOptionLoader<IFireworkOptions> {
4
+ background: string;
4
5
  brightness: RangeValue;
5
6
  colors: SingleOrMultiple<string>;
6
7
  gravity: RangeValue;
@@ -1,5 +1,6 @@
1
1
  import type { RangeValue, SingleOrMultiple } from "@tsparticles/engine";
2
2
  export interface IFireworkOptions {
3
+ background: string;
3
4
  brightness: RangeValue;
4
5
  colors: SingleOrMultiple<string>;
5
6
  gravity: RangeValue;
@@ -13,6 +13,7 @@
13
13
  const engine_1 = require("@tsparticles/engine");
14
14
  class FireworkOptions {
15
15
  constructor() {
16
+ this.background = "none";
16
17
  this.brightness = {
17
18
  min: -30,
18
19
  max: 30,
@@ -23,7 +24,7 @@
23
24
  min: 10,
24
25
  max: 30,
25
26
  };
26
- this.rate = 20;
27
+ this.rate = 10;
27
28
  this.saturation = {
28
29
  min: -30,
29
30
  max: 30,
@@ -39,6 +40,9 @@
39
40
  if (!data) {
40
41
  return;
41
42
  }
43
+ if (data.background !== undefined) {
44
+ this.background = data.background;
45
+ }
42
46
  if (data.colors !== undefined) {
43
47
  if ((0, engine_1.isArray)(data.colors)) {
44
48
  this.colors = [...data.colors];
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/updater-life", "@tsparticles/shape-line", "@tsparticles/updater-rotate", "@tsparticles/plugin-sounds", "@tsparticles/updater-stroke-color"], 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/shape-line", "@tsparticles/updater-rotate", "@tsparticles/plugin-sounds", "@tsparticles/updater-stroke-color", "@tsparticles/effect-trail"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
@@ -15,16 +15,18 @@
15
15
  const basic_1 = require("@tsparticles/basic");
16
16
  const updater_destroy_1 = require("@tsparticles/updater-destroy");
17
17
  const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
18
+ const plugin_emitters_shape_square_1 = require("@tsparticles/plugin-emitters-shape-square");
18
19
  const updater_life_1 = require("@tsparticles/updater-life");
19
20
  const shape_line_1 = require("@tsparticles/shape-line");
20
21
  const updater_rotate_1 = require("@tsparticles/updater-rotate");
21
22
  const plugin_sounds_1 = require("@tsparticles/plugin-sounds");
22
23
  const updater_stroke_color_1 = require("@tsparticles/updater-stroke-color");
24
+ const effect_trail_1 = require("@tsparticles/effect-trail");
23
25
  let initialized = false;
24
26
  let initializing = false;
25
27
  const explodeSoundCheck = (args) => {
26
28
  const data = args.data;
27
- return data.particle.shape === "line";
29
+ return data.particle.shape === "circle" && !!data.particle.splitCount && data.particle.splitCount < 2;
28
30
  };
29
31
  class FireworksInstance {
30
32
  constructor(container) {
@@ -57,12 +59,14 @@
57
59
  }
58
60
  initializing = true;
59
61
  await (0, plugin_emitters_1.loadEmittersPlugin)(engine_1.tsParticles, false);
62
+ await (0, plugin_emitters_shape_square_1.loadEmittersShapeSquare)(engine_1.tsParticles, false);
60
63
  await (0, plugin_sounds_1.loadSoundsPlugin)(engine_1.tsParticles, false);
61
64
  await (0, shape_line_1.loadLineShape)(engine_1.tsParticles, false);
62
65
  await (0, updater_rotate_1.loadRotateUpdater)(engine_1.tsParticles, false);
63
66
  await (0, updater_destroy_1.loadDestroyUpdater)(engine_1.tsParticles, false);
64
67
  await (0, updater_life_1.loadLifeUpdater)(engine_1.tsParticles, false);
65
68
  await (0, updater_stroke_color_1.loadStrokeColorUpdater)(engine_1.tsParticles, false);
69
+ await (0, effect_trail_1.loadTrailEffect)(engine_1.tsParticles, false);
66
70
  await (0, basic_1.loadBasic)(engine_1.tsParticles, false);
67
71
  initializing = false;
68
72
  initialized = true;
@@ -82,9 +86,9 @@
82
86
  const particlesOptions = {
83
87
  detectRetina: true,
84
88
  background: {
85
- color: "#000",
89
+ color: options.background,
86
90
  },
87
- fpsLimit: 120,
91
+ fpsLimit: 60,
88
92
  emitters: {
89
93
  direction: "top",
90
94
  life: {
@@ -112,7 +116,7 @@
112
116
  value: 0,
113
117
  },
114
118
  color: {
115
- value: options.colors,
119
+ value: "#fff",
116
120
  },
117
121
  destroy: {
118
122
  mode: "split",
@@ -133,8 +137,8 @@
133
137
  l: options.brightness,
134
138
  },
135
139
  particles: {
136
- stroke: {
137
- width: 0,
140
+ color: {
141
+ value: options.colors,
138
142
  },
139
143
  number: {
140
144
  value: 0,
@@ -146,12 +150,23 @@
146
150
  },
147
151
  animation: {
148
152
  enable: true,
149
- speed: 0.7,
153
+ speed: 1,
150
154
  sync: false,
151
155
  startValue: "max",
152
156
  destroy: "min",
153
157
  },
154
158
  },
159
+ effect: {
160
+ type: "trail",
161
+ options: {
162
+ trail: {
163
+ length: {
164
+ min: 5,
165
+ max: 10,
166
+ },
167
+ },
168
+ },
169
+ },
155
170
  shape: {
156
171
  type: "circle",
157
172
  },
@@ -193,32 +208,27 @@
193
208
  life: {
194
209
  count: 1,
195
210
  },
196
- shape: {
197
- type: "line",
211
+ effect: {
212
+ type: "trail",
198
213
  options: {
199
- line: {
200
- cap: "round",
214
+ trail: {
215
+ length: {
216
+ min: 10,
217
+ max: 30,
218
+ },
219
+ minWidth: 1,
220
+ maxWidth: 1,
201
221
  },
202
222
  },
203
223
  },
224
+ shape: {
225
+ type: "circle",
226
+ },
204
227
  size: {
205
- value: {
206
- min: 0.1,
207
- max: 50,
208
- },
209
- animation: {
210
- enable: true,
211
- sync: true,
212
- speed: 90,
213
- startValue: "max",
214
- destroy: "min",
215
- },
228
+ value: 1,
216
229
  },
217
- stroke: {
218
- color: {
219
- value: "#ffffff",
220
- },
221
- width: 0.5,
230
+ opacity: {
231
+ value: 0.5,
222
232
  },
223
233
  rotate: {
224
234
  path: true,
@@ -239,20 +249,13 @@
239
249
  default: "destroy",
240
250
  top: "none",
241
251
  },
242
- trail: {
243
- fill: {
244
- color: "#000",
245
- },
246
- enable: true,
247
- length: 10,
248
- },
249
252
  },
250
253
  },
251
254
  sounds: {
252
255
  enable: options.sounds,
253
256
  events: [
254
257
  {
255
- event: "particleRemoved",
258
+ event: "particleDestroyed",
256
259
  filter: explodeSoundCheck,
257
260
  audio: [
258
261
  "https://particles.js.org/audio/explosion0.mp3",