@tsparticles/confetti 3.0.0-beta.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.
@@ -0,0 +1,874 @@
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.0.0-beta.0
8
+ */
9
+ (function webpackUniversalModuleDefinition(root, factory) {
10
+ if(typeof exports === 'object' && typeof module === 'object')
11
+ module.exports = factory(require("@tsparticles/engine"), require("@tsparticles/shape-cards"), require("@tsparticles/plugin-emitters"), require("@tsparticles/shape-heart"), require("@tsparticles/shape-image"), require("@tsparticles/updater-life"), require("@tsparticles/plugin-motion"), require("@tsparticles/shape-polygon"), require("@tsparticles/updater-roll"), require("@tsparticles/shape-square"), require("@tsparticles/shape-star"), require("@tsparticles/shape-text"), require("@tsparticles/updater-tilt"), require("@tsparticles/updater-wobble"), require("@tsparticles/move-base"), require("@tsparticles/shape-circle"), require("@tsparticles/updater-color"), require("@tsparticles/updater-opacity"), require("@tsparticles/updater-out-modes"), require("@tsparticles/updater-size"));
12
+ else if(typeof define === 'function' && define.amd)
13
+ define(["@tsparticles/engine", "@tsparticles/shape-cards", "@tsparticles/plugin-emitters", "@tsparticles/shape-heart", "@tsparticles/shape-image", "@tsparticles/updater-life", "@tsparticles/plugin-motion", "@tsparticles/shape-polygon", "@tsparticles/updater-roll", "@tsparticles/shape-square", "@tsparticles/shape-star", "@tsparticles/shape-text", "@tsparticles/updater-tilt", "@tsparticles/updater-wobble", "@tsparticles/move-base", "@tsparticles/shape-circle", "@tsparticles/updater-color", "@tsparticles/updater-opacity", "@tsparticles/updater-out-modes", "@tsparticles/updater-size"], factory);
14
+ else {
15
+ var a = typeof exports === 'object' ? factory(require("@tsparticles/engine"), require("@tsparticles/shape-cards"), require("@tsparticles/plugin-emitters"), require("@tsparticles/shape-heart"), require("@tsparticles/shape-image"), require("@tsparticles/updater-life"), require("@tsparticles/plugin-motion"), require("@tsparticles/shape-polygon"), require("@tsparticles/updater-roll"), require("@tsparticles/shape-square"), require("@tsparticles/shape-star"), require("@tsparticles/shape-text"), require("@tsparticles/updater-tilt"), require("@tsparticles/updater-wobble"), require("@tsparticles/move-base"), require("@tsparticles/shape-circle"), require("@tsparticles/updater-color"), require("@tsparticles/updater-opacity"), require("@tsparticles/updater-out-modes"), require("@tsparticles/updater-size")) : factory(root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"], root["window"]);
16
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
17
+ }
18
+ })(this, (__WEBPACK_EXTERNAL_MODULE__533__, __WEBPACK_EXTERNAL_MODULE__686__, __WEBPACK_EXTERNAL_MODULE__68__, __WEBPACK_EXTERNAL_MODULE__12__, __WEBPACK_EXTERNAL_MODULE__885__, __WEBPACK_EXTERNAL_MODULE__84__, __WEBPACK_EXTERNAL_MODULE__82__, __WEBPACK_EXTERNAL_MODULE__907__, __WEBPACK_EXTERNAL_MODULE__734__, __WEBPACK_EXTERNAL_MODULE__55__, __WEBPACK_EXTERNAL_MODULE__960__, __WEBPACK_EXTERNAL_MODULE__727__, __WEBPACK_EXTERNAL_MODULE__448__, __WEBPACK_EXTERNAL_MODULE__83__, __WEBPACK_EXTERNAL_MODULE__619__, __WEBPACK_EXTERNAL_MODULE__163__, __WEBPACK_EXTERNAL_MODULE__501__, __WEBPACK_EXTERNAL_MODULE__446__, __WEBPACK_EXTERNAL_MODULE__290__, __WEBPACK_EXTERNAL_MODULE__2__) => {
19
+ return /******/ (() => { // webpackBootstrap
20
+ /******/ "use strict";
21
+ /******/ var __webpack_modules__ = ({
22
+
23
+ /***/ 533:
24
+ /***/ ((module) => {
25
+
26
+ module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
27
+
28
+ /***/ }),
29
+
30
+ /***/ 619:
31
+ /***/ ((module) => {
32
+
33
+ module.exports = __WEBPACK_EXTERNAL_MODULE__619__;
34
+
35
+ /***/ }),
36
+
37
+ /***/ 68:
38
+ /***/ ((module) => {
39
+
40
+ module.exports = __WEBPACK_EXTERNAL_MODULE__68__;
41
+
42
+ /***/ }),
43
+
44
+ /***/ 82:
45
+ /***/ ((module) => {
46
+
47
+ module.exports = __WEBPACK_EXTERNAL_MODULE__82__;
48
+
49
+ /***/ }),
50
+
51
+ /***/ 686:
52
+ /***/ ((module) => {
53
+
54
+ module.exports = __WEBPACK_EXTERNAL_MODULE__686__;
55
+
56
+ /***/ }),
57
+
58
+ /***/ 163:
59
+ /***/ ((module) => {
60
+
61
+ module.exports = __WEBPACK_EXTERNAL_MODULE__163__;
62
+
63
+ /***/ }),
64
+
65
+ /***/ 12:
66
+ /***/ ((module) => {
67
+
68
+ module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
69
+
70
+ /***/ }),
71
+
72
+ /***/ 885:
73
+ /***/ ((module) => {
74
+
75
+ module.exports = __WEBPACK_EXTERNAL_MODULE__885__;
76
+
77
+ /***/ }),
78
+
79
+ /***/ 907:
80
+ /***/ ((module) => {
81
+
82
+ module.exports = __WEBPACK_EXTERNAL_MODULE__907__;
83
+
84
+ /***/ }),
85
+
86
+ /***/ 55:
87
+ /***/ ((module) => {
88
+
89
+ module.exports = __WEBPACK_EXTERNAL_MODULE__55__;
90
+
91
+ /***/ }),
92
+
93
+ /***/ 960:
94
+ /***/ ((module) => {
95
+
96
+ module.exports = __WEBPACK_EXTERNAL_MODULE__960__;
97
+
98
+ /***/ }),
99
+
100
+ /***/ 727:
101
+ /***/ ((module) => {
102
+
103
+ module.exports = __WEBPACK_EXTERNAL_MODULE__727__;
104
+
105
+ /***/ }),
106
+
107
+ /***/ 501:
108
+ /***/ ((module) => {
109
+
110
+ module.exports = __WEBPACK_EXTERNAL_MODULE__501__;
111
+
112
+ /***/ }),
113
+
114
+ /***/ 84:
115
+ /***/ ((module) => {
116
+
117
+ module.exports = __WEBPACK_EXTERNAL_MODULE__84__;
118
+
119
+ /***/ }),
120
+
121
+ /***/ 446:
122
+ /***/ ((module) => {
123
+
124
+ module.exports = __WEBPACK_EXTERNAL_MODULE__446__;
125
+
126
+ /***/ }),
127
+
128
+ /***/ 290:
129
+ /***/ ((module) => {
130
+
131
+ module.exports = __WEBPACK_EXTERNAL_MODULE__290__;
132
+
133
+ /***/ }),
134
+
135
+ /***/ 734:
136
+ /***/ ((module) => {
137
+
138
+ module.exports = __WEBPACK_EXTERNAL_MODULE__734__;
139
+
140
+ /***/ }),
141
+
142
+ /***/ 2:
143
+ /***/ ((module) => {
144
+
145
+ module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
146
+
147
+ /***/ }),
148
+
149
+ /***/ 448:
150
+ /***/ ((module) => {
151
+
152
+ module.exports = __WEBPACK_EXTERNAL_MODULE__448__;
153
+
154
+ /***/ }),
155
+
156
+ /***/ 83:
157
+ /***/ ((module) => {
158
+
159
+ module.exports = __WEBPACK_EXTERNAL_MODULE__83__;
160
+
161
+ /***/ })
162
+
163
+ /******/ });
164
+ /************************************************************************/
165
+ /******/ // The module cache
166
+ /******/ var __webpack_module_cache__ = {};
167
+ /******/
168
+ /******/ // The require function
169
+ /******/ function __webpack_require__(moduleId) {
170
+ /******/ // Check if module is in cache
171
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
172
+ /******/ if (cachedModule !== undefined) {
173
+ /******/ return cachedModule.exports;
174
+ /******/ }
175
+ /******/ // Create a new module (and put it into the cache)
176
+ /******/ var module = __webpack_module_cache__[moduleId] = {
177
+ /******/ // no module.id needed
178
+ /******/ // no module.loaded needed
179
+ /******/ exports: {}
180
+ /******/ };
181
+ /******/
182
+ /******/ // Execute the module function
183
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
184
+ /******/
185
+ /******/ // Return the exports of the module
186
+ /******/ return module.exports;
187
+ /******/ }
188
+ /******/
189
+ /************************************************************************/
190
+ /******/ /* webpack/runtime/define property getters */
191
+ /******/ (() => {
192
+ /******/ // define getter functions for harmony exports
193
+ /******/ __webpack_require__.d = (exports, definition) => {
194
+ /******/ for(var key in definition) {
195
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
196
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
197
+ /******/ }
198
+ /******/ }
199
+ /******/ };
200
+ /******/ })();
201
+ /******/
202
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
203
+ /******/ (() => {
204
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
205
+ /******/ })();
206
+ /******/
207
+ /******/ /* webpack/runtime/make namespace object */
208
+ /******/ (() => {
209
+ /******/ // define __esModule on exports
210
+ /******/ __webpack_require__.r = (exports) => {
211
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
212
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
213
+ /******/ }
214
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
215
+ /******/ };
216
+ /******/ })();
217
+ /******/
218
+ /************************************************************************/
219
+ var __webpack_exports__ = {};
220
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
221
+ (() => {
222
+ // ESM COMPAT FLAG
223
+ __webpack_require__.r(__webpack_exports__);
224
+
225
+ // EXPORTS
226
+ __webpack_require__.d(__webpack_exports__, {
227
+ confetti: () => (/* reexport */ confetti)
228
+ });
229
+
230
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
231
+ var engine_root_window_ = __webpack_require__(533);
232
+ ;// CONCATENATED MODULE: ./dist/browser/ConfettiOptions.js
233
+
234
+ class ConfettiOptions {
235
+ constructor() {
236
+ this.angle = 90;
237
+ this.count = 50;
238
+ this.spread = 45;
239
+ this.startVelocity = 45;
240
+ this.decay = 0.9;
241
+ this.gravity = 1;
242
+ this.drift = 0;
243
+ this.ticks = 200;
244
+ this.position = {
245
+ x: 50,
246
+ y: 50
247
+ };
248
+ this.colors = ["#26ccff", "#a25afd", "#ff5e7e", "#88ff5a", "#fcff42", "#ffa62d", "#ff36ff"];
249
+ this.shapes = ["square", "circle"];
250
+ this.scalar = 1;
251
+ this.zIndex = 100;
252
+ this.disableForReducedMotion = true;
253
+ this.shapeOptions = {};
254
+ }
255
+ get origin() {
256
+ return {
257
+ x: this.position.x / 100,
258
+ y: this.position.y / 100
259
+ };
260
+ }
261
+ set origin(value) {
262
+ this.position.x = value.x * 100;
263
+ this.position.y = value.y * 100;
264
+ }
265
+ get particleCount() {
266
+ return this.count;
267
+ }
268
+ set particleCount(value) {
269
+ this.count = value;
270
+ }
271
+ load(data) {
272
+ if (!data) {
273
+ return;
274
+ }
275
+ if (data.angle !== undefined) {
276
+ this.angle = data.angle;
277
+ }
278
+ const count = data.count ?? data.particleCount;
279
+ if (count !== undefined) {
280
+ this.count = count;
281
+ }
282
+ if (data.spread !== undefined) {
283
+ this.spread = data.spread;
284
+ }
285
+ if (data.startVelocity !== undefined) {
286
+ this.startVelocity = data.startVelocity;
287
+ }
288
+ if (data.decay !== undefined) {
289
+ this.decay = data.decay;
290
+ }
291
+ if (data.gravity !== undefined) {
292
+ this.gravity = data.gravity;
293
+ }
294
+ if (data.drift !== undefined) {
295
+ this.drift = data.drift;
296
+ }
297
+ if (data.ticks !== undefined) {
298
+ this.ticks = data.ticks;
299
+ }
300
+ const origin = data.origin;
301
+ if (origin && !data.position) {
302
+ data.position = {
303
+ x: origin.x !== undefined ? origin.x * 100 : undefined,
304
+ y: origin.y !== undefined ? origin.y * 100 : undefined
305
+ };
306
+ }
307
+ const position = data.position;
308
+ if (position) {
309
+ if (position.x !== undefined) {
310
+ this.position.x = position.x;
311
+ }
312
+ if (position.y !== undefined) {
313
+ this.position.y = position.y;
314
+ }
315
+ }
316
+ if (data.colors !== undefined) {
317
+ if ((0,engine_root_window_.isArray)(data.colors)) {
318
+ this.colors = [...data.colors];
319
+ } else {
320
+ this.colors = data.colors;
321
+ }
322
+ }
323
+ const options = data.shapeOptions;
324
+ if (options !== undefined) {
325
+ for (const shape in options) {
326
+ const item = options[shape];
327
+ if (item) {
328
+ this.shapeOptions[shape] = (0,engine_root_window_.deepExtend)(this.shapeOptions[shape] ?? {}, item);
329
+ }
330
+ }
331
+ }
332
+ if (data.shapes !== undefined) {
333
+ if ((0,engine_root_window_.isArray)(data.shapes)) {
334
+ this.shapes = [...data.shapes];
335
+ } else {
336
+ this.shapes = data.shapes;
337
+ }
338
+ }
339
+ if (data.scalar !== undefined) {
340
+ this.scalar = data.scalar;
341
+ }
342
+ if (data.zIndex !== undefined) {
343
+ this.zIndex = data.zIndex;
344
+ }
345
+ if (data.disableForReducedMotion !== undefined) {
346
+ this.disableForReducedMotion = data.disableForReducedMotion;
347
+ }
348
+ }
349
+ }
350
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/move-base","commonjs2":"@tsparticles/move-base","amd":"@tsparticles/move-base","root":"window"}
351
+ var move_base_root_window_ = __webpack_require__(619);
352
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-circle","commonjs2":"@tsparticles/shape-circle","amd":"@tsparticles/shape-circle","root":"window"}
353
+ var shape_circle_root_window_ = __webpack_require__(163);
354
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-color","commonjs2":"@tsparticles/updater-color","amd":"@tsparticles/updater-color","root":"window"}
355
+ var updater_color_root_window_ = __webpack_require__(501);
356
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-opacity","commonjs2":"@tsparticles/updater-opacity","amd":"@tsparticles/updater-opacity","root":"window"}
357
+ var updater_opacity_root_window_ = __webpack_require__(446);
358
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-out-modes","commonjs2":"@tsparticles/updater-out-modes","amd":"@tsparticles/updater-out-modes","root":"window"}
359
+ var updater_out_modes_root_window_ = __webpack_require__(290);
360
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-size","commonjs2":"@tsparticles/updater-size","amd":"@tsparticles/updater-size","root":"window"}
361
+ var updater_size_root_window_ = __webpack_require__(2);
362
+ ;// CONCATENATED MODULE: ../basic/dist/esm/index.js
363
+
364
+
365
+
366
+
367
+
368
+
369
+ async function loadBasic(engine, refresh = true) {
370
+ await (0,move_base_root_window_.loadBaseMover)(engine, false);
371
+ await (0,shape_circle_root_window_.loadCircleShape)(engine, false);
372
+ await (0,updater_color_root_window_.loadColorUpdater)(engine, false);
373
+ await (0,updater_opacity_root_window_.loadOpacityUpdater)(engine, false);
374
+ await (0,updater_out_modes_root_window_.loadOutModesUpdater)(engine, false);
375
+ await (0,updater_size_root_window_.loadSizeUpdater)(engine, false);
376
+ await engine.refresh(refresh);
377
+ }
378
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-cards","commonjs2":"@tsparticles/shape-cards","amd":"@tsparticles/shape-cards","root":"window"}
379
+ var shape_cards_root_window_ = __webpack_require__(686);
380
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/plugin-emitters","commonjs2":"@tsparticles/plugin-emitters","amd":"@tsparticles/plugin-emitters","root":"window"}
381
+ var plugin_emitters_root_window_ = __webpack_require__(68);
382
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-heart","commonjs2":"@tsparticles/shape-heart","amd":"@tsparticles/shape-heart","root":"window"}
383
+ var shape_heart_root_window_ = __webpack_require__(12);
384
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-image","commonjs2":"@tsparticles/shape-image","amd":"@tsparticles/shape-image","root":"window"}
385
+ var shape_image_root_window_ = __webpack_require__(885);
386
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-life","commonjs2":"@tsparticles/updater-life","amd":"@tsparticles/updater-life","root":"window"}
387
+ var updater_life_root_window_ = __webpack_require__(84);
388
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/plugin-motion","commonjs2":"@tsparticles/plugin-motion","amd":"@tsparticles/plugin-motion","root":"window"}
389
+ var plugin_motion_root_window_ = __webpack_require__(82);
390
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-polygon","commonjs2":"@tsparticles/shape-polygon","amd":"@tsparticles/shape-polygon","root":"window"}
391
+ var shape_polygon_root_window_ = __webpack_require__(907);
392
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-roll","commonjs2":"@tsparticles/updater-roll","amd":"@tsparticles/updater-roll","root":"window"}
393
+ var updater_roll_root_window_ = __webpack_require__(734);
394
+ ;// CONCATENATED MODULE: ../../updaters/rotate/dist/esm/Options/Classes/RotateAnimation.js
395
+
396
+ class RotateAnimation {
397
+ constructor() {
398
+ this.enable = false;
399
+ this.speed = 0;
400
+ this.decay = 0;
401
+ this.sync = false;
402
+ }
403
+ load(data) {
404
+ if (!data) {
405
+ return;
406
+ }
407
+ if (data.enable !== undefined) {
408
+ this.enable = data.enable;
409
+ }
410
+ if (data.speed !== undefined) {
411
+ this.speed = (0,engine_root_window_.setRangeValue)(data.speed);
412
+ }
413
+ if (data.decay !== undefined) {
414
+ this.decay = (0,engine_root_window_.setRangeValue)(data.decay);
415
+ }
416
+ if (data.sync !== undefined) {
417
+ this.sync = data.sync;
418
+ }
419
+ }
420
+ }
421
+ ;// CONCATENATED MODULE: ../../updaters/rotate/dist/esm/Options/Classes/Rotate.js
422
+
423
+
424
+ class Rotate extends engine_root_window_.ValueWithRandom {
425
+ constructor() {
426
+ super();
427
+ this.animation = new RotateAnimation();
428
+ this.direction = "clockwise";
429
+ this.path = false;
430
+ this.value = 0;
431
+ }
432
+ load(data) {
433
+ if (!data) {
434
+ return;
435
+ }
436
+ super.load(data);
437
+ if (data.direction !== undefined) {
438
+ this.direction = data.direction;
439
+ }
440
+ this.animation.load(data.animation);
441
+ if (data.path !== undefined) {
442
+ this.path = data.path;
443
+ }
444
+ }
445
+ }
446
+ ;// CONCATENATED MODULE: ../../updaters/rotate/dist/esm/RotateUpdater.js
447
+
448
+
449
+ function updateRotate(particle, delta) {
450
+ const rotate = particle.rotate,
451
+ rotateOptions = particle.options.rotate;
452
+ if (!rotate || !rotateOptions) {
453
+ return;
454
+ }
455
+ const rotateAnimation = rotateOptions.animation,
456
+ speed = (rotate.velocity ?? 0) * delta.factor,
457
+ max = 2 * Math.PI,
458
+ decay = rotate.decay ?? 1;
459
+ if (!rotateAnimation.enable) {
460
+ return;
461
+ }
462
+ switch (rotate.status) {
463
+ case "increasing":
464
+ rotate.value += speed;
465
+ if (rotate.value > max) {
466
+ rotate.value -= max;
467
+ }
468
+ break;
469
+ case "decreasing":
470
+ default:
471
+ rotate.value -= speed;
472
+ if (rotate.value < 0) {
473
+ rotate.value += max;
474
+ }
475
+ break;
476
+ }
477
+ if (rotate.velocity && decay !== 1) {
478
+ rotate.velocity *= decay;
479
+ }
480
+ }
481
+ class RotateUpdater {
482
+ constructor(container) {
483
+ this.container = container;
484
+ }
485
+ init(particle) {
486
+ const rotateOptions = particle.options.rotate;
487
+ if (!rotateOptions) {
488
+ return;
489
+ }
490
+ particle.rotate = {
491
+ enable: rotateOptions.animation.enable,
492
+ value: (0,engine_root_window_.getRangeValue)(rotateOptions.value) * Math.PI / 180
493
+ };
494
+ particle.pathRotation = rotateOptions.path;
495
+ let rotateDirection = rotateOptions.direction;
496
+ if (rotateDirection === "random") {
497
+ const index = Math.floor((0,engine_root_window_.getRandom)() * 2);
498
+ rotateDirection = index > 0 ? "counter-clockwise" : "clockwise";
499
+ }
500
+ switch (rotateDirection) {
501
+ case "counter-clockwise":
502
+ case "counterClockwise":
503
+ particle.rotate.status = "decreasing";
504
+ break;
505
+ case "clockwise":
506
+ particle.rotate.status = "increasing";
507
+ break;
508
+ }
509
+ const rotateAnimation = rotateOptions.animation;
510
+ if (rotateAnimation.enable) {
511
+ particle.rotate.decay = 1 - (0,engine_root_window_.getRangeValue)(rotateAnimation.decay);
512
+ particle.rotate.velocity = (0,engine_root_window_.getRangeValue)(rotateAnimation.speed) / 360 * this.container.retina.reduceFactor;
513
+ if (!rotateAnimation.sync) {
514
+ particle.rotate.velocity *= (0,engine_root_window_.getRandom)();
515
+ }
516
+ }
517
+ particle.rotation = particle.rotate.value;
518
+ }
519
+ isEnabled(particle) {
520
+ const rotate = particle.options.rotate;
521
+ if (!rotate) {
522
+ return false;
523
+ }
524
+ return !particle.destroyed && !particle.spawning && rotate.animation.enable && !rotate.path;
525
+ }
526
+ loadOptions(options, ...sources) {
527
+ if (!options.rotate) {
528
+ options.rotate = new Rotate();
529
+ }
530
+ for (const source of sources) {
531
+ options.rotate.load(source?.rotate);
532
+ }
533
+ }
534
+ update(particle, delta) {
535
+ if (!this.isEnabled(particle)) {
536
+ return;
537
+ }
538
+ updateRotate(particle, delta);
539
+ particle.rotation = particle.rotate?.value ?? 0;
540
+ }
541
+ }
542
+ ;// CONCATENATED MODULE: ../../updaters/rotate/dist/esm/index.js
543
+
544
+ async function loadRotateUpdater(engine, refresh = true) {
545
+ await engine.addParticleUpdater("rotate", container => new RotateUpdater(container), refresh);
546
+ }
547
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-square","commonjs2":"@tsparticles/shape-square","amd":"@tsparticles/shape-square","root":"window"}
548
+ var shape_square_root_window_ = __webpack_require__(55);
549
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-star","commonjs2":"@tsparticles/shape-star","amd":"@tsparticles/shape-star","root":"window"}
550
+ var shape_star_root_window_ = __webpack_require__(960);
551
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-text","commonjs2":"@tsparticles/shape-text","amd":"@tsparticles/shape-text","root":"window"}
552
+ var shape_text_root_window_ = __webpack_require__(727);
553
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-tilt","commonjs2":"@tsparticles/updater-tilt","amd":"@tsparticles/updater-tilt","root":"window"}
554
+ var updater_tilt_root_window_ = __webpack_require__(448);
555
+ // EXTERNAL MODULE: external {"commonjs":"@tsparticles/updater-wobble","commonjs2":"@tsparticles/updater-wobble","amd":"@tsparticles/updater-wobble","root":"window"}
556
+ var updater_wobble_root_window_ = __webpack_require__(83);
557
+ ;// CONCATENATED MODULE: ./dist/browser/confetti.js
558
+
559
+
560
+
561
+
562
+
563
+
564
+
565
+
566
+
567
+
568
+
569
+
570
+
571
+
572
+
573
+
574
+
575
+ let initialized = false;
576
+ let initializing = false;
577
+ const ids = new Map();
578
+ async function initPlugins(engine) {
579
+ if (initialized) {
580
+ return;
581
+ }
582
+ if (initializing) {
583
+ return new Promise(resolve => {
584
+ const interval = setInterval(() => {
585
+ if (!initialized) {
586
+ return;
587
+ }
588
+ clearInterval(interval);
589
+ resolve();
590
+ }, 100);
591
+ });
592
+ }
593
+ initializing = true;
594
+ await (0,plugin_emitters_root_window_.loadEmittersPlugin)(engine, false);
595
+ await (0,plugin_motion_root_window_.loadMotionPlugin)(engine, false);
596
+ await (0,shape_cards_root_window_.loadCardsShape)(engine, false);
597
+ await (0,shape_heart_root_window_.loadHeartShape)(engine, false);
598
+ await (0,shape_image_root_window_.loadImageShape)(engine, false);
599
+ await (0,shape_polygon_root_window_.loadPolygonShape)(engine, false);
600
+ await (0,shape_square_root_window_.loadSquareShape)(engine, false);
601
+ await (0,shape_star_root_window_.loadStarShape)(engine, false);
602
+ await (0,shape_text_root_window_.loadTextShape)(engine, false);
603
+ await loadRotateUpdater(engine, false);
604
+ await (0,updater_life_root_window_.loadLifeUpdater)(engine, false);
605
+ await (0,updater_roll_root_window_.loadRollUpdater)(engine, false);
606
+ await (0,updater_tilt_root_window_.loadTiltUpdater)(engine, false);
607
+ await (0,updater_wobble_root_window_.loadWobbleUpdater)(engine, false);
608
+ await loadBasic(engine);
609
+ initializing = false;
610
+ initialized = true;
611
+ }
612
+ async function setConfetti(params) {
613
+ const actualOptions = new ConfettiOptions();
614
+ actualOptions.load(params.options);
615
+ let container;
616
+ const fpsLimit = 120,
617
+ opacitySpeed = actualOptions.ticks * 1000 / (3600 * fpsLimit);
618
+ if (ids.has(params.id)) {
619
+ container = ids.get(params.id);
620
+ if (container && !container.destroyed) {
621
+ const alias = container;
622
+ if (alias.addEmitter) {
623
+ alias.addEmitter({
624
+ startCount: actualOptions.count,
625
+ position: actualOptions.position,
626
+ size: {
627
+ width: 0,
628
+ height: 0
629
+ },
630
+ rate: {
631
+ delay: 0,
632
+ quantity: 0
633
+ },
634
+ life: {
635
+ duration: 0.1,
636
+ count: 1
637
+ },
638
+ particles: {
639
+ color: {
640
+ value: actualOptions.colors
641
+ },
642
+ shape: {
643
+ type: actualOptions.shapes,
644
+ options: actualOptions.shapeOptions
645
+ },
646
+ life: {
647
+ count: 1
648
+ },
649
+ opacity: {
650
+ value: {
651
+ min: 0,
652
+ max: 1
653
+ },
654
+ animation: {
655
+ enable: true,
656
+ sync: true,
657
+ speed: opacitySpeed,
658
+ startValue: "max",
659
+ destroy: "min"
660
+ }
661
+ },
662
+ size: {
663
+ value: 5 * actualOptions.scalar
664
+ },
665
+ move: {
666
+ angle: {
667
+ value: actualOptions.spread,
668
+ offset: 0
669
+ },
670
+ drift: {
671
+ min: -actualOptions.drift,
672
+ max: actualOptions.drift
673
+ },
674
+ gravity: {
675
+ acceleration: actualOptions.gravity * 9.81
676
+ },
677
+ speed: actualOptions.startVelocity * 3,
678
+ decay: 1 - actualOptions.decay,
679
+ direction: -actualOptions.angle
680
+ }
681
+ }
682
+ });
683
+ return;
684
+ }
685
+ }
686
+ }
687
+ const particlesOptions = {
688
+ fullScreen: {
689
+ enable: !params.canvas,
690
+ zIndex: actualOptions.zIndex
691
+ },
692
+ fpsLimit: 120,
693
+ particles: {
694
+ number: {
695
+ value: 0
696
+ },
697
+ color: {
698
+ value: actualOptions.colors
699
+ },
700
+ shape: {
701
+ type: actualOptions.shapes,
702
+ options: actualOptions.shapeOptions
703
+ },
704
+ opacity: {
705
+ value: {
706
+ min: 0,
707
+ max: 1
708
+ },
709
+ animation: {
710
+ enable: true,
711
+ sync: true,
712
+ speed: opacitySpeed,
713
+ startValue: "max",
714
+ destroy: "min"
715
+ }
716
+ },
717
+ size: {
718
+ value: 5 * actualOptions.scalar
719
+ },
720
+ links: {
721
+ enable: false
722
+ },
723
+ life: {
724
+ count: 1
725
+ },
726
+ move: {
727
+ angle: {
728
+ value: actualOptions.spread,
729
+ offset: 0
730
+ },
731
+ drift: {
732
+ min: -actualOptions.drift,
733
+ max: actualOptions.drift
734
+ },
735
+ enable: true,
736
+ gravity: {
737
+ enable: true,
738
+ acceleration: actualOptions.gravity * 9.81
739
+ },
740
+ speed: actualOptions.startVelocity * 3,
741
+ decay: 1 - actualOptions.decay,
742
+ direction: -actualOptions.angle,
743
+ random: true,
744
+ straight: false,
745
+ outModes: {
746
+ default: "none",
747
+ bottom: "destroy"
748
+ }
749
+ },
750
+ rotate: {
751
+ value: {
752
+ min: 0,
753
+ max: 360
754
+ },
755
+ direction: "random",
756
+ animation: {
757
+ enable: true,
758
+ speed: 60
759
+ }
760
+ },
761
+ tilt: {
762
+ direction: "random",
763
+ enable: true,
764
+ value: {
765
+ min: 0,
766
+ max: 360
767
+ },
768
+ animation: {
769
+ enable: true,
770
+ speed: 60
771
+ }
772
+ },
773
+ roll: {
774
+ darken: {
775
+ enable: true,
776
+ value: 25
777
+ },
778
+ enable: true,
779
+ speed: {
780
+ min: 15,
781
+ max: 25
782
+ }
783
+ },
784
+ wobble: {
785
+ distance: 30,
786
+ enable: true,
787
+ speed: {
788
+ min: -15,
789
+ max: 15
790
+ }
791
+ }
792
+ },
793
+ detectRetina: true,
794
+ motion: {
795
+ disable: actualOptions.disableForReducedMotion
796
+ },
797
+ emitters: {
798
+ name: "confetti",
799
+ startCount: actualOptions.count,
800
+ position: actualOptions.position,
801
+ size: {
802
+ width: 0,
803
+ height: 0
804
+ },
805
+ rate: {
806
+ delay: 0,
807
+ quantity: 0
808
+ },
809
+ life: {
810
+ duration: 0.1,
811
+ count: 1
812
+ }
813
+ }
814
+ };
815
+ container = await engine_root_window_.tsParticles.load({
816
+ id: params.id,
817
+ element: params.canvas,
818
+ options: particlesOptions
819
+ });
820
+ ids.set(params.id, container);
821
+ return container;
822
+ }
823
+ async function confetti(idOrOptions, confettiOptions) {
824
+ await initPlugins(engine_root_window_.tsParticles);
825
+ let options;
826
+ let id;
827
+ if ((0,engine_root_window_.isString)(idOrOptions)) {
828
+ id = idOrOptions;
829
+ options = confettiOptions ?? {};
830
+ } else {
831
+ id = "confetti";
832
+ options = idOrOptions;
833
+ }
834
+ return setConfetti({
835
+ id,
836
+ options
837
+ });
838
+ }
839
+ confetti.create = async (canvas, options) => {
840
+ if (!canvas) {
841
+ return confetti;
842
+ }
843
+ await initPlugins(engine_root_window_.tsParticles);
844
+ const id = canvas.getAttribute("id") || "confetti";
845
+ canvas.setAttribute("id", id);
846
+ return async (idOrOptions, confettiOptions) => {
847
+ let subOptions;
848
+ let subId;
849
+ if ((0,engine_root_window_.isString)(idOrOptions)) {
850
+ subId = idOrOptions;
851
+ subOptions = confettiOptions ?? options;
852
+ } else {
853
+ subId = id;
854
+ subOptions = idOrOptions;
855
+ }
856
+ return setConfetti({
857
+ id: subId,
858
+ canvas,
859
+ options: subOptions
860
+ });
861
+ };
862
+ };
863
+ confetti.version = engine_root_window_.tsParticles.version;
864
+ if (!(0,engine_root_window_.isSsr)()) {
865
+ window.confetti = confetti;
866
+ }
867
+ ;// CONCATENATED MODULE: ./dist/browser/index.js
868
+
869
+ })();
870
+
871
+ /******/ return __webpack_exports__;
872
+ /******/ })()
873
+ ;
874
+ });