@tsparticles/confetti 3.0.2 → 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.
- package/browser/ConfettiOptions.js +7 -7
- package/browser/confetti.js +18 -17
- package/cjs/ConfettiOptions.js +6 -6
- package/cjs/confetti.js +17 -16
- package/esm/ConfettiOptions.js +7 -7
- package/esm/confetti.js +18 -17
- package/package.json +17 -17
- package/report.html +2 -2
- package/tsparticles.confetti.bundle.js +2650 -2373
- package/tsparticles.confetti.bundle.min.js +1 -1
- package/tsparticles.confetti.bundle.min.js.LICENSE.txt +1 -1
- package/tsparticles.confetti.js +41 -33
- package/tsparticles.confetti.min.js +1 -1
- package/tsparticles.confetti.min.js.LICENSE.txt +1 -1
- package/umd/ConfettiOptions.js +6 -6
- package/umd/confetti.js +18 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Confetti v3.0
|
|
1
|
+
/*! tsParticles Confetti v3.1.0 by Matteo Bruni */
|
package/tsparticles.confetti.js
CHANGED
|
@@ -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
|
|
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/
|
|
11
|
+
module.exports = factory(require("@tsparticles/engine"), require("@tsparticles/plugin-emitters"), require("@tsparticles/basic"), require("@tsparticles/shape-cards"), require("@tsparticles/shape-emoji"), 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/updater-rotate"), require("@tsparticles/shape-square"), require("@tsparticles/shape-star"), require("@tsparticles/updater-tilt"), require("@tsparticles/updater-wobble"));
|
|
12
12
|
else if(typeof define === 'function' && define.amd)
|
|
13
|
-
define(["@tsparticles/engine", "@tsparticles/
|
|
13
|
+
define(["@tsparticles/engine", "@tsparticles/plugin-emitters", "@tsparticles/basic", "@tsparticles/shape-cards", "@tsparticles/shape-emoji", "@tsparticles/shape-heart", "@tsparticles/shape-image", "@tsparticles/updater-life", "@tsparticles/plugin-motion", "@tsparticles/shape-polygon", "@tsparticles/updater-roll", "@tsparticles/updater-rotate", "@tsparticles/shape-square", "@tsparticles/shape-star", "@tsparticles/updater-tilt", "@tsparticles/updater-wobble"], factory);
|
|
14
14
|
else {
|
|
15
|
-
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine"), require("@tsparticles/
|
|
15
|
+
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine"), require("@tsparticles/plugin-emitters"), require("@tsparticles/basic"), require("@tsparticles/shape-cards"), require("@tsparticles/shape-emoji"), 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/updater-rotate"), require("@tsparticles/shape-square"), require("@tsparticles/shape-star"), require("@tsparticles/updater-tilt"), require("@tsparticles/updater-wobble")) : 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"]);
|
|
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__686__,
|
|
18
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__533__, __WEBPACK_EXTERNAL_MODULE__68__, __WEBPACK_EXTERNAL_MODULE__574__, __WEBPACK_EXTERNAL_MODULE__686__, __WEBPACK_EXTERNAL_MODULE__151__, __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__59__, __WEBPACK_EXTERNAL_MODULE__652__, __WEBPACK_EXTERNAL_MODULE__960__, __WEBPACK_EXTERNAL_MODULE__448__, __WEBPACK_EXTERNAL_MODULE__83__) => {
|
|
19
19
|
return /******/ (() => { // webpackBootstrap
|
|
20
20
|
/******/ "use strict";
|
|
21
21
|
/******/ var __webpack_modules__ = ({
|
|
@@ -201,6 +201,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
201
201
|
|
|
202
202
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
203
203
|
var engine_root_window_ = __webpack_require__(533);
|
|
204
|
+
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/plugin-emitters","commonjs2":"@tsparticles/plugin-emitters","amd":"@tsparticles/plugin-emitters","root":"window"}
|
|
205
|
+
var plugin_emitters_root_window_ = __webpack_require__(68);
|
|
204
206
|
;// CONCATENATED MODULE: ./dist/browser/ConfettiOptions.js
|
|
205
207
|
|
|
206
208
|
class ConfettiOptions {
|
|
@@ -227,13 +229,13 @@ class ConfettiOptions {
|
|
|
227
229
|
}
|
|
228
230
|
get origin() {
|
|
229
231
|
return {
|
|
230
|
-
x: this.position.x /
|
|
231
|
-
y: this.position.y /
|
|
232
|
+
x: this.position.x / engine_root_window_.percentDenominator,
|
|
233
|
+
y: this.position.y / engine_root_window_.percentDenominator
|
|
232
234
|
};
|
|
233
235
|
}
|
|
234
236
|
set origin(value) {
|
|
235
|
-
this.position.x = value.x *
|
|
236
|
-
this.position.y = value.y *
|
|
237
|
+
this.position.x = value.x * engine_root_window_.percentDenominator;
|
|
238
|
+
this.position.y = value.y * engine_root_window_.percentDenominator;
|
|
237
239
|
}
|
|
238
240
|
get particleCount() {
|
|
239
241
|
return this.count;
|
|
@@ -276,8 +278,8 @@ class ConfettiOptions {
|
|
|
276
278
|
const origin = data.origin;
|
|
277
279
|
if (origin && !data.position) {
|
|
278
280
|
data.position = {
|
|
279
|
-
x: origin.x !== undefined ? origin.x *
|
|
280
|
-
y: origin.y !== undefined ? origin.y *
|
|
281
|
+
x: origin.x !== undefined ? origin.x * engine_root_window_.percentDenominator : undefined,
|
|
282
|
+
y: origin.y !== undefined ? origin.y * engine_root_window_.percentDenominator : undefined
|
|
281
283
|
};
|
|
282
284
|
}
|
|
283
285
|
const position = data.position;
|
|
@@ -327,8 +329,6 @@ class ConfettiOptions {
|
|
|
327
329
|
var basic_root_window_ = __webpack_require__(574);
|
|
328
330
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-cards","commonjs2":"@tsparticles/shape-cards","amd":"@tsparticles/shape-cards","root":"window"}
|
|
329
331
|
var shape_cards_root_window_ = __webpack_require__(686);
|
|
330
|
-
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/plugin-emitters","commonjs2":"@tsparticles/plugin-emitters","amd":"@tsparticles/plugin-emitters","root":"window"}
|
|
331
|
-
var plugin_emitters_root_window_ = __webpack_require__(68);
|
|
332
332
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-emoji","commonjs2":"@tsparticles/shape-emoji","amd":"@tsparticles/shape-emoji","root":"window"}
|
|
333
333
|
var shape_emoji_root_window_ = __webpack_require__(151);
|
|
334
334
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/shape-heart","commonjs2":"@tsparticles/shape-heart","amd":"@tsparticles/shape-heart","root":"window"}
|
|
@@ -371,6 +371,12 @@ var updater_wobble_root_window_ = __webpack_require__(83);
|
|
|
371
371
|
|
|
372
372
|
|
|
373
373
|
|
|
374
|
+
const defaultGravity = 9.81,
|
|
375
|
+
sizeFactor = 5,
|
|
376
|
+
speedFactor = 3,
|
|
377
|
+
decayOffset = 1,
|
|
378
|
+
disableRotate = 0,
|
|
379
|
+
disableTilt = 0;
|
|
374
380
|
let initialized = false;
|
|
375
381
|
let initializing = false;
|
|
376
382
|
const ids = new Map();
|
|
@@ -380,13 +386,14 @@ async function initPlugins(engine) {
|
|
|
380
386
|
}
|
|
381
387
|
if (initializing) {
|
|
382
388
|
return new Promise(resolve => {
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
389
|
+
const timeout = 100,
|
|
390
|
+
interval = setInterval(() => {
|
|
391
|
+
if (!initialized) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
clearInterval(interval);
|
|
395
|
+
resolve();
|
|
396
|
+
}, timeout);
|
|
390
397
|
});
|
|
391
398
|
}
|
|
392
399
|
initializing = true;
|
|
@@ -413,13 +420,14 @@ async function setConfetti(params) {
|
|
|
413
420
|
actualOptions.load(params.options);
|
|
414
421
|
let container;
|
|
415
422
|
const fpsLimit = 120,
|
|
416
|
-
|
|
423
|
+
fpsLimitFactor = 3.6,
|
|
424
|
+
opacitySpeed = actualOptions.ticks * engine_root_window_.millisecondsToSeconds / (fpsLimitFactor * engine_root_window_.millisecondsToSeconds * fpsLimit);
|
|
417
425
|
if (ids.has(params.id)) {
|
|
418
426
|
container = ids.get(params.id);
|
|
419
427
|
if (container && !container.destroyed) {
|
|
420
428
|
const alias = container;
|
|
421
429
|
if (alias.addEmitter) {
|
|
422
|
-
alias.addEmitter({
|
|
430
|
+
await alias.addEmitter({
|
|
423
431
|
startCount: actualOptions.count,
|
|
424
432
|
position: actualOptions.position,
|
|
425
433
|
size: {
|
|
@@ -459,7 +467,7 @@ async function setConfetti(params) {
|
|
|
459
467
|
}
|
|
460
468
|
},
|
|
461
469
|
size: {
|
|
462
|
-
value:
|
|
470
|
+
value: sizeFactor * actualOptions.scalar
|
|
463
471
|
},
|
|
464
472
|
move: {
|
|
465
473
|
angle: {
|
|
@@ -471,10 +479,10 @@ async function setConfetti(params) {
|
|
|
471
479
|
max: actualOptions.drift
|
|
472
480
|
},
|
|
473
481
|
gravity: {
|
|
474
|
-
acceleration: actualOptions.gravity *
|
|
482
|
+
acceleration: actualOptions.gravity * defaultGravity
|
|
475
483
|
},
|
|
476
|
-
speed: actualOptions.startVelocity *
|
|
477
|
-
decay:
|
|
484
|
+
speed: actualOptions.startVelocity * speedFactor,
|
|
485
|
+
decay: decayOffset - actualOptions.decay,
|
|
478
486
|
direction: -actualOptions.angle
|
|
479
487
|
}
|
|
480
488
|
}
|
|
@@ -514,7 +522,7 @@ async function setConfetti(params) {
|
|
|
514
522
|
}
|
|
515
523
|
},
|
|
516
524
|
size: {
|
|
517
|
-
value:
|
|
525
|
+
value: sizeFactor * actualOptions.scalar
|
|
518
526
|
},
|
|
519
527
|
links: {
|
|
520
528
|
enable: false
|
|
@@ -534,10 +542,10 @@ async function setConfetti(params) {
|
|
|
534
542
|
enable: true,
|
|
535
543
|
gravity: {
|
|
536
544
|
enable: true,
|
|
537
|
-
acceleration: actualOptions.gravity *
|
|
545
|
+
acceleration: actualOptions.gravity * defaultGravity
|
|
538
546
|
},
|
|
539
|
-
speed: actualOptions.startVelocity *
|
|
540
|
-
decay:
|
|
547
|
+
speed: actualOptions.startVelocity * speedFactor,
|
|
548
|
+
decay: decayOffset - actualOptions.decay,
|
|
541
549
|
direction: -actualOptions.angle,
|
|
542
550
|
random: true,
|
|
543
551
|
straight: false,
|
|
@@ -547,7 +555,7 @@ async function setConfetti(params) {
|
|
|
547
555
|
}
|
|
548
556
|
},
|
|
549
557
|
rotate: {
|
|
550
|
-
value: actualOptions.flat ?
|
|
558
|
+
value: actualOptions.flat ? disableRotate : {
|
|
551
559
|
min: 0,
|
|
552
560
|
max: 360
|
|
553
561
|
},
|
|
@@ -560,7 +568,7 @@ async function setConfetti(params) {
|
|
|
560
568
|
tilt: {
|
|
561
569
|
direction: "random",
|
|
562
570
|
enable: !actualOptions.flat,
|
|
563
|
-
value: actualOptions.flat ?
|
|
571
|
+
value: actualOptions.flat ? disableTilt : {
|
|
564
572
|
min: 0,
|
|
565
573
|
max: 360
|
|
566
574
|
},
|
|
@@ -640,7 +648,7 @@ confetti.create = async (canvas, options) => {
|
|
|
640
648
|
return confetti;
|
|
641
649
|
}
|
|
642
650
|
await initPlugins(engine_root_window_.tsParticles);
|
|
643
|
-
const id = canvas.getAttribute("id")
|
|
651
|
+
const id = canvas.getAttribute("id") ?? "confetti";
|
|
644
652
|
canvas.setAttribute("id", id);
|
|
645
653
|
return async (idOrOptions, confettiOptions) => {
|
|
646
654
|
let subOptions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.confetti.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/plugin-emitters"),require("@tsparticles/basic"),require("@tsparticles/shape-cards"),require("@tsparticles/shape-emoji"),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/updater-rotate"),require("@tsparticles/shape-square"),require("@tsparticles/shape-star"),require("@tsparticles/updater-tilt"),require("@tsparticles/updater-wobble"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/plugin-emitters","@tsparticles/basic","@tsparticles/shape-cards","@tsparticles/shape-emoji","@tsparticles/shape-heart","@tsparticles/shape-image","@tsparticles/updater-life","@tsparticles/plugin-motion","@tsparticles/shape-polygon","@tsparticles/updater-roll","@tsparticles/updater-rotate","@tsparticles/shape-square","@tsparticles/shape-star","@tsparticles/updater-tilt","@tsparticles/updater-wobble"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/plugin-emitters"),require("@tsparticles/basic"),require("@tsparticles/shape-cards"),require("@tsparticles/shape-emoji"),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/updater-rotate"),require("@tsparticles/shape-square"),require("@tsparticles/shape-star"),require("@tsparticles/updater-tilt"),require("@tsparticles/updater-wobble")):t(e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window);for(var a in i)("object"==typeof exports?exports:e)[a]=i[a]}}(this,((e,t,i,a,s,r,o,n,l,p,d,c,u,h,f,y)=>(()=>{"use strict";var m={574:e=>{e.exports=i},533:t=>{t.exports=e},68:e=>{e.exports=t},82:e=>{e.exports=l},686:e=>{e.exports=a},151:e=>{e.exports=s},12:e=>{e.exports=r},885:e=>{e.exports=o},907:e=>{e.exports=p},652:e=>{e.exports=u},960:e=>{e.exports=h},84:e=>{e.exports=n},734:e=>{e.exports=d},59:e=>{e.exports=c},448:e=>{e.exports=f},83:e=>{e.exports=y}},v={};function w(e){var t=v[e];if(void 0!==t)return t.exports;var i=v[e]={exports:{}};return m[e](i,i.exports,w),i.exports}w.d=(e,t)=>{for(var i in t)w.o(t,i)&&!w.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},w.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),w.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var x={};return(()=>{w.r(x),w.d(x,{confetti:()=>R});var e=w(533),t=w(68);class i{constructor(){this.angle=90,this.count=50,this.spread=45,this.startVelocity=45,this.decay=.9,this.gravity=1,this.drift=0,this.ticks=200,this.position={x:50,y:50},this.colors=["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],this.shapes=["square","circle"],this.scalar=1,this.zIndex=100,this.disableForReducedMotion=!0,this.flat=!1,this.shapeOptions={}}get origin(){return{x:this.position.x/e.percentDenominator,y:this.position.y/e.percentDenominator}}set origin(t){this.position.x=t.x*e.percentDenominator,this.position.y=t.y*e.percentDenominator}get particleCount(){return this.count}set particleCount(e){this.count=e}load(t){if(!t)return;void 0!==t.angle&&(this.angle=t.angle);const i=t.count??t.particleCount;void 0!==i&&(this.count=i),void 0!==t.spread&&(this.spread=t.spread),void 0!==t.startVelocity&&(this.startVelocity=t.startVelocity),void 0!==t.decay&&(this.decay=t.decay),void 0!==t.flat&&(this.flat=t.flat),void 0!==t.gravity&&(this.gravity=t.gravity),void 0!==t.drift&&(this.drift=t.drift),void 0!==t.ticks&&(this.ticks=t.ticks);const a=t.origin;a&&!t.position&&(t.position={x:void 0!==a.x?a.x*e.percentDenominator:void 0,y:void 0!==a.y?a.y*e.percentDenominator:void 0});const s=t.position;s&&(void 0!==s.x&&(this.position.x=s.x),void 0!==s.y&&(this.position.y=s.y)),void 0!==t.colors&&((0,e.isArray)(t.colors)?this.colors=[...t.colors]:this.colors=t.colors);const r=t.shapeOptions;if(void 0!==r)for(const t in r){const i=r[t];i&&(this.shapeOptions[t]=(0,e.deepExtend)(this.shapeOptions[t]??{},i))}void 0!==t.shapes&&((0,e.isArray)(t.shapes)?this.shapes=[...t.shapes]:this.shapes=t.shapes),void 0!==t.scalar&&(this.scalar=t.scalar),void 0!==t.zIndex&&(this.zIndex=t.zIndex),void 0!==t.disableForReducedMotion&&(this.disableForReducedMotion=t.disableForReducedMotion)}}var a=w(574),s=w(686),r=w(151),o=w(12),n=w(885),l=w(84),p=w(82),d=w(907),c=w(734),u=w(59),h=w(652),f=w(960),y=w(448),m=w(83);const v=9.81,g=5,b=3,q=1,S=0,j=0;let P=!1,O=!1;const z=new Map;async function M(e){if(!P){if(O)return new Promise((e=>{const t=setInterval((()=>{P&&(clearInterval(t),e())}),100)}));O=!0,await(0,t.loadEmittersPlugin)(e,!1),await(0,p.loadMotionPlugin)(e,!1),await(0,s.loadCardsShape)(e,!1),await(0,o.loadHeartShape)(e,!1),await(0,n.loadImageShape)(e,!1),await(0,d.loadPolygonShape)(e,!1),await(0,h.loadSquareShape)(e,!1),await(0,f.loadStarShape)(e,!1),await(0,r.loadEmojiShape)(e,!1),await(0,u.loadRotateUpdater)(e,!1),await(0,l.loadLifeUpdater)(e,!1),await(0,c.loadRollUpdater)(e,!1),await(0,y.loadTiltUpdater)(e,!1),await(0,m.loadWobbleUpdater)(e,!1),await(0,a.loadBasic)(e),O=!1,P=!0}}async function I(t){const a=new i;let s;a.load(t.options);const r=a.ticks*e.millisecondsToSeconds/(3.6*e.millisecondsToSeconds*120);if(z.has(t.id)&&(s=z.get(t.id),s&&!s.destroyed)){const e=s;if(e.addEmitter)return void await e.addEmitter({startCount:a.count,position:a.position,size:{width:0,height:0},rate:{delay:0,quantity:0},life:{duration:.1,count:1},particles:{color:{value:a.colors},shape:{type:a.shapes,options:a.shapeOptions},life:{count:1},opacity:{value:{min:0,max:1},animation:{enable:!0,sync:!0,speed:r,startValue:"max",destroy:"min"}},size:{value:g*a.scalar},move:{angle:{value:a.spread,offset:0},drift:{min:-a.drift,max:a.drift},gravity:{acceleration:a.gravity*v},speed:a.startVelocity*b,decay:q-a.decay,direction:-a.angle}}})}const o={fullScreen:{enable:!t.canvas,zIndex:a.zIndex},fpsLimit:120,particles:{number:{value:0},color:{value:a.colors},shape:{type:a.shapes,options:a.shapeOptions},opacity:{value:{min:0,max:1},animation:{enable:!0,sync:!0,speed:r,startValue:"max",destroy:"min"}},size:{value:g*a.scalar},links:{enable:!1},life:{count:1},move:{angle:{value:a.spread,offset:0},drift:{min:-a.drift,max:a.drift},enable:!0,gravity:{enable:!0,acceleration:a.gravity*v},speed:a.startVelocity*b,decay:q-a.decay,direction:-a.angle,random:!0,straight:!1,outModes:{default:"none",bottom:"destroy"}},rotate:{value:a.flat?S:{min:0,max:360},direction:"random",animation:{enable:!a.flat,speed:60}},tilt:{direction:"random",enable:!a.flat,value:a.flat?j:{min:0,max:360},animation:{enable:!0,speed:60}},roll:{darken:{enable:!0,value:25},enable:!a.flat,speed:{min:15,max:25}},wobble:{distance:30,enable:!a.flat,speed:{min:-15,max:15}}},detectRetina:!0,motion:{disable:a.disableForReducedMotion},emitters:{name:"confetti",startCount:a.count,position:a.position,size:{width:0,height:0},rate:{delay:0,quantity:0},life:{duration:.1,count:1}}};return s=await e.tsParticles.load({id:t.id,element:t.canvas,options:o}),z.set(t.id,s),s}async function R(t,i){let a,s;return await M(e.tsParticles),(0,e.isString)(t)?(s=t,a=i??{}):(s="confetti",a=t),I({id:s,options:a})}R.create=async(t,i)=>{if(!t)return R;await M(e.tsParticles);const a=t.getAttribute("id")??"confetti";return t.setAttribute("id",a),async(s,r)=>{let o,n;return(0,e.isString)(s)?(n=s,o=r??i):(n=a,o=s),I({id:n,canvas:t,options:o})}},R.version=e.tsParticles.version,(0,e.isSsr)()||(window.confetti=R)})(),x})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Confetti v3.0
|
|
1
|
+
/*! tsParticles Confetti v3.1.0 by Matteo Bruni */
|
package/umd/ConfettiOptions.js
CHANGED
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
}
|
|
36
36
|
get origin() {
|
|
37
37
|
return {
|
|
38
|
-
x: this.position.x /
|
|
39
|
-
y: this.position.y /
|
|
38
|
+
x: this.position.x / engine_1.percentDenominator,
|
|
39
|
+
y: this.position.y / engine_1.percentDenominator,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
set origin(value) {
|
|
43
|
-
this.position.x = value.x *
|
|
44
|
-
this.position.y = value.y *
|
|
43
|
+
this.position.x = value.x * engine_1.percentDenominator;
|
|
44
|
+
this.position.y = value.y * engine_1.percentDenominator;
|
|
45
45
|
}
|
|
46
46
|
get particleCount() {
|
|
47
47
|
return this.count;
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
const origin = data.origin;
|
|
85
85
|
if (origin && !data.position) {
|
|
86
86
|
data.position = {
|
|
87
|
-
x: origin.x !== undefined ? origin.x *
|
|
88
|
-
y: origin.y !== undefined ? origin.y *
|
|
87
|
+
x: origin.x !== undefined ? origin.x * engine_1.percentDenominator : undefined,
|
|
88
|
+
y: origin.y !== undefined ? origin.y * engine_1.percentDenominator : undefined,
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
const position = data.position;
|
package/umd/confetti.js
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
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", "./ConfettiOptions.js", "@tsparticles/basic", "@tsparticles/shape-cards", "@tsparticles/
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "@tsparticles/plugin-emitters", "./ConfettiOptions.js", "@tsparticles/basic", "@tsparticles/shape-cards", "@tsparticles/shape-emoji", "@tsparticles/shape-heart", "@tsparticles/shape-image", "@tsparticles/updater-life", "@tsparticles/plugin-motion", "@tsparticles/shape-polygon", "@tsparticles/updater-roll", "@tsparticles/updater-rotate", "@tsparticles/shape-square", "@tsparticles/shape-star", "@tsparticles/updater-tilt", "@tsparticles/updater-wobble"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.confetti = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
|
|
14
15
|
const ConfettiOptions_js_1 = require("./ConfettiOptions.js");
|
|
15
16
|
const basic_1 = require("@tsparticles/basic");
|
|
16
17
|
const shape_cards_1 = require("@tsparticles/shape-cards");
|
|
17
|
-
const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
|
|
18
18
|
const shape_emoji_1 = require("@tsparticles/shape-emoji");
|
|
19
19
|
const shape_heart_1 = require("@tsparticles/shape-heart");
|
|
20
20
|
const shape_image_1 = require("@tsparticles/shape-image");
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
const shape_star_1 = require("@tsparticles/shape-star");
|
|
28
28
|
const updater_tilt_1 = require("@tsparticles/updater-tilt");
|
|
29
29
|
const updater_wobble_1 = require("@tsparticles/updater-wobble");
|
|
30
|
+
const defaultGravity = 9.81, sizeFactor = 5, speedFactor = 3, decayOffset = 1, disableRotate = 0, disableTilt = 0;
|
|
30
31
|
let initialized = false;
|
|
31
32
|
let initializing = false;
|
|
32
33
|
const ids = new Map();
|
|
@@ -36,13 +37,13 @@
|
|
|
36
37
|
}
|
|
37
38
|
if (initializing) {
|
|
38
39
|
return new Promise((resolve) => {
|
|
39
|
-
const interval = setInterval(() => {
|
|
40
|
+
const timeout = 100, interval = setInterval(() => {
|
|
40
41
|
if (!initialized) {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
clearInterval(interval);
|
|
44
45
|
resolve();
|
|
45
|
-
},
|
|
46
|
+
}, timeout);
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
initializing = true;
|
|
@@ -68,13 +69,13 @@
|
|
|
68
69
|
const actualOptions = new ConfettiOptions_js_1.ConfettiOptions();
|
|
69
70
|
actualOptions.load(params.options);
|
|
70
71
|
let container;
|
|
71
|
-
const fpsLimit = 120, opacitySpeed = (actualOptions.ticks *
|
|
72
|
+
const fpsLimit = 120, fpsLimitFactor = 3.6, opacitySpeed = (actualOptions.ticks * engine_1.millisecondsToSeconds) / (fpsLimitFactor * engine_1.millisecondsToSeconds * fpsLimit);
|
|
72
73
|
if (ids.has(params.id)) {
|
|
73
74
|
container = ids.get(params.id);
|
|
74
75
|
if (container && !container.destroyed) {
|
|
75
76
|
const alias = container;
|
|
76
77
|
if (alias.addEmitter) {
|
|
77
|
-
alias.addEmitter({
|
|
78
|
+
await alias.addEmitter({
|
|
78
79
|
startCount: actualOptions.count,
|
|
79
80
|
position: actualOptions.position,
|
|
80
81
|
size: {
|
|
@@ -111,7 +112,7 @@
|
|
|
111
112
|
},
|
|
112
113
|
},
|
|
113
114
|
size: {
|
|
114
|
-
value:
|
|
115
|
+
value: sizeFactor * actualOptions.scalar,
|
|
115
116
|
},
|
|
116
117
|
move: {
|
|
117
118
|
angle: {
|
|
@@ -123,10 +124,10 @@
|
|
|
123
124
|
max: actualOptions.drift,
|
|
124
125
|
},
|
|
125
126
|
gravity: {
|
|
126
|
-
acceleration: actualOptions.gravity *
|
|
127
|
+
acceleration: actualOptions.gravity * defaultGravity,
|
|
127
128
|
},
|
|
128
|
-
speed: actualOptions.startVelocity *
|
|
129
|
-
decay:
|
|
129
|
+
speed: actualOptions.startVelocity * speedFactor,
|
|
130
|
+
decay: decayOffset - actualOptions.decay,
|
|
130
131
|
direction: -actualOptions.angle,
|
|
131
132
|
},
|
|
132
133
|
},
|
|
@@ -163,7 +164,7 @@
|
|
|
163
164
|
},
|
|
164
165
|
},
|
|
165
166
|
size: {
|
|
166
|
-
value:
|
|
167
|
+
value: sizeFactor * actualOptions.scalar,
|
|
167
168
|
},
|
|
168
169
|
links: {
|
|
169
170
|
enable: false,
|
|
@@ -183,10 +184,10 @@
|
|
|
183
184
|
enable: true,
|
|
184
185
|
gravity: {
|
|
185
186
|
enable: true,
|
|
186
|
-
acceleration: actualOptions.gravity *
|
|
187
|
+
acceleration: actualOptions.gravity * defaultGravity,
|
|
187
188
|
},
|
|
188
|
-
speed: actualOptions.startVelocity *
|
|
189
|
-
decay:
|
|
189
|
+
speed: actualOptions.startVelocity * speedFactor,
|
|
190
|
+
decay: decayOffset - actualOptions.decay,
|
|
190
191
|
direction: -actualOptions.angle,
|
|
191
192
|
random: true,
|
|
192
193
|
straight: false,
|
|
@@ -197,7 +198,7 @@
|
|
|
197
198
|
},
|
|
198
199
|
rotate: {
|
|
199
200
|
value: actualOptions.flat
|
|
200
|
-
?
|
|
201
|
+
? disableRotate
|
|
201
202
|
: {
|
|
202
203
|
min: 0,
|
|
203
204
|
max: 360,
|
|
@@ -212,7 +213,7 @@
|
|
|
212
213
|
direction: "random",
|
|
213
214
|
enable: !actualOptions.flat,
|
|
214
215
|
value: actualOptions.flat
|
|
215
|
-
?
|
|
216
|
+
? disableTilt
|
|
216
217
|
: {
|
|
217
218
|
min: 0,
|
|
218
219
|
max: 360,
|
|
@@ -291,7 +292,7 @@
|
|
|
291
292
|
return confetti;
|
|
292
293
|
}
|
|
293
294
|
await initPlugins(engine_1.tsParticles);
|
|
294
|
-
const id = canvas.getAttribute("id")
|
|
295
|
+
const id = canvas.getAttribute("id") ?? "confetti";
|
|
295
296
|
canvas.setAttribute("id", id);
|
|
296
297
|
return async (idOrOptions, confettiOptions) => {
|
|
297
298
|
let subOptions;
|