@tsparticles/confetti 4.0.0-beta.8 → 4.0.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/README.md +106 -107
- package/browser/ConfettiParams.js +1 -0
- package/browser/browser.js +5 -0
- package/browser/bundle.js +4 -0
- package/browser/confetti.js +37 -302
- package/browser/confetti.lazy.js +96 -0
- package/browser/index.lazy.js +1 -0
- package/browser/types.js +1 -0
- package/browser/utils.js +279 -0
- package/cjs/ConfettiParams.js +1 -0
- package/cjs/browser.js +5 -0
- package/cjs/bundle.js +4 -0
- package/cjs/confetti.js +37 -302
- package/cjs/confetti.lazy.js +96 -0
- package/cjs/index.lazy.js +1 -0
- package/cjs/types.js +1 -0
- package/cjs/utils.js +279 -0
- package/esm/ConfettiParams.js +1 -0
- package/esm/browser.js +5 -0
- package/esm/bundle.js +4 -0
- package/esm/confetti.js +37 -302
- package/esm/confetti.lazy.js +96 -0
- package/esm/index.lazy.js +1 -0
- package/esm/types.js +1 -0
- package/esm/utils.js +279 -0
- package/package.json +24 -17
- package/report.html +4949 -94
- package/tsparticles.confetti.bundle.js +9847 -977
- package/tsparticles.confetti.bundle.min.js +1 -2
- package/tsparticles.confetti.js +512 -322
- package/tsparticles.confetti.min.js +1 -1
- package/types/ConfettiParams.d.ts +7 -0
- package/types/browser.d.ts +1 -0
- package/types/confetti.d.ts +3 -10
- package/types/confetti.lazy.d.ts +16 -0
- package/types/index.d.ts +1 -0
- package/types/index.lazy.d.ts +5 -0
- package/types/types.d.ts +4 -0
- package/types/utils.d.ts +7 -0
- package/1080.min.js +0 -1
- package/1241.min.js +0 -1
- package/1336.min.js +0 -1
- package/1581.min.js +0 -1
- package/1583.min.js +0 -1
- package/1712.min.js +0 -1
- package/1723.min.js +0 -1
- package/189.min.js +0 -1
- package/2066.min.js +0 -1
- package/2127.min.js +0 -1
- package/2182.min.js +0 -1
- package/2270.min.js +0 -1
- package/2528.min.js +0 -1
- package/2602.min.js +0 -1
- package/2760.min.js +0 -1
- package/3047.min.js +0 -1
- package/3073.min.js +0 -1
- package/3443.min.js +0 -1
- package/3583.min.js +0 -1
- package/374.min.js +0 -1
- package/382.min.js +0 -1
- package/404.min.js +0 -1
- package/4067.min.js +0 -1
- package/4068.min.js +0 -1
- package/4077.min.js +0 -1
- package/4086.min.js +0 -1
- package/4186.min.js +0 -1
- package/4217.min.js +0 -1
- package/4427.min.js +0 -1
- package/4519.min.js +0 -1
- package/4626.min.js +0 -1
- package/4657.min.js +0 -1
- package/5048.min.js +0 -1
- package/5294.min.js +0 -1
- package/5344.min.js +0 -1
- package/5601.min.js +0 -1
- package/6055.min.js +0 -1
- package/6171.min.js +0 -1
- package/6192.min.js +0 -1
- package/6265.min.js +0 -1
- package/6466.min.js +0 -1
- package/648.min.js +0 -1
- package/6943.min.js +0 -1
- package/6957.min.js +0 -1
- package/6972.min.js +0 -1
- package/6996.min.js +0 -1
- package/7162.min.js +0 -1
- package/7175.min.js +0 -1
- package/7213.min.js +0 -1
- package/7259.min.js +0 -1
- package/7316.min.js +0 -1
- package/7711.min.js +0 -1
- package/7757.min.js +0 -1
- package/7775.min.js +0 -1
- package/8204.min.js +0 -1
- package/8630.min.js +0 -1
- package/8731.min.js +0 -1
- package/8855.min.js +0 -1
- package/9674.min.js +0 -1
- package/9726.min.js +0 -1
- package/980.min.js +0 -1
- package/9835.min.js +0 -1
- package/9907.min.js +0 -1
- package/basic_dist_browser_index_js.js +0 -30
- package/engine_dist_browser_Core_Container_js.js +0 -100
- package/plugins_colors_hex_dist_browser_HexColorManager_js.js +0 -30
- package/plugins_colors_hex_dist_browser_index_js.js +0 -30
- package/plugins_colors_hsl_dist_browser_HslColorManager_js.js +0 -30
- package/plugins_colors_hsl_dist_browser_index_js.js +0 -30
- package/plugins_colors_rgb_dist_browser_RgbColorManager_js.js +0 -30
- package/plugins_colors_rgb_dist_browser_index_js.js +0 -30
- package/plugins_emitters_dist_browser_EmitterInstance_js.js +0 -30
- package/plugins_emitters_dist_browser_EmittersInstancesManager_js.js +0 -100
- package/plugins_emitters_dist_browser_EmittersPluginInstance_js.js +0 -30
- package/plugins_emitters_dist_browser_EmittersPlugin_js.js +0 -100
- package/plugins_emitters_dist_browser_ShapeManager_js.js +0 -30
- package/plugins_emitters_dist_browser_addEmittersShapesManager_js.js +0 -30
- package/plugins_emitters_dist_browser_getEmittersInstancesManager_js.js +0 -30
- package/plugins_emitters_dist_browser_plugin_js.js +0 -50
- package/plugins_motion_dist_browser_MotionPluginInstance_js.js +0 -30
- package/plugins_motion_dist_browser_MotionPlugin_js.js +0 -50
- package/plugins_motion_dist_browser_index_js.js +0 -30
- package/plugins_move_dist_browser_MovePluginInstance_js.js +0 -40
- package/plugins_move_dist_browser_MovePlugin_js.js +0 -30
- package/plugins_move_dist_browser_index_js.js +0 -30
- package/shapes_cards_dist_browser_clubs_ClubDrawer_js.js +0 -30
- package/shapes_cards_dist_browser_diamonds_DiamondDrawer_js.js +0 -30
- package/shapes_cards_dist_browser_hearts_HeartDrawer_js.js +0 -30
- package/shapes_cards_dist_browser_paths_js.js +0 -70
- package/shapes_cards_dist_browser_spades_SpadeDrawer_js.js +0 -30
- package/shapes_cards_dist_browser_suits_js.js +0 -70
- package/shapes_circle_dist_browser_CircleDrawer_js.js +0 -40
- package/shapes_circle_dist_browser_index_js.js +0 -30
- package/shapes_emoji_dist_browser_EmojiDrawer_js.js +0 -50
- package/shapes_emoji_dist_browser_index_js.js +0 -40
- package/shapes_heart_dist_browser_HeartDrawer_js.js +0 -40
- package/shapes_heart_dist_browser_index_js.js +0 -30
- package/shapes_image_dist_browser_GifUtils_Utils_js.js +0 -70
- package/shapes_image_dist_browser_ImageDrawer_js.js +0 -30
- package/shapes_image_dist_browser_ImagePreloaderInstance_js.js +0 -30
- package/shapes_image_dist_browser_ImagePreloader_js.js +0 -40
- package/shapes_image_dist_browser_index_js.js +0 -40
- package/shapes_polygon_dist_browser_PolygonDrawer_js.js +0 -50
- package/shapes_polygon_dist_browser_TriangleDrawer_js.js +0 -50
- package/shapes_polygon_dist_browser_index_js.js +0 -30
- package/shapes_square_dist_browser_SquareDrawer_js.js +0 -40
- package/shapes_square_dist_browser_index_js.js +0 -30
- package/shapes_star_dist_browser_StarDrawer_js.js +0 -40
- package/shapes_star_dist_browser_index_js.js +0 -30
- package/updaters_fillColor_dist_browser_FillColorUpdater_js.js +0 -30
- package/updaters_fillColor_dist_browser_index_js.js +0 -30
- package/updaters_life_dist_browser_LifeUpdater_js.js +0 -70
- package/updaters_life_dist_browser_index_js.js +0 -30
- package/updaters_opacity_dist_browser_OpacityUpdater_js.js +0 -30
- package/updaters_opacity_dist_browser_index_js.js +0 -30
- package/updaters_outModes_dist_browser_OutOfCanvasUpdater_js.js +0 -80
- package/updaters_outModes_dist_browser_index_js.js +0 -30
- package/updaters_roll_dist_browser_RollUpdater_js.js +0 -70
- package/updaters_roll_dist_browser_index_js.js +0 -30
- package/updaters_rotate_dist_browser_RotateUpdater_js.js +0 -50
- package/updaters_rotate_dist_browser_index_js.js +0 -30
- package/updaters_size_dist_browser_SizeUpdater_js.js +0 -30
- package/updaters_size_dist_browser_index_js.js +0 -30
- package/updaters_tilt_dist_browser_TiltUpdater_js.js +0 -60
- package/updaters_tilt_dist_browser_index_js.js +0 -30
- package/updaters_wobble_dist_browser_WobbleUpdater_js.js +0 -60
- package/updaters_wobble_dist_browser_index_js.js +0 -30
package/tsparticles.confetti.js
CHANGED
|
@@ -1,322 +1,512 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ confetti: () => (/* binding */ confetti)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _ConfettiOptions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ConfettiOptions.js */ \"./dist/browser/ConfettiOptions.js\");\n\n\nlet initialized = false, initializing = false;\nconst ids = new Map(), defaultGravity = 9.81, sizeFactor = 5, speedFactor = 3, decayOffset = 1, disableRotate = 0, disableTilt = 0;\nasync function initPlugins(engine) {\n if (initialized) {\n return;\n }\n if (initializing) {\n return new Promise((resolve)=>{\n const timeout = 100, interval = setInterval(()=>{\n if (!initialized) {\n return;\n }\n clearInterval(interval);\n resolve();\n }, timeout);\n });\n }\n initializing = true;\n engine.checkVersion(\"4.0.0-beta.8\");\n await engine.pluginManager.register(async (e)=>{\n const [{ loadBasic }, { loadEmittersPluginSimple }, { loadMotionPlugin }, { loadCardSuitsShape }, { loadHeartShape }, { loadImageShape }, { loadPolygonShape }, { loadSquareShape }, { loadStarShape }, { loadEmojiShape }, { loadRotateUpdater }, { loadLifeUpdater }, { loadRollUpdater }, { loadTiltUpdater }, { loadWobbleUpdater }] = await Promise.all([\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/basic */ \"@tsparticles/basic\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/plugin-emitters/plugin */ \"@tsparticles/plugin-emitters/plugin\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/plugin-motion */ \"@tsparticles/plugin-motion\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/shape-cards/suits */ \"@tsparticles/shape-cards/suits\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/shape-heart */ \"@tsparticles/shape-heart\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/shape-image */ \"@tsparticles/shape-image\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/shape-polygon */ \"@tsparticles/shape-polygon\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/shape-square */ \"@tsparticles/shape-square\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/shape-star */ \"@tsparticles/shape-star\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/shape-emoji */ \"@tsparticles/shape-emoji\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/updater-rotate */ \"@tsparticles/updater-rotate\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/updater-life */ \"@tsparticles/updater-life\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/updater-roll */ \"@tsparticles/updater-roll\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/updater-tilt */ \"@tsparticles/updater-tilt\", 19)),\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/updater-wobble */ \"@tsparticles/updater-wobble\", 19))\n ]);\n await Promise.all([\n loadBasic(e),\n loadMotionPlugin(e),\n loadEmittersPluginSimple(e),\n loadCardSuitsShape(e),\n loadHeartShape(e),\n loadImageShape(e),\n loadPolygonShape(e),\n loadSquareShape(e),\n loadStarShape(e),\n loadEmojiShape(e),\n loadRotateUpdater(e),\n loadLifeUpdater(e),\n loadRollUpdater(e),\n loadTiltUpdater(e),\n loadWobbleUpdater(e)\n ]);\n });\n initializing = false;\n initialized = true;\n}\nasync function setConfetti(params) {\n const actualOptions = new _ConfettiOptions_js__WEBPACK_IMPORTED_MODULE_1__.ConfettiOptions();\n actualOptions.load(params.options);\n let container;\n const fpsLimit = 120, fpsLimitFactor = 3.6, opacitySpeed = actualOptions.ticks * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds / (fpsLimitFactor * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds * fpsLimit);\n if (ids.has(params.id)) {\n container = ids.get(params.id);\n if (container && !container.destroyed) {\n const alias = container;\n if (\"addEmitter\" in alias) {\n await alias.addEmitter?.({\n startCount: actualOptions.count,\n position: actualOptions.position,\n size: {\n width: 0,\n height: 0\n },\n rate: {\n delay: 0,\n quantity: 0\n },\n life: {\n duration: 0.1,\n count: 1\n },\n particles: {\n fill: {\n color: {\n value: actualOptions.colors\n },\n enable: true\n },\n shape: {\n type: actualOptions.shapes,\n options: actualOptions.shapeOptions\n },\n life: {\n count: 1\n },\n opacity: {\n value: {\n min: 0,\n max: 1\n },\n animation: {\n enable: true,\n sync: true,\n speed: opacitySpeed,\n startValue: \"max\",\n destroy: \"min\",\n count: 1\n }\n },\n size: {\n value: sizeFactor * actualOptions.scalar\n },\n move: {\n angle: {\n value: actualOptions.spread,\n offset: 0\n },\n drift: {\n min: -actualOptions.drift,\n max: actualOptions.drift\n },\n gravity: {\n acceleration: actualOptions.gravity * defaultGravity\n },\n speed: actualOptions.startVelocity * speedFactor,\n decay: decayOffset - actualOptions.decay,\n direction: -actualOptions.angle\n },\n rotate: {\n value: actualOptions.flat ? disableRotate : {\n min: 0,\n max: 360\n },\n direction: \"random\",\n animation: {\n enable: !actualOptions.flat,\n speed: 60\n }\n },\n tilt: {\n direction: \"random\",\n enable: !actualOptions.flat,\n value: actualOptions.flat ? disableTilt : {\n min: 0,\n max: 360\n },\n animation: {\n enable: true,\n speed: 60\n }\n },\n roll: {\n darken: {\n enable: true,\n value: 25\n },\n enable: !actualOptions.flat,\n speed: {\n min: 15,\n max: 25\n }\n },\n wobble: {\n distance: 30,\n enable: !actualOptions.flat,\n speed: {\n min: -15,\n max: 15\n }\n }\n }\n });\n return;\n }\n }\n }\n const particlesOptions = {\n fullScreen: {\n enable: !params.canvas,\n zIndex: actualOptions.zIndex\n },\n fpsLimit: 120,\n particles: {\n number: {\n value: 0\n },\n fill: {\n color: {\n value: actualOptions.colors\n },\n enable: true\n },\n shape: {\n type: actualOptions.shapes,\n options: actualOptions.shapeOptions\n },\n opacity: {\n value: {\n min: 0,\n max: 1\n },\n animation: {\n enable: true,\n sync: true,\n speed: opacitySpeed,\n startValue: \"max\",\n destroy: \"min\",\n count: 1\n }\n },\n size: {\n value: sizeFactor * actualOptions.scalar\n },\n links: {\n enable: false\n },\n life: {\n count: 1\n },\n move: {\n angle: {\n value: actualOptions.spread,\n offset: 0\n },\n drift: {\n min: -actualOptions.drift,\n max: actualOptions.drift\n },\n enable: true,\n gravity: {\n enable: true,\n acceleration: actualOptions.gravity * defaultGravity\n },\n speed: actualOptions.startVelocity * speedFactor,\n decay: decayOffset - actualOptions.decay,\n direction: -actualOptions.angle,\n random: true,\n straight: false,\n outModes: {\n default: \"none\",\n bottom: \"destroy\"\n }\n },\n rotate: {\n value: actualOptions.flat ? disableRotate : {\n min: 0,\n max: 360\n },\n direction: \"random\",\n animation: {\n enable: !actualOptions.flat,\n speed: 60\n }\n },\n tilt: {\n direction: \"random\",\n enable: !actualOptions.flat,\n value: actualOptions.flat ? disableTilt : {\n min: 0,\n max: 360\n },\n animation: {\n enable: true,\n speed: 60\n }\n },\n roll: {\n darken: {\n enable: true,\n value: 25\n },\n enable: !actualOptions.flat,\n speed: {\n min: 15,\n max: 25\n }\n },\n wobble: {\n distance: 30,\n enable: !actualOptions.flat,\n speed: {\n min: -15,\n max: 15\n }\n }\n },\n motion: {\n disable: actualOptions.disableForReducedMotion\n },\n emitters: {\n name: \"confetti\",\n startCount: actualOptions.count,\n position: actualOptions.position,\n size: {\n width: 0,\n height: 0\n },\n rate: {\n delay: 0,\n quantity: 0\n },\n life: {\n duration: 0.1,\n count: 1\n }\n }\n };\n container = await _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles.load({\n id: params.id,\n element: params.canvas,\n options: particlesOptions\n });\n ids.set(params.id, container);\n return container;\n}\nasync function confetti(idOrOptions, confettiOptions) {\n await initPlugins(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles);\n let options, id;\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isString)(idOrOptions)) {\n id = idOrOptions;\n options = confettiOptions ?? {};\n } else {\n id = \"confetti\";\n options = idOrOptions;\n }\n return setConfetti({\n id,\n options\n });\n}\nconfetti.create = async (canvas, options)=>{\n await initPlugins(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles);\n const id = canvas.getAttribute(\"id\") ?? \"confetti\";\n canvas.setAttribute(\"id\", id);\n return async (idOrOptions, confettiOptions)=>{\n let subOptions, subId;\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isString)(idOrOptions)) {\n subId = idOrOptions;\n subOptions = confettiOptions ?? options;\n } else {\n subId = id;\n subOptions = idOrOptions;\n }\n return setConfetti({\n id: subId,\n canvas,\n options: subOptions\n });\n };\n};\nconfetti.init = async ()=>{\n await initPlugins(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles);\n};\nconfetti.version = \"4.0.0-beta.8\";\nglobalThis.confetti = confetti;\n\n\n//# sourceURL=webpack://@tsparticles/confetti/./dist/browser/confetti.js?\n}");
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
1
|
+
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
+
/* tsParticles v4.0.0 */
|
|
3
|
+
(function (global, factory) {
|
|
4
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine'), require('@tsparticles/basic'), require('@tsparticles/shape-cards/suits'), require('@tsparticles/plugin-emitters/plugin'), 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')) :
|
|
5
|
+
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine', '@tsparticles/basic', '@tsparticles/shape-cards/suits', '@tsparticles/plugin-emitters/plugin', '@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) :
|
|
6
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.__tsParticlesInternals = global.__tsParticlesInternals || {}, global.__tsParticlesInternals.bundles = global.__tsParticlesInternals.bundles || {}, global.__tsParticlesInternals.bundles.confetti = global.__tsParticlesInternals.bundles.confetti || {}), global.__tsParticlesInternals.engine, global.__tsParticlesInternals.bundles.basic, global.__tsParticlesInternals.shapes["cards/suits"], global.__tsParticlesInternals.plugins["emitters/plugin"], global.__tsParticlesInternals.shapes.emoji, global.__tsParticlesInternals.shapes.heart, global.__tsParticlesInternals.shapes.image, global.__tsParticlesInternals.updaters.life, global.__tsParticlesInternals.plugins.motion, global.__tsParticlesInternals.shapes.polygon, global.__tsParticlesInternals.updaters.roll, global.__tsParticlesInternals.updaters.rotate, global.__tsParticlesInternals.shapes.square, global.__tsParticlesInternals.shapes.star, global.__tsParticlesInternals.updaters.tilt, global.__tsParticlesInternals.updaters.wobble));
|
|
7
|
+
})(this, (function (exports, engine, basic, suits, plugin, shapeEmoji, shapeHeart, shapeImage, updaterLife, pluginMotion, shapePolygon, updaterRoll, updaterRotate, shapeSquare, shapeStar, updaterTilt, updaterWobble) { 'use strict';
|
|
8
|
+
|
|
9
|
+
class ConfettiOptions {
|
|
10
|
+
angle;
|
|
11
|
+
colors;
|
|
12
|
+
count;
|
|
13
|
+
decay;
|
|
14
|
+
disableForReducedMotion;
|
|
15
|
+
drift;
|
|
16
|
+
flat;
|
|
17
|
+
gravity;
|
|
18
|
+
position;
|
|
19
|
+
scalar;
|
|
20
|
+
shapeOptions;
|
|
21
|
+
shapes;
|
|
22
|
+
spread;
|
|
23
|
+
startVelocity;
|
|
24
|
+
ticks;
|
|
25
|
+
zIndex;
|
|
26
|
+
constructor() {
|
|
27
|
+
this.angle = 90;
|
|
28
|
+
this.count = 50;
|
|
29
|
+
this.spread = 45;
|
|
30
|
+
this.startVelocity = 45;
|
|
31
|
+
this.decay = 0.9;
|
|
32
|
+
this.gravity = 1;
|
|
33
|
+
this.drift = 0;
|
|
34
|
+
this.ticks = 200;
|
|
35
|
+
this.position = {
|
|
36
|
+
x: 50,
|
|
37
|
+
y: 50,
|
|
38
|
+
};
|
|
39
|
+
this.colors = ["#26ccff", "#a25afd", "#ff5e7e", "#88ff5a", "#fcff42", "#ffa62d", "#ff36ff"];
|
|
40
|
+
this.shapes = ["square", "circle"];
|
|
41
|
+
this.scalar = 1;
|
|
42
|
+
this.zIndex = 100;
|
|
43
|
+
this.disableForReducedMotion = true;
|
|
44
|
+
this.flat = false;
|
|
45
|
+
this.shapeOptions = {};
|
|
46
|
+
}
|
|
47
|
+
get origin() {
|
|
48
|
+
return {
|
|
49
|
+
x: this.position.x / engine.percentDenominator,
|
|
50
|
+
y: this.position.y / engine.percentDenominator,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
set origin(value) {
|
|
54
|
+
this.position.x = value.x * engine.percentDenominator;
|
|
55
|
+
this.position.y = value.y * engine.percentDenominator;
|
|
56
|
+
}
|
|
57
|
+
get particleCount() {
|
|
58
|
+
return this.count;
|
|
59
|
+
}
|
|
60
|
+
set particleCount(value) {
|
|
61
|
+
this.count = value;
|
|
62
|
+
}
|
|
63
|
+
load(data) {
|
|
64
|
+
if (engine.isNull(data)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (data.angle !== undefined) {
|
|
68
|
+
this.angle = data.angle;
|
|
69
|
+
}
|
|
70
|
+
const count = data.count ?? data.particleCount;
|
|
71
|
+
if (count !== undefined) {
|
|
72
|
+
this.count = count;
|
|
73
|
+
}
|
|
74
|
+
if (data.spread !== undefined) {
|
|
75
|
+
this.spread = data.spread;
|
|
76
|
+
}
|
|
77
|
+
if (data.startVelocity !== undefined) {
|
|
78
|
+
this.startVelocity = data.startVelocity;
|
|
79
|
+
}
|
|
80
|
+
if (data.decay !== undefined) {
|
|
81
|
+
this.decay = data.decay;
|
|
82
|
+
}
|
|
83
|
+
if (data.flat !== undefined) {
|
|
84
|
+
this.flat = data.flat;
|
|
85
|
+
}
|
|
86
|
+
if (data.gravity !== undefined) {
|
|
87
|
+
this.gravity = data.gravity;
|
|
88
|
+
}
|
|
89
|
+
if (data.drift !== undefined) {
|
|
90
|
+
this.drift = data.drift;
|
|
91
|
+
}
|
|
92
|
+
if (data.ticks !== undefined) {
|
|
93
|
+
this.ticks = data.ticks;
|
|
94
|
+
}
|
|
95
|
+
const origin = data.origin;
|
|
96
|
+
if (origin && !data.position) {
|
|
97
|
+
data.position = {
|
|
98
|
+
x: origin.x === undefined ? undefined : origin.x * engine.percentDenominator,
|
|
99
|
+
y: origin.y === undefined ? undefined : origin.y * engine.percentDenominator,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const position = data.position;
|
|
103
|
+
if (position) {
|
|
104
|
+
if (position.x !== undefined) {
|
|
105
|
+
this.position.x = position.x;
|
|
106
|
+
}
|
|
107
|
+
if (position.y !== undefined) {
|
|
108
|
+
this.position.y = position.y;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (data.colors !== undefined) {
|
|
112
|
+
if (engine.isArray(data.colors)) {
|
|
113
|
+
this.colors = [...data.colors];
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
this.colors = data.colors;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const options = data.shapeOptions;
|
|
120
|
+
if (options !== undefined) {
|
|
121
|
+
for (const shape in options) {
|
|
122
|
+
const item = options[shape];
|
|
123
|
+
if (item) {
|
|
124
|
+
this.shapeOptions[shape] = engine.deepExtend(this.shapeOptions[shape] ?? {}, item);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (data.shapes !== undefined) {
|
|
129
|
+
if (engine.isArray(data.shapes)) {
|
|
130
|
+
this.shapes = [...data.shapes];
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.shapes = data.shapes;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (data.scalar !== undefined) {
|
|
137
|
+
this.scalar = data.scalar;
|
|
138
|
+
}
|
|
139
|
+
if (data.zIndex !== undefined) {
|
|
140
|
+
this.zIndex = data.zIndex;
|
|
141
|
+
}
|
|
142
|
+
if (data.disableForReducedMotion !== undefined) {
|
|
143
|
+
this.disableForReducedMotion = data.disableForReducedMotion;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const defaultGravity = 9.81, sizeFactor = 5, speedFactor = 3, decayOffset = 1, disableRotate = 0, disableTilt = 0, ids = new Map();
|
|
149
|
+
async function addEmitter(container, actualOptions, opacitySpeed) {
|
|
150
|
+
await container.addEmitter?.({
|
|
151
|
+
startCount: actualOptions.count,
|
|
152
|
+
position: actualOptions.position,
|
|
153
|
+
size: {
|
|
154
|
+
width: 0,
|
|
155
|
+
height: 0,
|
|
156
|
+
},
|
|
157
|
+
rate: {
|
|
158
|
+
delay: 0,
|
|
159
|
+
quantity: 0,
|
|
160
|
+
},
|
|
161
|
+
life: {
|
|
162
|
+
duration: 0.1,
|
|
163
|
+
count: 1,
|
|
164
|
+
},
|
|
165
|
+
particles: {
|
|
166
|
+
paint: {
|
|
167
|
+
fill: {
|
|
168
|
+
color: {
|
|
169
|
+
value: actualOptions.colors,
|
|
170
|
+
},
|
|
171
|
+
enable: true,
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
shape: {
|
|
175
|
+
type: actualOptions.shapes,
|
|
176
|
+
options: actualOptions.shapeOptions,
|
|
177
|
+
},
|
|
178
|
+
life: {
|
|
179
|
+
count: 1,
|
|
180
|
+
},
|
|
181
|
+
opacity: {
|
|
182
|
+
value: { min: 0, max: 1 },
|
|
183
|
+
animation: {
|
|
184
|
+
enable: true,
|
|
185
|
+
sync: true,
|
|
186
|
+
speed: opacitySpeed,
|
|
187
|
+
startValue: "max",
|
|
188
|
+
destroy: "min",
|
|
189
|
+
count: 1,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
size: {
|
|
193
|
+
value: sizeFactor * actualOptions.scalar,
|
|
194
|
+
},
|
|
195
|
+
move: {
|
|
196
|
+
angle: {
|
|
197
|
+
value: actualOptions.spread,
|
|
198
|
+
offset: 0,
|
|
199
|
+
},
|
|
200
|
+
drift: {
|
|
201
|
+
min: -actualOptions.drift,
|
|
202
|
+
max: actualOptions.drift,
|
|
203
|
+
},
|
|
204
|
+
gravity: {
|
|
205
|
+
acceleration: actualOptions.gravity * defaultGravity,
|
|
206
|
+
},
|
|
207
|
+
speed: actualOptions.startVelocity * speedFactor,
|
|
208
|
+
decay: decayOffset - actualOptions.decay,
|
|
209
|
+
direction: -actualOptions.angle,
|
|
210
|
+
},
|
|
211
|
+
rotate: {
|
|
212
|
+
value: actualOptions.flat
|
|
213
|
+
? disableRotate
|
|
214
|
+
: {
|
|
215
|
+
min: 0,
|
|
216
|
+
max: 360,
|
|
217
|
+
},
|
|
218
|
+
direction: "random",
|
|
219
|
+
animation: {
|
|
220
|
+
enable: !actualOptions.flat,
|
|
221
|
+
speed: 60,
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
tilt: {
|
|
225
|
+
direction: "random",
|
|
226
|
+
enable: !actualOptions.flat,
|
|
227
|
+
value: actualOptions.flat
|
|
228
|
+
? disableTilt
|
|
229
|
+
: {
|
|
230
|
+
min: 0,
|
|
231
|
+
max: 360,
|
|
232
|
+
},
|
|
233
|
+
animation: {
|
|
234
|
+
enable: true,
|
|
235
|
+
speed: 60,
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
roll: {
|
|
239
|
+
darken: {
|
|
240
|
+
enable: true,
|
|
241
|
+
value: 25,
|
|
242
|
+
},
|
|
243
|
+
enable: !actualOptions.flat,
|
|
244
|
+
speed: {
|
|
245
|
+
min: 15,
|
|
246
|
+
max: 25,
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
wobble: {
|
|
250
|
+
distance: 30,
|
|
251
|
+
enable: !actualOptions.flat,
|
|
252
|
+
speed: {
|
|
253
|
+
min: -15,
|
|
254
|
+
max: 15,
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function convertOptions(actualOptions, params, opacitySpeed) {
|
|
261
|
+
return {
|
|
262
|
+
fullScreen: {
|
|
263
|
+
enable: !params.canvas,
|
|
264
|
+
zIndex: actualOptions.zIndex,
|
|
265
|
+
},
|
|
266
|
+
fpsLimit: 120,
|
|
267
|
+
particles: {
|
|
268
|
+
number: {
|
|
269
|
+
value: 0,
|
|
270
|
+
},
|
|
271
|
+
paint: {
|
|
272
|
+
fill: {
|
|
273
|
+
color: {
|
|
274
|
+
value: actualOptions.colors,
|
|
275
|
+
},
|
|
276
|
+
enable: true,
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
shape: {
|
|
280
|
+
type: actualOptions.shapes,
|
|
281
|
+
options: actualOptions.shapeOptions,
|
|
282
|
+
},
|
|
283
|
+
opacity: {
|
|
284
|
+
value: { min: 0, max: 1 },
|
|
285
|
+
animation: {
|
|
286
|
+
enable: true,
|
|
287
|
+
sync: true,
|
|
288
|
+
speed: opacitySpeed,
|
|
289
|
+
startValue: "max",
|
|
290
|
+
destroy: "min",
|
|
291
|
+
count: 1,
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
size: {
|
|
295
|
+
value: sizeFactor * actualOptions.scalar,
|
|
296
|
+
},
|
|
297
|
+
links: {
|
|
298
|
+
enable: false,
|
|
299
|
+
},
|
|
300
|
+
life: {
|
|
301
|
+
count: 1,
|
|
302
|
+
},
|
|
303
|
+
move: {
|
|
304
|
+
angle: {
|
|
305
|
+
value: actualOptions.spread,
|
|
306
|
+
offset: 0,
|
|
307
|
+
},
|
|
308
|
+
drift: {
|
|
309
|
+
min: -actualOptions.drift,
|
|
310
|
+
max: actualOptions.drift,
|
|
311
|
+
},
|
|
312
|
+
enable: true,
|
|
313
|
+
gravity: {
|
|
314
|
+
enable: true,
|
|
315
|
+
acceleration: actualOptions.gravity * defaultGravity,
|
|
316
|
+
},
|
|
317
|
+
speed: actualOptions.startVelocity * speedFactor,
|
|
318
|
+
decay: decayOffset - actualOptions.decay,
|
|
319
|
+
direction: -actualOptions.angle,
|
|
320
|
+
random: true,
|
|
321
|
+
straight: false,
|
|
322
|
+
outModes: {
|
|
323
|
+
default: "none",
|
|
324
|
+
bottom: "destroy",
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
rotate: {
|
|
328
|
+
value: actualOptions.flat
|
|
329
|
+
? disableRotate
|
|
330
|
+
: {
|
|
331
|
+
min: 0,
|
|
332
|
+
max: 360,
|
|
333
|
+
},
|
|
334
|
+
direction: "random",
|
|
335
|
+
animation: {
|
|
336
|
+
enable: !actualOptions.flat,
|
|
337
|
+
speed: 60,
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
tilt: {
|
|
341
|
+
direction: "random",
|
|
342
|
+
enable: !actualOptions.flat,
|
|
343
|
+
value: actualOptions.flat
|
|
344
|
+
? disableTilt
|
|
345
|
+
: {
|
|
346
|
+
min: 0,
|
|
347
|
+
max: 360,
|
|
348
|
+
},
|
|
349
|
+
animation: {
|
|
350
|
+
enable: true,
|
|
351
|
+
speed: 60,
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
roll: {
|
|
355
|
+
darken: {
|
|
356
|
+
enable: true,
|
|
357
|
+
value: 25,
|
|
358
|
+
},
|
|
359
|
+
enable: !actualOptions.flat,
|
|
360
|
+
speed: {
|
|
361
|
+
min: 15,
|
|
362
|
+
max: 25,
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
wobble: {
|
|
366
|
+
distance: 30,
|
|
367
|
+
enable: !actualOptions.flat,
|
|
368
|
+
speed: {
|
|
369
|
+
min: -15,
|
|
370
|
+
max: 15,
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
motion: {
|
|
375
|
+
disable: actualOptions.disableForReducedMotion,
|
|
376
|
+
},
|
|
377
|
+
emitters: {
|
|
378
|
+
name: "confetti",
|
|
379
|
+
startCount: actualOptions.count,
|
|
380
|
+
position: actualOptions.position,
|
|
381
|
+
size: {
|
|
382
|
+
width: 0,
|
|
383
|
+
height: 0,
|
|
384
|
+
},
|
|
385
|
+
rate: {
|
|
386
|
+
delay: 0,
|
|
387
|
+
quantity: 0,
|
|
388
|
+
},
|
|
389
|
+
life: {
|
|
390
|
+
duration: 0.1,
|
|
391
|
+
count: 1,
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
async function setConfetti(engine$1, params) {
|
|
397
|
+
const actualOptions = new ConfettiOptions();
|
|
398
|
+
actualOptions.load(params.options);
|
|
399
|
+
const fpsLimit = 120, fpsLimitFactor = 3.6, opacitySpeed = (actualOptions.ticks * engine.millisecondsToSeconds) / (fpsLimitFactor * engine.millisecondsToSeconds * fpsLimit);
|
|
400
|
+
let containerOrPromise = ids.get(params.id);
|
|
401
|
+
if (containerOrPromise instanceof Promise) {
|
|
402
|
+
await containerOrPromise;
|
|
403
|
+
containerOrPromise = ids.get(params.id);
|
|
404
|
+
}
|
|
405
|
+
const container = containerOrPromise;
|
|
406
|
+
if (container && !container.destroyed) {
|
|
407
|
+
const alias = container;
|
|
408
|
+
if ("addEmitter" in alias) {
|
|
409
|
+
await addEmitter(alias, actualOptions, opacitySpeed);
|
|
410
|
+
return container;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
const create = async () => {
|
|
414
|
+
const particlesOptions = convertOptions(actualOptions, params, opacitySpeed), newContainer = await engine$1.load({
|
|
415
|
+
id: params.id,
|
|
416
|
+
element: params.canvas,
|
|
417
|
+
options: particlesOptions,
|
|
418
|
+
});
|
|
419
|
+
ids.set(params.id, newContainer);
|
|
420
|
+
return newContainer;
|
|
421
|
+
}, createPromise = create();
|
|
422
|
+
ids.set(params.id, createPromise);
|
|
423
|
+
return createPromise;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
let initPromise = null;
|
|
427
|
+
async function doInitPlugins(engine) {
|
|
428
|
+
engine.checkVersion("4.0.0");
|
|
429
|
+
await engine.pluginManager.register(async (e) => {
|
|
430
|
+
await Promise.all([
|
|
431
|
+
basic.loadBasic(e),
|
|
432
|
+
pluginMotion.loadMotionPlugin(e),
|
|
433
|
+
plugin.loadEmittersPluginSimple(e),
|
|
434
|
+
suits.loadCardSuitsShape(e),
|
|
435
|
+
shapeHeart.loadHeartShape(e),
|
|
436
|
+
shapeImage.loadImageShape(e),
|
|
437
|
+
shapePolygon.loadPolygonShape(e),
|
|
438
|
+
shapeSquare.loadSquareShape(e),
|
|
439
|
+
shapeStar.loadStarShape(e),
|
|
440
|
+
shapeEmoji.loadEmojiShape(e),
|
|
441
|
+
updaterRotate.loadRotateUpdater(e),
|
|
442
|
+
updaterLife.loadLifeUpdater(e),
|
|
443
|
+
updaterRoll.loadRollUpdater(e),
|
|
444
|
+
updaterTilt.loadTiltUpdater(e),
|
|
445
|
+
updaterWobble.loadWobbleUpdater(e),
|
|
446
|
+
]);
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
async function initPlugins(engine) {
|
|
450
|
+
if (initPromise) {
|
|
451
|
+
return initPromise;
|
|
452
|
+
}
|
|
453
|
+
initPromise = doInitPlugins(engine);
|
|
454
|
+
return initPromise;
|
|
455
|
+
}
|
|
456
|
+
async function confetti(idOrOptions, confettiOptions) {
|
|
457
|
+
await initPlugins(engine.tsParticles);
|
|
458
|
+
let options, id;
|
|
459
|
+
if (engine.isString(idOrOptions)) {
|
|
460
|
+
id = idOrOptions;
|
|
461
|
+
options = confettiOptions ?? {};
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
id = "confetti";
|
|
465
|
+
options = idOrOptions;
|
|
466
|
+
}
|
|
467
|
+
return setConfetti(engine.tsParticles, {
|
|
468
|
+
id,
|
|
469
|
+
options,
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
confetti.create = async (canvas, options = {}) => {
|
|
473
|
+
await initPlugins(engine.tsParticles);
|
|
474
|
+
const id = canvas?.getAttribute("id") ?? "confetti";
|
|
475
|
+
canvas?.setAttribute("id", id);
|
|
476
|
+
await setConfetti(engine.tsParticles, {
|
|
477
|
+
id,
|
|
478
|
+
canvas: canvas ?? undefined,
|
|
479
|
+
options,
|
|
480
|
+
});
|
|
481
|
+
return async (idOrOptions, confettiOptions) => {
|
|
482
|
+
let subOptions, subId;
|
|
483
|
+
if (engine.isString(idOrOptions)) {
|
|
484
|
+
subId = idOrOptions;
|
|
485
|
+
subOptions = confettiOptions ?? options;
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
subId = id;
|
|
489
|
+
subOptions = idOrOptions;
|
|
490
|
+
}
|
|
491
|
+
return setConfetti(engine.tsParticles, {
|
|
492
|
+
id: subId,
|
|
493
|
+
canvas: canvas ?? undefined,
|
|
494
|
+
options: subOptions,
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
};
|
|
498
|
+
confetti.init = async () => {
|
|
499
|
+
await initPlugins(engine.tsParticles);
|
|
500
|
+
};
|
|
501
|
+
confetti.version = "4.0.0";
|
|
502
|
+
globalThis.confetti = confetti;
|
|
503
|
+
|
|
504
|
+
const globalObject = globalThis;
|
|
505
|
+
globalObject.__tsParticlesInternals = globalObject.__tsParticlesInternals ?? {};
|
|
506
|
+
globalObject.confetti = confetti;
|
|
507
|
+
|
|
508
|
+
exports.confetti = confetti;
|
|
509
|
+
|
|
510
|
+
}));
|
|
511
|
+
Object.assign(globalThis.window || globalThis, { confetti: (globalThis.__tsParticlesInternals.bundles.confetti || {}).confetti });
|
|
512
|
+
delete (globalThis.window || globalThis).tsparticlesInternalExports;
|