@tsparticles/fireworks 3.5.0 → 3.6.0-beta.1
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 +14 -0
- package/browser/fireworks.js +29 -14
- package/cjs/fireworks.js +29 -14
- package/esm/fireworks.js +29 -14
- package/package.json +10 -10
- package/report.html +1 -1
- package/tsparticles.fireworks.bundle.js +13 -13
- package/tsparticles.fireworks.bundle.min.js +1 -1
- package/tsparticles.fireworks.bundle.min.js.LICENSE.txt +1 -1
- package/tsparticles.fireworks.js +2 -2
- package/tsparticles.fireworks.min.js +1 -1
- package/tsparticles.fireworks.min.js.LICENSE.txt +1 -1
- package/types/fireworks.d.ts +3 -1
- package/umd/fireworks.js +29 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Fireworks v3.
|
|
1
|
+
/*! tsParticles Fireworks v3.6.0-beta.1 by Matteo Bruni */
|
package/tsparticles.fireworks.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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.
|
|
7
|
+
* v3.6.0-beta.1
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -44,7 +44,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
44
44
|
\***********************************/
|
|
45
45
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
46
46
|
|
|
47
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fireworks: () => (/* binding */ fireworks)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _FireworkOptions_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./FireworkOptions.js */ \"./dist/browser/FireworkOptions.js\");\n/* harmony import */ var _tsparticles_basic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/basic */ \"@tsparticles/basic\");\n/* harmony import */ var _tsparticles_basic__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_basic__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _tsparticles_updater_destroy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tsparticles/updater-destroy */ \"@tsparticles/updater-destroy\");\n/* harmony import */ var _tsparticles_updater_destroy__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_updater_destroy__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tsparticles/plugin-emitters */ \"@tsparticles/plugin-emitters\");\n/* harmony import */ var _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _tsparticles_plugin_emitters_shape_square__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @tsparticles/plugin-emitters-shape-square */ \"@tsparticles/plugin-emitters-shape-square\");\n/* harmony import */ var _tsparticles_plugin_emitters_shape_square__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_plugin_emitters_shape_square__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _tsparticles_updater_life__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @tsparticles/updater-life */ \"@tsparticles/updater-life\");\n/* harmony import */ var _tsparticles_updater_life__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_updater_life__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _tsparticles_updater_rotate__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @tsparticles/updater-rotate */ \"@tsparticles/updater-rotate\");\n/* harmony import */ var _tsparticles_updater_rotate__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_updater_rotate__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _tsparticles_plugin_sounds__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @tsparticles/plugin-sounds */ \"@tsparticles/plugin-sounds\");\n/* harmony import */ var _tsparticles_plugin_sounds__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_plugin_sounds__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _tsparticles_effect_trail__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @tsparticles/effect-trail */ \"@tsparticles/effect-trail\");\n/* harmony import */ var _tsparticles_effect_trail__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_effect_trail__WEBPACK_IMPORTED_MODULE_8__);\n\n\n\n\n\n\n\n\n\n\nconst minSplitCount = 2;\nlet initialized = false;\nlet initializing = false;\nconst explodeSoundCheck = args => {\n const data = args.data;\n return data.particle.shape === \"circle\" && !!data.particle.splitCount && data.particle.splitCount < minSplitCount;\n};\nclass FireworksInstance {\n constructor(container) {\n this._container = container;\n }\n pause() {\n this._container.pause();\n }\n play() {\n this._container.play();\n }\n stop() {\n this._container.stop();\n }\n}\nasync function initPlugins() {\n if (initialized) {\n return;\n }\n if (initializing) {\n return new Promise(resolve => {\n const timeout = 100,\n interval = setInterval(() => {\n if (!initialized) {\n return;\n }\n clearInterval(interval);\n resolve();\n }, timeout);\n });\n }\n initializing = true;\n await (0,_tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_3__.loadEmittersPlugin)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_plugin_emitters_shape_square__WEBPACK_IMPORTED_MODULE_4__.loadEmittersShapeSquare)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_plugin_sounds__WEBPACK_IMPORTED_MODULE_7__.loadSoundsPlugin)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_updater_rotate__WEBPACK_IMPORTED_MODULE_6__.loadRotateUpdater)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_updater_destroy__WEBPACK_IMPORTED_MODULE_2__.loadDestroyUpdater)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_updater_life__WEBPACK_IMPORTED_MODULE_5__.loadLifeUpdater)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_effect_trail__WEBPACK_IMPORTED_MODULE_8__.loadTrailEffect)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_basic__WEBPACK_IMPORTED_MODULE_1__.loadBasic)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n initializing = false;\n initialized = true;\n}\nasync function fireworks(idOrOptions, sourceOptions) {\n await initPlugins();\n let id;\n const options = new _FireworkOptions_js__WEBPACK_IMPORTED_MODULE_9__.FireworkOptions();\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isString)(idOrOptions)) {\n id = idOrOptions;\n options.load(sourceOptions);\n } else {\n id = \"fireworks\";\n options.load(idOrOptions);\n }\n const identity = 1,\n particlesOptions = {\n detectRetina: true,\n background: {\n color: options.background\n },\n fpsLimit: 60,\n emitters: {\n direction: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.MoveDirection.top,\n life: {\n count: 0,\n duration: 0.1,\n delay: 0.1\n },\n rate: {\n delay: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNumber)(options.rate) ? identity / options.rate : {\n min: identity / (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMin)(options.rate),\n max: identity / (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(options.rate)\n },\n quantity: 1\n },\n size: {\n width: 100,\n height: 0\n },\n position: {\n y: 100,\n x: 50\n }\n },\n particles: {\n number: {\n value: 0\n },\n color: {\n value: \"#fff\"\n },\n destroy: {\n mode: \"split\",\n bounds: {\n top: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(options.minHeight)\n },\n split: {\n sizeOffset: false,\n count: 1,\n factor: {\n value: 0.333333\n },\n rate: {\n value: options.splitCount\n },\n colorOffset: {\n s: options.saturation,\n l: options.brightness\n },\n particles: {\n color: {\n value: options.colors\n },\n number: {\n value: 0\n },\n opacity: {\n value: {\n min: 0.1,\n max: 1\n },\n animation: {\n enable: true,\n speed: 1,\n sync: false,\n startValue: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.max,\n destroy: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DestroyType.min\n }\n },\n effect: {\n type: \"trail\",\n options: {\n trail: {\n length: {\n min: 5,\n max: 10\n }\n }\n }\n },\n shape: {\n type: \"circle\"\n },\n size: {\n value: {\n min: 1,\n max: 2\n },\n animation: {\n enable: true,\n speed: 5,\n count: 1,\n sync: false,\n startValue: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.min,\n destroy: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DestroyType.none\n }\n },\n life: {\n count: 1,\n duration: {\n value: {\n min: 0.25,\n max: 0.5\n }\n }\n },\n move: {\n decay: {\n min: 0.05,\n max: 0.1\n },\n enable: true,\n gravity: {\n enable: true,\n inverse: false,\n acceleration: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(options.gravity)\n },\n speed: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(options.speed),\n direction: \"none\",\n outModes: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.destroy\n }\n }\n }\n },\n life: {\n count: 1\n },\n effect: {\n type: \"trail\",\n options: {\n trail: {\n length: {\n min: 10,\n max: 30\n },\n minWidth: 1,\n maxWidth: 1\n }\n }\n },\n shape: {\n type: \"circle\"\n },\n size: {\n value: 1\n },\n opacity: {\n value: 0.5\n },\n rotate: {\n path: true\n },\n move: {\n enable: true,\n gravity: {\n acceleration: 15,\n enable: true,\n inverse: true,\n maxSpeed: 100\n },\n speed: {\n min: 10,\n max: 20\n },\n outModes: {\n default: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.destroy,\n top: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.none\n }\n }\n },\n sounds: {\n enable: options.sounds,\n events: [{\n event: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.EventType.particleRemoved,\n filter: explodeSoundCheck,\n audio: [\"https://particles.js.org/audio/explosion0.mp3\", \"https://particles.js.org/audio/explosion1.mp3\", \"https://particles.js.org/audio/explosion2.mp3\"]\n }],\n volume: 50\n }\n };\n const container = await _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles.load({\n id,\n options: particlesOptions\n });\n if (!container) {\n return;\n }\n return new FireworksInstance(container);\n}\nfireworks.init = async () => {\n await initPlugins();\n};\nfireworks.version = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles.version;\nif (!(0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isSsr)()) {\n window.fireworks = fireworks;\n}\n\n//# sourceURL=webpack://@tsparticles/fireworks/./dist/browser/fireworks.js?");
|
|
47
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ fireworks: () => (/* binding */ fireworks)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _FireworkOptions_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./FireworkOptions.js */ \"./dist/browser/FireworkOptions.js\");\n/* harmony import */ var _tsparticles_basic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/basic */ \"@tsparticles/basic\");\n/* harmony import */ var _tsparticles_basic__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_basic__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _tsparticles_updater_destroy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tsparticles/updater-destroy */ \"@tsparticles/updater-destroy\");\n/* harmony import */ var _tsparticles_updater_destroy__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_updater_destroy__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tsparticles/plugin-emitters */ \"@tsparticles/plugin-emitters\");\n/* harmony import */ var _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _tsparticles_plugin_emitters_shape_square__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @tsparticles/plugin-emitters-shape-square */ \"@tsparticles/plugin-emitters-shape-square\");\n/* harmony import */ var _tsparticles_plugin_emitters_shape_square__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_plugin_emitters_shape_square__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _tsparticles_updater_life__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @tsparticles/updater-life */ \"@tsparticles/updater-life\");\n/* harmony import */ var _tsparticles_updater_life__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_updater_life__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _tsparticles_updater_rotate__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @tsparticles/updater-rotate */ \"@tsparticles/updater-rotate\");\n/* harmony import */ var _tsparticles_updater_rotate__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_updater_rotate__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _tsparticles_plugin_sounds__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @tsparticles/plugin-sounds */ \"@tsparticles/plugin-sounds\");\n/* harmony import */ var _tsparticles_plugin_sounds__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_plugin_sounds__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _tsparticles_effect_trail__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @tsparticles/effect-trail */ \"@tsparticles/effect-trail\");\n/* harmony import */ var _tsparticles_effect_trail__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_effect_trail__WEBPACK_IMPORTED_MODULE_8__);\n\n\n\n\n\n\n\n\n\n\nconst minSplitCount = 2;\nlet initialized = false;\nlet initializing = false;\nconst explodeSoundCheck = args => {\n const data = args.data;\n return data.particle.shape === \"circle\" && !!data.particle.splitCount && data.particle.splitCount < minSplitCount;\n};\nclass FireworksInstance {\n constructor(container) {\n this._container = container;\n }\n pause() {\n this._container.pause();\n }\n play() {\n this._container.play();\n }\n stop() {\n this._container.stop();\n }\n}\nasync function initPlugins() {\n if (initialized) {\n return;\n }\n if (initializing) {\n return new Promise(resolve => {\n const timeout = 100,\n interval = setInterval(() => {\n if (!initialized) {\n return;\n }\n clearInterval(interval);\n resolve();\n }, timeout);\n });\n }\n initializing = true;\n await (0,_tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_3__.loadEmittersPlugin)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_plugin_emitters_shape_square__WEBPACK_IMPORTED_MODULE_4__.loadEmittersShapeSquare)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_plugin_sounds__WEBPACK_IMPORTED_MODULE_7__.loadSoundsPlugin)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_updater_rotate__WEBPACK_IMPORTED_MODULE_6__.loadRotateUpdater)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_updater_destroy__WEBPACK_IMPORTED_MODULE_2__.loadDestroyUpdater)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_updater_life__WEBPACK_IMPORTED_MODULE_5__.loadLifeUpdater)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_effect_trail__WEBPACK_IMPORTED_MODULE_8__.loadTrailEffect)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n await (0,_tsparticles_basic__WEBPACK_IMPORTED_MODULE_1__.loadBasic)(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles, false);\n initializing = false;\n initialized = true;\n}\nfunction getOptions(options, canvas) {\n const identity = 1;\n return {\n detectRetina: true,\n background: {\n color: options.background\n },\n fullScreen: {\n enable: !!canvas\n },\n fpsLimit: 60,\n emitters: {\n direction: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.MoveDirection.top,\n life: {\n count: 0,\n duration: 0.1,\n delay: 0.1\n },\n rate: {\n delay: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNumber)(options.rate) ? identity / options.rate : {\n min: identity / (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMin)(options.rate),\n max: identity / (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(options.rate)\n },\n quantity: 1\n },\n size: {\n width: 100,\n height: 0\n },\n position: {\n y: 100,\n x: 50\n }\n },\n particles: {\n number: {\n value: 0\n },\n color: {\n value: \"#fff\"\n },\n destroy: {\n mode: \"split\",\n bounds: {\n top: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(options.minHeight)\n },\n split: {\n sizeOffset: false,\n count: 1,\n factor: {\n value: 0.333333\n },\n rate: {\n value: options.splitCount\n },\n colorOffset: {\n s: options.saturation,\n l: options.brightness\n },\n particles: {\n color: {\n value: options.colors\n },\n number: {\n value: 0\n },\n opacity: {\n value: {\n min: 0.1,\n max: 1\n },\n animation: {\n enable: true,\n speed: 1,\n sync: false,\n startValue: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.max,\n destroy: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DestroyType.min\n }\n },\n effect: {\n type: \"trail\",\n options: {\n trail: {\n length: {\n min: 5,\n max: 10\n }\n }\n }\n },\n shape: {\n type: \"circle\"\n },\n size: {\n value: {\n min: 1,\n max: 2\n },\n animation: {\n enable: true,\n speed: 5,\n count: 1,\n sync: false,\n startValue: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.StartValueType.min,\n destroy: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DestroyType.none\n }\n },\n life: {\n count: 1,\n duration: {\n value: {\n min: 0.25,\n max: 0.5\n }\n }\n },\n move: {\n decay: {\n min: 0.05,\n max: 0.1\n },\n enable: true,\n gravity: {\n enable: true,\n inverse: false,\n acceleration: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(options.gravity)\n },\n speed: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(options.speed),\n direction: \"none\",\n outModes: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.destroy\n }\n }\n }\n },\n life: {\n count: 1\n },\n effect: {\n type: \"trail\",\n options: {\n trail: {\n length: {\n min: 10,\n max: 30\n },\n minWidth: 1,\n maxWidth: 1\n }\n }\n },\n shape: {\n type: \"circle\"\n },\n size: {\n value: 1\n },\n opacity: {\n value: 0.5\n },\n rotate: {\n path: true\n },\n move: {\n enable: true,\n gravity: {\n acceleration: 15,\n enable: true,\n inverse: true,\n maxSpeed: 100\n },\n speed: {\n min: 10,\n max: 20\n },\n outModes: {\n default: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.destroy,\n top: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OutMode.none\n }\n }\n },\n sounds: {\n enable: options.sounds,\n events: [{\n event: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.EventType.particleRemoved,\n filter: explodeSoundCheck,\n audio: [\"https://particles.js.org/audio/explosion0.mp3\", \"https://particles.js.org/audio/explosion1.mp3\", \"https://particles.js.org/audio/explosion2.mp3\"]\n }],\n volume: 50\n }\n };\n}\nasync function getFireworksInstance(id, sourceOptions, canvas) {\n await initPlugins();\n const options = new _FireworkOptions_js__WEBPACK_IMPORTED_MODULE_9__.FireworkOptions();\n options.load(sourceOptions);\n const particlesOptions = getOptions(options, canvas),\n container = await _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles.load({\n id,\n element: canvas,\n options: particlesOptions\n });\n if (!container) {\n return;\n }\n return new FireworksInstance(container);\n}\nasync function fireworks(idOrOptions, sourceOptions) {\n let id;\n let options;\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isString)(idOrOptions)) {\n id = idOrOptions;\n options = sourceOptions ?? {};\n } else {\n id = \"fireworks\";\n options = idOrOptions ?? {};\n }\n return getFireworksInstance(id, options);\n}\nfireworks.create = async (canvas, options) => {\n const id = canvas.id ?? \"fireworks\";\n return getFireworksInstance(id, options ?? {}, canvas);\n};\nfireworks.init = async () => {\n await initPlugins();\n};\nfireworks.version = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.tsParticles.version;\nif (!(0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isSsr)()) {\n window.fireworks = fireworks;\n}\n\n//# sourceURL=webpack://@tsparticles/fireworks/./dist/browser/fireworks.js?");
|
|
48
48
|
|
|
49
49
|
/***/ }),
|
|
50
50
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.fireworks.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/basic"),require("@tsparticles/updater-destroy"),require("@tsparticles/plugin-emitters"),require("@tsparticles/plugin-emitters-shape-square"),require("@tsparticles/updater-life"),require("@tsparticles/updater-rotate"),require("@tsparticles/plugin-sounds"),require("@tsparticles/effect-trail"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/basic","@tsparticles/updater-destroy","@tsparticles/plugin-emitters","@tsparticles/plugin-emitters-shape-square","@tsparticles/updater-life","@tsparticles/updater-rotate","@tsparticles/plugin-sounds","@tsparticles/effect-trail"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/basic"),require("@tsparticles/updater-destroy"),require("@tsparticles/plugin-emitters"),require("@tsparticles/plugin-emitters-shape-square"),require("@tsparticles/updater-life"),require("@tsparticles/updater-rotate"),require("@tsparticles/plugin-sounds"),require("@tsparticles/effect-trail")):t(e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window);for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(this,((e,t,i,s,a,
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/basic"),require("@tsparticles/updater-destroy"),require("@tsparticles/plugin-emitters"),require("@tsparticles/plugin-emitters-shape-square"),require("@tsparticles/updater-life"),require("@tsparticles/updater-rotate"),require("@tsparticles/plugin-sounds"),require("@tsparticles/effect-trail"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/basic","@tsparticles/updater-destroy","@tsparticles/plugin-emitters","@tsparticles/plugin-emitters-shape-square","@tsparticles/updater-life","@tsparticles/updater-rotate","@tsparticles/plugin-sounds","@tsparticles/effect-trail"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/basic"),require("@tsparticles/updater-destroy"),require("@tsparticles/plugin-emitters"),require("@tsparticles/plugin-emitters-shape-square"),require("@tsparticles/updater-life"),require("@tsparticles/updater-rotate"),require("@tsparticles/plugin-sounds"),require("@tsparticles/effect-trail")):t(e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window,e.window);for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(this,((e,t,i,s,r,a,o,n,l)=>(()=>{var p={145:e=>{e.exports=t},637:e=>{e.exports=l},303:t=>{t.exports=e},526:e=>{e.exports=s},140:e=>{e.exports=r},933:e=>{e.exports=n},173:e=>{e.exports=i},75:e=>{e.exports=a},668:e=>{e.exports=o}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var i=u[e]={exports:{}};return p[e](i,i.exports,c),i.exports}c.d=(e,t)=>{for(var i in t)c.o(t,i)&&!c.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};c.r(d),c.d(d,{fireworks:()=>M});var m=c(303);class f{constructor(){this.background="none",this.brightness={min:-30,max:30},this.colors=["#ff595e","#ffca3a","#8ac926","#1982c4","#6a4c93"],this.gravity=5,this.minHeight={min:10,max:30},this.rate=10,this.saturation={min:-30,max:30},this.sounds=!0,this.speed={min:5,max:15},this.splitCount={min:75,max:150}}load(e){e&&(void 0!==e.background&&(this.background=e.background),void 0!==e.colors&&((0,m.isArray)(e.colors)?this.colors=[...e.colors]:this.colors=e.colors),void 0!==e.brightness&&(this.brightness=(0,m.setRangeValue)(e.brightness)),void 0!==e.gravity&&(this.gravity=(0,m.setRangeValue)(e.gravity)),void 0!==e.minHeight&&(this.minHeight=(0,m.setRangeValue)(e.minHeight)),void 0!==e.rate&&(this.rate=(0,m.setRangeValue)(e.rate)),void 0!==e.saturation&&(this.saturation=(0,m.setRangeValue)(e.saturation)),void 0!==e.sounds&&(this.sounds=e.sounds),void 0!==e.speed&&(this.speed=(0,m.setRangeValue)(e.speed)),void 0!==e.splitCount&&(this.splitCount=(0,m.setRangeValue)(e.splitCount)))}}var g=c(145),y=c(173),h=c(526),v=c(140),w=c(75),x=c(668),b=c(933),q=c(637);let P=!1,R=!1;const S=e=>{const t=e.data;return"circle"===t.particle.shape&&!!t.particle.splitCount&&t.particle.splitCount<2};class V{constructor(e){this._container=e}pause(){this._container.pause()}play(){this._container.play()}stop(){this._container.stop()}}async function j(){if(!P){if(R)return new Promise((e=>{const t=setInterval((()=>{P&&(clearInterval(t),e())}),100)}));R=!0,await(0,h.loadEmittersPlugin)(m.tsParticles,!1),await(0,v.loadEmittersShapeSquare)(m.tsParticles,!1),await(0,b.loadSoundsPlugin)(m.tsParticles,!1),await(0,x.loadRotateUpdater)(m.tsParticles,!1),await(0,y.loadDestroyUpdater)(m.tsParticles,!1),await(0,w.loadLifeUpdater)(m.tsParticles,!1),await(0,q.loadTrailEffect)(m.tsParticles,!1),await(0,g.loadBasic)(m.tsParticles,!1),R=!1,P=!0}}async function k(e,t,i){await j();const s=new f;s.load(t);const r=function(e,t){return{detectRetina:!0,background:{color:e.background},fullScreen:{enable:!!t},fpsLimit:60,emitters:{direction:m.MoveDirection.top,life:{count:0,duration:.1,delay:.1},rate:{delay:(0,m.isNumber)(e.rate)?1/e.rate:{min:1/(0,m.getRangeMin)(e.rate),max:1/(0,m.getRangeMax)(e.rate)},quantity:1},size:{width:100,height:0},position:{y:100,x:50}},particles:{number:{value:0},color:{value:"#fff"},destroy:{mode:"split",bounds:{top:(0,m.setRangeValue)(e.minHeight)},split:{sizeOffset:!1,count:1,factor:{value:.333333},rate:{value:e.splitCount},colorOffset:{s:e.saturation,l:e.brightness},particles:{color:{value:e.colors},number:{value:0},opacity:{value:{min:.1,max:1},animation:{enable:!0,speed:1,sync:!1,startValue:m.StartValueType.max,destroy:m.DestroyType.min}},effect:{type:"trail",options:{trail:{length:{min:5,max:10}}}},shape:{type:"circle"},size:{value:{min:1,max:2},animation:{enable:!0,speed:5,count:1,sync:!1,startValue:m.StartValueType.min,destroy:m.DestroyType.none}},life:{count:1,duration:{value:{min:.25,max:.5}}},move:{decay:{min:.05,max:.1},enable:!0,gravity:{enable:!0,inverse:!1,acceleration:(0,m.setRangeValue)(e.gravity)},speed:(0,m.setRangeValue)(e.speed),direction:"none",outModes:m.OutMode.destroy}}}},life:{count:1},effect:{type:"trail",options:{trail:{length:{min:10,max:30},minWidth:1,maxWidth:1}}},shape:{type:"circle"},size:{value:1},opacity:{value:.5},rotate:{path:!0},move:{enable:!0,gravity:{acceleration:15,enable:!0,inverse:!0,maxSpeed:100},speed:{min:10,max:20},outModes:{default:m.OutMode.destroy,top:m.OutMode.none}}},sounds:{enable:e.sounds,events:[{event:m.EventType.particleRemoved,filter:S,audio:["https://particles.js.org/audio/explosion0.mp3","https://particles.js.org/audio/explosion1.mp3","https://particles.js.org/audio/explosion2.mp3"]}],volume:50}}}(s,i),a=await m.tsParticles.load({id:e,element:i,options:r});if(a)return new V(a)}async function M(e,t){let i,s;return(0,m.isString)(e)?(i=e,s=t??{}):(i="fireworks",s=e??{}),k(i,s)}return M.create=async(e,t)=>k(e.id??"fireworks",t??{},e),M.init=async()=>{await j()},M.version=m.tsParticles.version,(0,m.isSsr)()||(window.fireworks=M),d})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Fireworks v3.
|
|
1
|
+
/*! tsParticles Fireworks v3.6.0-beta.1 by Matteo Bruni */
|
package/types/fireworks.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ type FireworksFunc = ((idOrOptions: string | RecursivePartial<IFireworkOptions>,
|
|
|
6
6
|
declare global {
|
|
7
7
|
interface Window {
|
|
8
8
|
fireworks: FireworksFunc & {
|
|
9
|
+
create: (canvas: HTMLCanvasElement, options: RecursivePartial<IFireworkOptions>) => Promise<FireworksInstance | undefined>;
|
|
9
10
|
init: () => Promise<void>;
|
|
10
11
|
version: string;
|
|
11
12
|
};
|
|
@@ -19,8 +20,9 @@ declare class FireworksInstance {
|
|
|
19
20
|
stop(): void;
|
|
20
21
|
}
|
|
21
22
|
export type { FireworksInstance };
|
|
22
|
-
export declare function fireworks(idOrOptions
|
|
23
|
+
export declare function fireworks(idOrOptions?: string | RecursivePartial<IFireworkOptions>, sourceOptions?: RecursivePartial<IFireworkOptions>): Promise<FireworksInstance | undefined>;
|
|
23
24
|
export declare namespace fireworks {
|
|
25
|
+
var create: (canvas: HTMLCanvasElement, options?: RecursivePartial<IFireworkOptions>) => Promise<FireworksInstance | undefined>;
|
|
24
26
|
var init: () => Promise<void>;
|
|
25
27
|
var version: string;
|
|
26
28
|
}
|
package/umd/fireworks.js
CHANGED
|
@@ -68,23 +68,16 @@
|
|
|
68
68
|
initializing = false;
|
|
69
69
|
initialized = true;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const options = new FireworkOptions_js_1.FireworkOptions();
|
|
75
|
-
if ((0, engine_1.isString)(idOrOptions)) {
|
|
76
|
-
id = idOrOptions;
|
|
77
|
-
options.load(sourceOptions);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
id = "fireworks";
|
|
81
|
-
options.load(idOrOptions);
|
|
82
|
-
}
|
|
83
|
-
const identity = 1, particlesOptions = {
|
|
71
|
+
function getOptions(options, canvas) {
|
|
72
|
+
const identity = 1;
|
|
73
|
+
return {
|
|
84
74
|
detectRetina: true,
|
|
85
75
|
background: {
|
|
86
76
|
color: options.background,
|
|
87
77
|
},
|
|
78
|
+
fullScreen: {
|
|
79
|
+
enable: !!canvas,
|
|
80
|
+
},
|
|
88
81
|
fpsLimit: 60,
|
|
89
82
|
emitters: {
|
|
90
83
|
direction: engine_1.MoveDirection.top,
|
|
@@ -264,12 +257,34 @@
|
|
|
264
257
|
volume: 50,
|
|
265
258
|
},
|
|
266
259
|
};
|
|
267
|
-
|
|
260
|
+
}
|
|
261
|
+
async function getFireworksInstance(id, sourceOptions, canvas) {
|
|
262
|
+
await initPlugins();
|
|
263
|
+
const options = new FireworkOptions_js_1.FireworkOptions();
|
|
264
|
+
options.load(sourceOptions);
|
|
265
|
+
const particlesOptions = getOptions(options, canvas), container = await engine_1.tsParticles.load({ id, element: canvas, options: particlesOptions });
|
|
268
266
|
if (!container) {
|
|
269
267
|
return;
|
|
270
268
|
}
|
|
271
269
|
return new FireworksInstance(container);
|
|
272
270
|
}
|
|
271
|
+
async function fireworks(idOrOptions, sourceOptions) {
|
|
272
|
+
let id;
|
|
273
|
+
let options;
|
|
274
|
+
if ((0, engine_1.isString)(idOrOptions)) {
|
|
275
|
+
id = idOrOptions;
|
|
276
|
+
options = sourceOptions ?? {};
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
id = "fireworks";
|
|
280
|
+
options = idOrOptions ?? {};
|
|
281
|
+
}
|
|
282
|
+
return getFireworksInstance(id, options);
|
|
283
|
+
}
|
|
284
|
+
fireworks.create = async (canvas, options) => {
|
|
285
|
+
const id = canvas.id ?? "fireworks";
|
|
286
|
+
return getFireworksInstance(id, options ?? {}, canvas);
|
|
287
|
+
};
|
|
273
288
|
fireworks.init = async () => {
|
|
274
289
|
await initPlugins();
|
|
275
290
|
};
|