@tsparticles/plugin-emitters 4.0.0-alpha.5 → 4.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/526.min.js +1 -0
- package/588.min.js +1 -0
- package/772.min.js +1 -0
- package/784.min.js +1 -0
- package/795.min.js +1 -0
- package/803.min.js +1 -0
- package/README.md +5 -0
- package/browser/EmitterInstance.js +109 -65
- package/browser/EmitterShapeBase.js +4 -0
- package/browser/EmittersInstancesManager.js +2 -0
- package/browser/EmittersInteractor.js +5 -1
- package/browser/EmittersPlugin.js +2 -1
- package/browser/EmittersPluginInstance.js +2 -0
- package/browser/Options/Classes/Emitter.js +25 -3
- package/browser/Options/Classes/EmitterLife.js +4 -0
- package/browser/Options/Classes/EmitterRate.js +2 -0
- package/browser/Options/Classes/EmitterShape.js +3 -0
- package/browser/Options/Classes/EmitterShapeReplace.js +2 -0
- package/browser/Options/Classes/EmitterSize.js +3 -0
- package/browser/Options/Classes/EmitterSpawn.js +18 -0
- package/browser/Options/Interfaces/IEmitterSpawn.js +1 -0
- package/browser/index.js +13 -3
- package/cjs/EmitterInstance.js +109 -65
- package/cjs/EmitterShapeBase.js +4 -0
- package/cjs/EmittersInstancesManager.js +2 -0
- package/cjs/EmittersInteractor.js +5 -1
- package/cjs/EmittersPlugin.js +2 -1
- package/cjs/EmittersPluginInstance.js +2 -0
- package/cjs/Options/Classes/Emitter.js +25 -3
- package/cjs/Options/Classes/EmitterLife.js +4 -0
- package/cjs/Options/Classes/EmitterRate.js +2 -0
- package/cjs/Options/Classes/EmitterShape.js +3 -0
- package/cjs/Options/Classes/EmitterShapeReplace.js +2 -0
- package/cjs/Options/Classes/EmitterSize.js +3 -0
- package/cjs/Options/Classes/EmitterSpawn.js +18 -0
- package/cjs/Options/Interfaces/IEmitterSpawn.js +1 -0
- package/cjs/index.js +13 -3
- package/dist_browser_EmitterInstance_js.js +2 -2
- package/dist_browser_EmittersInstancesManager_js.js +18 -8
- package/dist_browser_EmittersInteractor_js.js +19 -9
- package/dist_browser_EmittersPluginInstance_js.js +2 -2
- package/dist_browser_EmittersPlugin_js.js +18 -8
- package/dist_browser_ShapeManager_js.js +2 -2
- package/esm/EmitterInstance.js +109 -65
- package/esm/EmitterShapeBase.js +4 -0
- package/esm/EmittersInstancesManager.js +2 -0
- package/esm/EmittersInteractor.js +5 -1
- package/esm/EmittersPlugin.js +2 -1
- package/esm/EmittersPluginInstance.js +2 -0
- package/esm/Options/Classes/Emitter.js +25 -3
- package/esm/Options/Classes/EmitterLife.js +4 -0
- package/esm/Options/Classes/EmitterRate.js +2 -0
- package/esm/Options/Classes/EmitterShape.js +3 -0
- package/esm/Options/Classes/EmitterShapeReplace.js +2 -0
- package/esm/Options/Classes/EmitterSize.js +3 -0
- package/esm/Options/Classes/EmitterSpawn.js +18 -0
- package/esm/Options/Interfaces/IEmitterSpawn.js +1 -0
- package/esm/index.js +13 -3
- package/package.json +3 -3
- package/report.html +3 -3
- package/tsparticles.plugin.emitters.js +44 -32
- package/tsparticles.plugin.emitters.min.js +2 -2
- package/types/EmitterInstance.d.ts +6 -1
- package/types/EmittersInteractor.d.ts +1 -0
- package/types/EmittersPlugin.d.ts +1 -1
- package/types/IEmitterShapeGenerator.d.ts +2 -2
- package/types/Options/Classes/Emitter.d.ts +4 -1
- package/types/Options/Classes/EmitterSpawn.d.ts +7 -0
- package/types/Options/Interfaces/IEmitter.d.ts +4 -1
- package/types/Options/Interfaces/IEmitterSpawn.d.ts +5 -0
- package/types/index.d.ts +1 -0
- package/umd/EmitterInstance.js +108 -64
- package/umd/EmitterShapeBase.js +4 -0
- package/umd/EmittersInstancesManager.js +2 -0
- package/umd/EmittersInteractor.js +5 -1
- package/umd/EmittersPlugin.js +2 -1
- package/umd/EmittersPluginInstance.js +2 -0
- package/umd/Options/Classes/Emitter.js +26 -4
- package/umd/Options/Classes/EmitterLife.js +4 -0
- package/umd/Options/Classes/EmitterRate.js +2 -0
- package/umd/Options/Classes/EmitterShape.js +3 -0
- package/umd/Options/Classes/EmitterShapeReplace.js +2 -0
- package/umd/Options/Classes/EmitterSize.js +3 -0
- package/umd/Options/Classes/EmitterSpawn.js +32 -0
- package/umd/Options/Interfaces/IEmitterSpawn.js +12 -0
- package/umd/index.js +14 -3
- package/129.min.js +0 -2
- package/129.min.js.LICENSE.txt +0 -1
- package/246.min.js +0 -2
- package/246.min.js.LICENSE.txt +0 -1
- package/330.min.js +0 -2
- package/330.min.js.LICENSE.txt +0 -1
- package/490.min.js +0 -2
- package/490.min.js.LICENSE.txt +0 -1
- package/849.min.js +0 -2
- package/849.min.js.LICENSE.txt +0 -1
- package/940.min.js +0 -2
- package/940.min.js.LICENSE.txt +0 -1
- package/tsparticles.plugin.emitters.min.js.LICENSE.txt +0 -1
|
@@ -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
|
-
* v4.0.0-
|
|
7
|
+
* v4.0.0-beta.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,13 +28,33 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
+
/***/ "@tsparticles/engine"
|
|
32
|
+
/*!*********************************************************************************************************************************!*\
|
|
33
|
+
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
34
|
+
\*********************************************************************************************************************************/
|
|
35
|
+
(module) {
|
|
36
|
+
|
|
37
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
38
|
+
|
|
39
|
+
/***/ },
|
|
40
|
+
|
|
41
|
+
/***/ "@tsparticles/plugin-interactivity"
|
|
42
|
+
/*!***************************************************************************************************************************************************************************!*\
|
|
43
|
+
!*** external {"commonjs":"@tsparticles/plugin-interactivity","commonjs2":"@tsparticles/plugin-interactivity","amd":"@tsparticles/plugin-interactivity","root":"window"} ***!
|
|
44
|
+
\***************************************************************************************************************************************************************************/
|
|
45
|
+
(module) {
|
|
46
|
+
|
|
47
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
48
|
+
|
|
49
|
+
/***/ },
|
|
50
|
+
|
|
31
51
|
/***/ "./dist/browser/EmitterShapeBase.js"
|
|
32
52
|
/*!******************************************!*\
|
|
33
53
|
!*** ./dist/browser/EmitterShapeBase.js ***!
|
|
34
54
|
\******************************************/
|
|
35
55
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
36
56
|
|
|
37
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterShapeBase: () => (/* binding */ EmitterShapeBase)\n/* harmony export */ });\nclass EmitterShapeBase {\n
|
|
57
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterShapeBase: () => (/* binding */ EmitterShapeBase)\n/* harmony export */ });\nclass EmitterShapeBase {\n fill;\n options;\n position;\n size;\n constructor(position, size, fill, options){\n this.position = position;\n this.size = size;\n this.fill = fill;\n this.options = options;\n }\n resize(position, size) {\n this.position = position;\n this.size = size;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/EmitterShapeBase.js?\n}");
|
|
38
58
|
|
|
39
59
|
/***/ },
|
|
40
60
|
|
|
@@ -44,7 +64,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
44
64
|
\************************************************/
|
|
45
65
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
46
66
|
|
|
47
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterClickMode: () => (/* binding */ EmitterClickMode)\n/* harmony export */ });\nvar EmitterClickMode;\n(function
|
|
67
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterClickMode: () => (/* binding */ EmitterClickMode)\n/* harmony export */ });\nvar EmitterClickMode;\n(function(EmitterClickMode) {\n EmitterClickMode[\"emitter\"] = \"emitter\";\n})(EmitterClickMode || (EmitterClickMode = {}));\n\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/Enums/EmitterClickMode.js?\n}");
|
|
48
68
|
|
|
49
69
|
/***/ },
|
|
50
70
|
|
|
@@ -54,27 +74,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
54
74
|
\*******************************/
|
|
55
75
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
56
76
|
|
|
57
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterClickMode: () => (/* reexport safe */ _Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_1__.EmitterClickMode),\n/* harmony export */ EmitterShapeBase: () => (/* reexport safe */ _EmitterShapeBase_js__WEBPACK_IMPORTED_MODULE_0__.EmitterShapeBase),\n/* harmony export */ loadEmittersPlugin: () => (/* binding */ loadEmittersPlugin)\n/* harmony export */ });\n/* harmony import */ var _EmitterShapeBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EmitterShapeBase.js */ \"./dist/browser/EmitterShapeBase.js\");\n/* harmony import */ var _Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Enums/EmitterClickMode.js */ \"./dist/browser/Enums/EmitterClickMode.js\");\nasync function loadEmittersPlugin(engine) {\n
|
|
58
|
-
|
|
59
|
-
/***/ },
|
|
60
|
-
|
|
61
|
-
/***/ "@tsparticles/engine"
|
|
62
|
-
/*!*********************************************************************************************************************************!*\
|
|
63
|
-
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
64
|
-
\*********************************************************************************************************************************/
|
|
65
|
-
(module) {
|
|
66
|
-
|
|
67
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
68
|
-
|
|
69
|
-
/***/ },
|
|
70
|
-
|
|
71
|
-
/***/ "@tsparticles/plugin-interactivity"
|
|
72
|
-
/*!***************************************************************************************************************************************************************************!*\
|
|
73
|
-
!*** external {"commonjs":"@tsparticles/plugin-interactivity","commonjs2":"@tsparticles/plugin-interactivity","amd":"@tsparticles/plugin-interactivity","root":"window"} ***!
|
|
74
|
-
\***************************************************************************************************************************************************************************/
|
|
75
|
-
(module) {
|
|
76
|
-
|
|
77
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
77
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmitterClickMode: () => (/* reexport safe */ _Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_1__.EmitterClickMode),\n/* harmony export */ EmitterShapeBase: () => (/* reexport safe */ _EmitterShapeBase_js__WEBPACK_IMPORTED_MODULE_0__.EmitterShapeBase),\n/* harmony export */ ensureEmittersPluginLoaded: () => (/* binding */ ensureEmittersPluginLoaded),\n/* harmony export */ loadEmittersPlugin: () => (/* binding */ loadEmittersPlugin)\n/* harmony export */ });\n/* harmony import */ var _EmitterShapeBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EmitterShapeBase.js */ \"./dist/browser/EmitterShapeBase.js\");\n/* harmony import */ var _Enums_EmitterClickMode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Enums/EmitterClickMode.js */ \"./dist/browser/Enums/EmitterClickMode.js\");\nasync function loadEmittersPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.0\");\n await engine.register(async (e)=>{\n const [{ ensureInteractivityPluginLoaded }, { ShapeManager }, { EmittersInstancesManager }, { EmittersPlugin }] = await Promise.all([\n Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\", 19)),\n __webpack_require__.e(/*! import() */ \"dist_browser_ShapeManager_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ShapeManager.js */ \"./dist/browser/ShapeManager.js\")),\n __webpack_require__.e(/*! import() */ \"dist_browser_EmittersInstancesManager_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./EmittersInstancesManager.js */ \"./dist/browser/EmittersInstancesManager.js\")),\n __webpack_require__.e(/*! import() */ \"dist_browser_EmittersPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./EmittersPlugin.js */ \"./dist/browser/EmittersPlugin.js\"))\n ]), instancesManager = new EmittersInstancesManager(e);\n ensureInteractivityPluginLoaded(e);\n e.emitterShapeManager ??= new ShapeManager();\n e.addEmitterShapeGenerator ??= (name, generator)=>{\n e.emitterShapeManager?.addShapeGenerator(name, generator);\n };\n e.addPlugin(new EmittersPlugin(instancesManager));\n e.addInteractor?.(\"externalEmitters\", async (container)=>{\n const { EmittersInteractor } = await __webpack_require__.e(/*! import() */ \"dist_browser_EmittersInteractor_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./EmittersInteractor.js */ \"./dist/browser/EmittersInteractor.js\"));\n return new EmittersInteractor(instancesManager, container);\n });\n });\n}\nfunction ensureEmittersPluginLoaded(e) {\n if (!e.addEmitterShapeGenerator) {\n throw new Error(\"tsParticles Emitters Plugin is not loaded\");\n }\n}\n\n\n\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters/./dist/browser/index.js?\n}");
|
|
78
78
|
|
|
79
79
|
/***/ }
|
|
80
80
|
|
|
@@ -90,12 +90,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
90
90
|
/******/ if (cachedModule !== undefined) {
|
|
91
91
|
/******/ return cachedModule.exports;
|
|
92
92
|
/******/ }
|
|
93
|
-
/******/ // Check if module exists (development only)
|
|
94
|
-
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
95
|
-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
96
|
-
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
97
|
-
/******/ throw e;
|
|
98
|
-
/******/ }
|
|
99
93
|
/******/ // Create a new module (and put it into the cache)
|
|
100
94
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
101
95
|
/******/ // no module.id needed
|
|
@@ -104,6 +98,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
104
98
|
/******/ };
|
|
105
99
|
/******/
|
|
106
100
|
/******/ // Execute the module function
|
|
101
|
+
/******/ if (!(moduleId in __webpack_modules__)) {
|
|
102
|
+
/******/ delete __webpack_module_cache__[moduleId];
|
|
103
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
104
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
105
|
+
/******/ throw e;
|
|
106
|
+
/******/ }
|
|
107
107
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
108
108
|
/******/
|
|
109
109
|
/******/ // Return the exports of the module
|
|
@@ -178,6 +178,18 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
178
178
|
/******/ };
|
|
179
179
|
/******/ })();
|
|
180
180
|
/******/
|
|
181
|
+
/******/ /* webpack/runtime/global */
|
|
182
|
+
/******/ (() => {
|
|
183
|
+
/******/ __webpack_require__.g = (function() {
|
|
184
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
185
|
+
/******/ try {
|
|
186
|
+
/******/ return this || new Function('return this')();
|
|
187
|
+
/******/ } catch (e) {
|
|
188
|
+
/******/ if (typeof window === 'object') return window;
|
|
189
|
+
/******/ }
|
|
190
|
+
/******/ })();
|
|
191
|
+
/******/ })();
|
|
192
|
+
/******/
|
|
181
193
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
182
194
|
/******/ (() => {
|
|
183
195
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
@@ -242,8 +254,8 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
242
254
|
/******/ /* webpack/runtime/publicPath */
|
|
243
255
|
/******/ (() => {
|
|
244
256
|
/******/ var scriptUrl;
|
|
245
|
-
/******/ if (
|
|
246
|
-
/******/ var document =
|
|
257
|
+
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
258
|
+
/******/ var document = __webpack_require__.g.document;
|
|
247
259
|
/******/ if (!scriptUrl && document) {
|
|
248
260
|
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
|
|
249
261
|
/******/ scriptUrl = document.currentScript.src;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/plugin-interactivity","@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):t(e.window,e.window);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,(e,t)=>(()=>{"use strict";var r,i,o,n,a={303(e){e.exports=t},702(t){t.exports=e}},s={};function l(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return a[e](r,r.exports,l),r.exports}l.m=a,p=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,l.t=function(e,t){if(1&t&&(e=this(e)),8&t||"object"==typeof e&&e&&(4&t&&e.__esModule||16&t&&"function"==typeof e.then))return e;var r=Object.create(null);l.r(r);var i={};c=c||[null,p({}),p([]),p(p)];for(var o=2&t&&e;("object"==typeof o||"function"==typeof o)&&!~c.indexOf(o);o=p(o))Object.getOwnPropertyNames(o).forEach(t=>i[t]=()=>e[t]);return i.default=()=>e,l.d(r,i),r},l.d=(e,t)=>{for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.f={},l.e=e=>Promise.all(Object.keys(l.f).reduce((t,r)=>(l.f[r](e,t),t),[])),l.u=e=>""+e+".min.js",l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u={},l.l=(e,t,r,i)=>{if(u[e])return void u[e].push(t);if(void 0!==r)for(var o,n,a=document.getElementsByTagName("script"),s=0;s<a.length;s++){var c=a[s];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")=="@tsparticles/plugin-emitters:"+r){o=c;break}}o||(n=!0,(o=document.createElement("script")).charset="utf-8",l.nc&&o.setAttribute("nonce",l.nc),o.setAttribute("data-webpack","@tsparticles/plugin-emitters:"+r),o.src=e),u[e]=[t];var p=(t,r)=>{o.onerror=o.onload=null,clearTimeout(d);var i=u[e];if(delete u[e],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(e=>e(r)),t)return t(r)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=p.bind(null,o.onerror),o.onload=p.bind(null,o.onload),n&&document.head.appendChild(o)},l.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.g.importScripts&&(d=l.g.location+"");var c,p,u,d,f=l.g.document;if(!d&&f&&(f.currentScript&&"SCRIPT"===f.currentScript.tagName.toUpperCase()&&(d=f.currentScript.src),!d)){var h=f.getElementsByTagName("script");if(h.length)for(var m=h.length-1;m>-1&&(!d||!/^http(s?):/.test(d));)d=h[m--].src}if(!d)throw Error("Automatic publicPath is not supported in this browser");l.p=d=d.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r={833:0},l.f.j=(e,t)=>{var i=l.o(r,e)?r[e]:void 0;if(0!==i)if(i)t.push(i[2]);else{var o=new Promise((t,o)=>i=r[e]=[t,o]);t.push(i[2]=o);var n=l.p+l.u(e),a=Error();l.l(n,t=>{if(l.o(r,e)&&(0!==(i=r[e])&&(r[e]=void 0),i)){var o=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;a.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+o+": "+n+")",a.name="ChunkLoadError",a.type=o,a.request=n,i[1](a)}},"chunk-"+e,e)}},i=(e,t)=>{var i,o,[n,a,s]=t,c=0;if(n.some(e=>0!==r[e])){for(i in a)l.o(a,i)&&(l.m[i]=a[i]);s&&s(l)}for(e&&e(t);c<n.length;c++)o=n[c],l.o(r,o)&&r[o]&&r[o][0](),r[o]=0},(o=this.webpackChunk_tsparticles_plugin_emitters=this.webpackChunk_tsparticles_plugin_emitters||[]).forEach(i.bind(null,0)),o.push=i.bind(null,o.push.bind(o));var b={};l.r(b),l.d(b,{EmitterClickMode:()=>n,EmitterShapeBase:()=>g,ensureEmittersPluginLoaded:()=>v,loadEmittersPlugin:()=>y});class g{fill;options;position;size;constructor(e,t,r,i){this.position=e,this.size=t,this.fill=r,this.options=i}resize(e,t){this.position=e,this.size=t}}async function y(e){e.checkVersion("4.0.0-beta.0"),await e.register(async e=>{let[{ensureInteractivityPluginLoaded:t},{ShapeManager:r},{EmittersInstancesManager:i},{EmittersPlugin:o}]=await Promise.all([Promise.resolve().then(l.t.bind(l,702,19)),l.e(772).then(l.bind(l,772)),l.e(784).then(l.bind(l,784)),l.e(588).then(l.bind(l,588))]),n=new i(e);t(e),e.emitterShapeManager??=new r,e.addEmitterShapeGenerator??=(t,r)=>{e.emitterShapeManager?.addShapeGenerator(t,r)},e.addPlugin(new o(n)),e.addInteractor?.("externalEmitters",async e=>{let{EmittersInteractor:t}=await l.e(526).then(l.bind(l,526));return new t(n,e)})})}function v(e){if(!e.addEmitterShapeGenerator)throw Error("tsParticles Emitters Plugin is not loaded")}return(n||(n={})).emitter="emitter",b})());
|
|
@@ -10,7 +10,12 @@ export declare class EmitterInstance {
|
|
|
10
10
|
options: Emitter;
|
|
11
11
|
position: ICoordinates;
|
|
12
12
|
size: IDimension;
|
|
13
|
-
|
|
13
|
+
spawnFillColor?: IHsl;
|
|
14
|
+
spawnFillEnabled?: boolean;
|
|
15
|
+
spawnFillOpacity?: number;
|
|
16
|
+
spawnStrokeColor?: IHsl;
|
|
17
|
+
spawnStrokeOpacity?: number;
|
|
18
|
+
spawnStrokeWidth?: number;
|
|
14
19
|
private _currentDuration;
|
|
15
20
|
private _currentEmitDelay;
|
|
16
21
|
private _currentSpawnDelay;
|
|
@@ -6,6 +6,7 @@ import type { EmitterInstance } from "./EmitterInstance.js";
|
|
|
6
6
|
import type { EmittersInstancesManager } from "./EmittersInstancesManager.js";
|
|
7
7
|
export declare class EmittersInteractor extends ExternalInteractorBase<EmitterContainer> {
|
|
8
8
|
handleClickMode: (mode: string, interactivityData: IInteractivityData) => void;
|
|
9
|
+
readonly maxDistance: number;
|
|
9
10
|
private readonly _instancesManager;
|
|
10
11
|
constructor(instancesManager: EmittersInstancesManager, container: EmitterContainer);
|
|
11
12
|
clear(): void;
|
|
@@ -3,7 +3,7 @@ import type { EmitterOptions, IEmitterOptions } from "./types.js";
|
|
|
3
3
|
import type { EmitterContainer } from "./EmitterContainer.js";
|
|
4
4
|
import type { EmittersInstancesManager } from "./EmittersInstancesManager.js";
|
|
5
5
|
export declare class EmittersPlugin implements IPlugin {
|
|
6
|
-
readonly id
|
|
6
|
+
readonly id = "emitters";
|
|
7
7
|
private readonly _instancesManager;
|
|
8
8
|
constructor(instancesManager: EmittersInstancesManager);
|
|
9
9
|
getPlugin(container: EmitterContainer): Promise<IContainerPlugin>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ICoordinates, IDimension } from "@tsparticles/engine";
|
|
1
|
+
import type { Container, ICoordinates, IDimension } from "@tsparticles/engine";
|
|
2
2
|
import type { IEmitterShape } from "./IEmitterShape.js";
|
|
3
3
|
export interface IEmitterShapeGenerator<TOptions = unknown> {
|
|
4
|
-
generate(position: ICoordinates, size: IDimension, fill: boolean, options: TOptions): IEmitterShape;
|
|
4
|
+
generate(container: Container, position: ICoordinates, size: IDimension, fill: boolean, options: TOptions): IEmitterShape;
|
|
5
5
|
}
|
|
@@ -3,6 +3,7 @@ import { EmitterLife } from "./EmitterLife.js";
|
|
|
3
3
|
import { EmitterRate } from "./EmitterRate.js";
|
|
4
4
|
import { EmitterShape } from "./EmitterShape.js";
|
|
5
5
|
import { EmitterSize } from "./EmitterSize.js";
|
|
6
|
+
import { EmitterSpawn } from "./EmitterSpawn.js";
|
|
6
7
|
import type { IEmitter } from "../Interfaces/IEmitter.js";
|
|
7
8
|
export declare class Emitter implements IEmitter, IOptionLoader<IEmitter> {
|
|
8
9
|
autoPlay: boolean;
|
|
@@ -16,7 +17,9 @@ export declare class Emitter implements IEmitter, IOptionLoader<IEmitter> {
|
|
|
16
17
|
rate: EmitterRate;
|
|
17
18
|
shape: EmitterShape;
|
|
18
19
|
size?: EmitterSize;
|
|
19
|
-
|
|
20
|
+
spawn: EmitterSpawn;
|
|
21
|
+
spawnFillColor?: AnimatableColor;
|
|
22
|
+
spawnStrokeColor?: AnimatableColor;
|
|
20
23
|
startCount: number;
|
|
21
24
|
constructor();
|
|
22
25
|
load(data?: RecursivePartial<IEmitter>): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Fill, type IOptionLoader, type RecursivePartial, Stroke } from "@tsparticles/engine";
|
|
2
|
+
import type { IEmitterSpawn } from "../Interfaces/IEmitterSpawn.js";
|
|
3
|
+
export declare class EmitterSpawn implements IEmitterSpawn, IOptionLoader<IEmitterSpawn> {
|
|
4
|
+
fill?: Fill;
|
|
5
|
+
stroke?: Stroke;
|
|
6
|
+
load(data?: RecursivePartial<IEmitterSpawn>): void;
|
|
7
|
+
}
|
|
@@ -3,6 +3,7 @@ import type { IEmitterLife } from "./IEmitterLife.js";
|
|
|
3
3
|
import type { IEmitterRate } from "./IEmitterRate.js";
|
|
4
4
|
import type { IEmitterShape } from "./IEmitterShape.js";
|
|
5
5
|
import type { IEmitterSize } from "./IEmitterSize.js";
|
|
6
|
+
import type { IEmitterSpawn } from "./IEmitterSpawn.js";
|
|
6
7
|
export interface IEmitter {
|
|
7
8
|
autoPlay: boolean;
|
|
8
9
|
direction?: MoveDirection | keyof typeof MoveDirection | MoveDirectionAlt | number;
|
|
@@ -15,6 +16,8 @@ export interface IEmitter {
|
|
|
15
16
|
rate: IEmitterRate;
|
|
16
17
|
shape: IEmitterShape;
|
|
17
18
|
size?: IEmitterSize;
|
|
18
|
-
|
|
19
|
+
spawn: IEmitterSpawn;
|
|
20
|
+
spawnFillColor?: IAnimatableColor;
|
|
21
|
+
spawnStrokeColor?: IAnimatableColor;
|
|
19
22
|
startCount: number;
|
|
20
23
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EmittersEngine } from "./EmittersEngine.js";
|
|
2
2
|
export declare function loadEmittersPlugin(engine: EmittersEngine): Promise<void>;
|
|
3
|
+
export declare function ensureEmittersPluginLoaded(e: EmittersEngine): void;
|
|
3
4
|
export type * from "./EmitterContainer.js";
|
|
4
5
|
export * from "./EmitterShapeBase.js";
|
|
5
6
|
export type * from "./EmittersEngine.js";
|
package/umd/EmitterInstance.js
CHANGED
|
@@ -13,53 +13,54 @@
|
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const Emitter_js_1 = require("./Options/Classes/Emitter.js");
|
|
15
15
|
const EmitterSize_js_1 = require("./Options/Classes/EmitterSize.js");
|
|
16
|
-
const defaultLifeDelay = 0, minLifeCount = 0, defaultSpawnDelay = 0, defaultEmitDelay = 0, defaultLifeCount = -1, defaultColorAnimationFactor = 1, colorFactor = 3.6;
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
16
|
+
const defaultLifeDelay = 0, minLifeCount = 0, defaultSpawnDelay = 0, defaultEmitDelay = 0, defaultLifeCount = -1, defaultColorAnimationFactor = 1, colorFactor = 3.6, defaultStrokeWidth = 1;
|
|
17
|
+
function setParticlesOptionsFillColor(particlesOptions, color, opacity, enable) {
|
|
18
|
+
particlesOptions.fill = new engine_1.Fill();
|
|
19
|
+
particlesOptions.fill.color = engine_1.AnimatableColor.create(undefined, { value: color });
|
|
20
|
+
particlesOptions.fill.enable = enable;
|
|
21
|
+
particlesOptions.fill.opacity = opacity;
|
|
22
|
+
}
|
|
23
|
+
function setParticlesOptionsStrokeColor(particlesOptions, color, opacity, width) {
|
|
24
|
+
particlesOptions.stroke = new engine_1.Stroke();
|
|
25
|
+
particlesOptions.stroke.color = engine_1.AnimatableColor.create(undefined, { value: color });
|
|
26
|
+
particlesOptions.stroke.opacity = opacity;
|
|
27
|
+
particlesOptions.stroke.width = width;
|
|
26
28
|
}
|
|
27
29
|
class EmitterInstance {
|
|
30
|
+
container;
|
|
31
|
+
removeCallback;
|
|
32
|
+
fill;
|
|
33
|
+
name;
|
|
34
|
+
options;
|
|
35
|
+
position;
|
|
36
|
+
size;
|
|
37
|
+
spawnFillColor;
|
|
38
|
+
spawnFillEnabled;
|
|
39
|
+
spawnFillOpacity;
|
|
40
|
+
spawnStrokeColor;
|
|
41
|
+
spawnStrokeOpacity;
|
|
42
|
+
spawnStrokeWidth;
|
|
43
|
+
_currentDuration;
|
|
44
|
+
_currentEmitDelay;
|
|
45
|
+
_currentSpawnDelay;
|
|
46
|
+
_duration;
|
|
47
|
+
_emitDelay;
|
|
48
|
+
_engine;
|
|
49
|
+
_firstSpawn;
|
|
50
|
+
_immortal;
|
|
51
|
+
_initialPosition;
|
|
52
|
+
_lifeCount;
|
|
53
|
+
_mutationObserver;
|
|
54
|
+
_particlesOptions;
|
|
55
|
+
_paused;
|
|
56
|
+
_resizeObserver;
|
|
57
|
+
_shape;
|
|
58
|
+
_size;
|
|
59
|
+
_spawnDelay;
|
|
60
|
+
_startParticlesAdded;
|
|
28
61
|
constructor(engine, container, removeCallback, options, position) {
|
|
29
62
|
this.container = container;
|
|
30
63
|
this.removeCallback = removeCallback;
|
|
31
|
-
this._destroy = () => {
|
|
32
|
-
this._mutationObserver?.disconnect();
|
|
33
|
-
this._mutationObserver = undefined;
|
|
34
|
-
this._resizeObserver?.disconnect();
|
|
35
|
-
this._resizeObserver = undefined;
|
|
36
|
-
this.removeCallback(this);
|
|
37
|
-
this._engine.dispatchEvent("emitterDestroyed", {
|
|
38
|
-
container: this.container,
|
|
39
|
-
data: {
|
|
40
|
-
emitter: this,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
this._prepareToDie = () => {
|
|
45
|
-
if (this._paused) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const duration = this.options.life.duration !== undefined ? (0, engine_1.getRangeValue)(this.options.life.duration) : undefined, minDuration = 0, minLifeCount = 0;
|
|
49
|
-
if ((this._lifeCount > minLifeCount || this._immortal) && duration !== undefined && duration > minDuration) {
|
|
50
|
-
this._duration = duration * engine_1.millisecondsToSeconds;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
this._setColorAnimation = (animation, initValue, maxValue, factor = defaultColorAnimationFactor) => {
|
|
54
|
-
const container = this.container;
|
|
55
|
-
if (!animation.enable) {
|
|
56
|
-
return initValue;
|
|
57
|
-
}
|
|
58
|
-
const colorOffset = (0, engine_1.randomInRangeValue)(animation.offset), delay = (0, engine_1.getRangeValue)(this.options.rate.delay), emitFactor = container.retina.reduceFactor
|
|
59
|
-
? (delay * engine_1.millisecondsToSeconds) / container.retina.reduceFactor
|
|
60
|
-
: Infinity, colorSpeed = (0, engine_1.getRangeValue)(animation.speed);
|
|
61
|
-
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset * factor) % maxValue;
|
|
62
|
-
};
|
|
63
64
|
this._engine = engine;
|
|
64
65
|
this._currentDuration = 0;
|
|
65
66
|
this._currentEmitDelay = 0;
|
|
@@ -84,8 +85,11 @@
|
|
|
84
85
|
const particlesOptions = (0, engine_1.deepExtend)({}, this.options.particles);
|
|
85
86
|
particlesOptions.move ??= {};
|
|
86
87
|
particlesOptions.move.direction ??= this.options.direction;
|
|
87
|
-
if (this.options.
|
|
88
|
-
this.
|
|
88
|
+
if (this.options.spawn.fill?.color) {
|
|
89
|
+
this.spawnFillColor = (0, engine_1.rangeColorToHsl)(this._engine, this.options.spawn.fill.color);
|
|
90
|
+
}
|
|
91
|
+
if (this.options.spawn.stroke?.color) {
|
|
92
|
+
this.spawnStrokeColor = (0, engine_1.rangeColorToHsl)(this._engine, this.options.spawn.stroke.color);
|
|
89
93
|
}
|
|
90
94
|
this._paused = !this.options.autoPlay;
|
|
91
95
|
this._particlesOptions = particlesOptions;
|
|
@@ -111,7 +115,7 @@
|
|
|
111
115
|
}
|
|
112
116
|
const shapeOptions = this.options.shape, shapeGenerator = this._engine.emitterShapeManager?.getShapeGenerator(shapeOptions.type);
|
|
113
117
|
if (shapeGenerator) {
|
|
114
|
-
this._shape = shapeGenerator.generate(this.position, this.size, this.fill, shapeOptions.options);
|
|
118
|
+
this._shape = shapeGenerator.generate(this.container, this.position, this.size, this.fill, shapeOptions.options);
|
|
115
119
|
}
|
|
116
120
|
this._engine.dispatchEvent("emitterCreated", {
|
|
117
121
|
container,
|
|
@@ -213,7 +217,7 @@
|
|
|
213
217
|
container: this.container,
|
|
214
218
|
});
|
|
215
219
|
this.play();
|
|
216
|
-
this._currentSpawnDelay -= this.
|
|
220
|
+
this._currentSpawnDelay -= this._spawnDelay;
|
|
217
221
|
delete this._spawnDelay;
|
|
218
222
|
}
|
|
219
223
|
}
|
|
@@ -266,6 +270,19 @@
|
|
|
266
270
|
return size;
|
|
267
271
|
})());
|
|
268
272
|
}
|
|
273
|
+
_destroy = () => {
|
|
274
|
+
this._mutationObserver?.disconnect();
|
|
275
|
+
this._mutationObserver = undefined;
|
|
276
|
+
this._resizeObserver?.disconnect();
|
|
277
|
+
this._resizeObserver = undefined;
|
|
278
|
+
this.removeCallback(this);
|
|
279
|
+
this._engine.dispatchEvent("emitterDestroyed", {
|
|
280
|
+
container: this.container,
|
|
281
|
+
data: {
|
|
282
|
+
emitter: this,
|
|
283
|
+
},
|
|
284
|
+
});
|
|
285
|
+
};
|
|
269
286
|
_emit() {
|
|
270
287
|
if (this._paused) {
|
|
271
288
|
return;
|
|
@@ -275,18 +292,36 @@
|
|
|
275
292
|
}
|
|
276
293
|
_emitParticles(quantity) {
|
|
277
294
|
const singleParticlesOptions = ((0, engine_1.itemFromSingleOrMultiple)(this._particlesOptions) ??
|
|
278
|
-
{}),
|
|
295
|
+
{}), fillHslAnimation = this.options.spawn.fill?.color.animation, fillEnabled = this.options.spawn.fill?.enable ?? !!this.options.spawn.fill?.color, fillOpacity = this.options.spawn.fill?.opacity === undefined
|
|
296
|
+
? engine_1.defaultOpacity
|
|
297
|
+
: (0, engine_1.getRangeValue)(this.options.spawn.fill.opacity), strokeHslAnimation = this.options.spawn.stroke?.color?.animation, strokeOpacity = this.options.spawn.stroke?.opacity === undefined
|
|
298
|
+
? engine_1.defaultOpacity
|
|
299
|
+
: (0, engine_1.getRangeValue)(this.options.spawn.stroke.opacity), strokeWidth = this.options.spawn.stroke?.width === undefined
|
|
300
|
+
? defaultStrokeWidth
|
|
301
|
+
: (0, engine_1.getRangeValue)(this.options.spawn.stroke.width), reduceFactor = this.container.retina.reduceFactor, needsFillColorAnimation = !!fillHslAnimation, needsStrokeColorAnimation = !!strokeHslAnimation, needsShapeData = !!this._shape, needsColorAnimation = needsFillColorAnimation || needsStrokeColorAnimation, needsCopy = needsColorAnimation || needsShapeData, maxValues = needsColorAnimation ? { h: engine_1.hMax, s: engine_1.sMax, l: engine_1.lMax } : null, shapeOptions = this.options.shape;
|
|
279
302
|
for (let i = 0; i < quantity * reduceFactor; i++) {
|
|
280
303
|
const particlesOptions = needsCopy
|
|
281
304
|
? (0, engine_1.deepExtend)({}, singleParticlesOptions)
|
|
282
305
|
: singleParticlesOptions;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
306
|
+
this.spawnFillOpacity = fillOpacity;
|
|
307
|
+
this.spawnFillEnabled = fillEnabled;
|
|
308
|
+
this.spawnStrokeOpacity = strokeOpacity;
|
|
309
|
+
this.spawnStrokeWidth = strokeWidth;
|
|
310
|
+
if (this.spawnFillColor) {
|
|
311
|
+
if (fillHslAnimation && maxValues) {
|
|
312
|
+
this.spawnFillColor.h = this._setColorAnimation(fillHslAnimation.h, this.spawnFillColor.h, maxValues.h, colorFactor);
|
|
313
|
+
this.spawnFillColor.s = this._setColorAnimation(fillHslAnimation.s, this.spawnFillColor.s, maxValues.s);
|
|
314
|
+
this.spawnFillColor.l = this._setColorAnimation(fillHslAnimation.l, this.spawnFillColor.l, maxValues.l);
|
|
315
|
+
}
|
|
316
|
+
setParticlesOptionsFillColor(particlesOptions, this.spawnFillColor, this.spawnFillOpacity, this.spawnFillEnabled);
|
|
317
|
+
}
|
|
318
|
+
if (this.spawnStrokeColor) {
|
|
319
|
+
if (strokeHslAnimation && maxValues) {
|
|
320
|
+
this.spawnStrokeColor.h = this._setColorAnimation(strokeHslAnimation.h, this.spawnStrokeColor.h, maxValues.h, colorFactor);
|
|
321
|
+
this.spawnStrokeColor.s = this._setColorAnimation(strokeHslAnimation.s, this.spawnStrokeColor.s, maxValues.s);
|
|
322
|
+
this.spawnStrokeColor.l = this._setColorAnimation(strokeHslAnimation.l, this.spawnStrokeColor.l, maxValues.l);
|
|
288
323
|
}
|
|
289
|
-
|
|
324
|
+
setParticlesOptionsStrokeColor(particlesOptions, this.spawnStrokeColor, this.spawnStrokeOpacity, this.spawnStrokeWidth);
|
|
290
325
|
}
|
|
291
326
|
let position = this.position;
|
|
292
327
|
if (this._shape) {
|
|
@@ -295,17 +330,7 @@
|
|
|
295
330
|
position = shapePosData.position;
|
|
296
331
|
const replaceData = shapeOptions.replace;
|
|
297
332
|
if (replaceData.color && shapePosData.color) {
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
if (replaceData.opacity) {
|
|
301
|
-
if (particlesOptions.opacity) {
|
|
302
|
-
particlesOptions.opacity.value = shapePosData.opacity;
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
particlesOptions.opacity = {
|
|
306
|
-
value: shapePosData.opacity,
|
|
307
|
-
};
|
|
308
|
-
}
|
|
333
|
+
setParticlesOptionsFillColor(particlesOptions, shapePosData.color, replaceData.opacity ? (shapePosData.opacity ?? engine_1.defaultOpacity) : engine_1.defaultOpacity, true);
|
|
309
334
|
}
|
|
310
335
|
}
|
|
311
336
|
else {
|
|
@@ -317,6 +342,25 @@
|
|
|
317
342
|
}
|
|
318
343
|
}
|
|
319
344
|
}
|
|
345
|
+
_prepareToDie = () => {
|
|
346
|
+
if (this._paused) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
const duration = this.options.life.duration !== undefined ? (0, engine_1.getRangeValue)(this.options.life.duration) : undefined, minDuration = 0, minLifeCount = 0;
|
|
350
|
+
if ((this._lifeCount > minLifeCount || this._immortal) && duration !== undefined && duration > minDuration) {
|
|
351
|
+
this._duration = duration * engine_1.millisecondsToSeconds;
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
_setColorAnimation = (animation, initValue, maxValue, factor = defaultColorAnimationFactor) => {
|
|
355
|
+
const container = this.container;
|
|
356
|
+
if (!animation.enable) {
|
|
357
|
+
return initValue;
|
|
358
|
+
}
|
|
359
|
+
const colorOffset = (0, engine_1.randomInRangeValue)(animation.offset), delay = (0, engine_1.getRangeValue)(this.options.rate.delay), emitFactor = container.retina.reduceFactor
|
|
360
|
+
? (delay * engine_1.millisecondsToSeconds) / container.retina.reduceFactor
|
|
361
|
+
: Infinity, colorSpeed = (0, engine_1.getRangeValue)(animation.speed);
|
|
362
|
+
return (initValue + (colorSpeed * container.fpsLimit) / emitFactor + colorOffset * factor) % maxValue;
|
|
363
|
+
};
|
|
320
364
|
}
|
|
321
365
|
exports.EmitterInstance = EmitterInstance;
|
|
322
366
|
});
|
package/umd/EmitterShapeBase.js
CHANGED
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.EmitterShapeBase = void 0;
|
|
13
13
|
class EmitterShapeBase {
|
|
14
|
+
fill;
|
|
15
|
+
options;
|
|
16
|
+
position;
|
|
17
|
+
size;
|
|
14
18
|
constructor(position, size, fill, options) {
|
|
15
19
|
this.position = position;
|
|
16
20
|
this.size = size;
|
|
@@ -48,6 +48,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
48
48
|
const Emitter_js_1 = require("./Options/Classes/Emitter.js");
|
|
49
49
|
const defaultIndex = 0;
|
|
50
50
|
class EmittersInstancesManager {
|
|
51
|
+
_containerArrays;
|
|
52
|
+
_engine;
|
|
51
53
|
constructor(engine) {
|
|
52
54
|
this._containerArrays = new Map();
|
|
53
55
|
this._engine = engine;
|
|
@@ -16,9 +16,13 @@
|
|
|
16
16
|
const constants_js_1 = require("./constants.js");
|
|
17
17
|
const emittersMode = "emitters";
|
|
18
18
|
class EmittersInteractor extends plugin_interactivity_1.ExternalInteractorBase {
|
|
19
|
+
handleClickMode;
|
|
20
|
+
maxDistance;
|
|
21
|
+
_instancesManager;
|
|
19
22
|
constructor(instancesManager, container) {
|
|
20
23
|
super(container);
|
|
21
24
|
this._instancesManager = instancesManager;
|
|
25
|
+
this.maxDistance = 0;
|
|
22
26
|
this.handleClickMode = (mode, interactivityData) => {
|
|
23
27
|
const container = this.container, options = container.actualOptions, modeEmitters = options.interactivity.modes.emitters;
|
|
24
28
|
if (!modeEmitters || mode !== emittersMode) {
|
|
@@ -89,7 +93,7 @@
|
|
|
89
93
|
options.emitters.value.push(tmp);
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
|
-
else if (
|
|
96
|
+
else if ("value" in source.emitters) {
|
|
93
97
|
const emitterModeOptions = source.emitters;
|
|
94
98
|
options.emitters.random.enable = emitterModeOptions.random?.enable ?? options.emitters.random.enable;
|
|
95
99
|
options.emitters.random.count = emitterModeOptions.random?.count ?? options.emitters.random.count;
|
package/umd/EmittersPlugin.js
CHANGED
|
@@ -47,9 +47,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
47
47
|
const engine_1 = require("@tsparticles/engine");
|
|
48
48
|
const Emitter_js_1 = require("./Options/Classes/Emitter.js");
|
|
49
49
|
class EmittersPlugin {
|
|
50
|
+
id = "emitters";
|
|
51
|
+
_instancesManager;
|
|
50
52
|
constructor(instancesManager) {
|
|
51
53
|
this._instancesManager = instancesManager;
|
|
52
|
-
this.id = "emitters";
|
|
53
54
|
}
|
|
54
55
|
async getPlugin(container) {
|
|
55
56
|
const { EmittersPluginInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./EmittersPluginInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./EmittersPluginInstance.js"], resolve_1, reject_1); }).then(__importStar));
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
exports.EmittersPluginInstance = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
class EmittersPluginInstance {
|
|
15
|
+
container;
|
|
16
|
+
_instancesManager;
|
|
15
17
|
constructor(instancesManager, container) {
|
|
16
18
|
this.container = container;
|
|
17
19
|
this._instancesManager = instancesManager;
|