@tsparticles/plugin-infection 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/392.min.js +1 -0
- package/800.min.js +1 -0
- package/91.min.js +1 -0
- package/README.md +5 -0
- package/browser/Infecter.js +22 -21
- package/browser/InfectionPlugin.js +1 -3
- package/browser/InfectionPluginInstance.js +2 -2
- package/browser/Options/Classes/Infection.js +5 -0
- package/browser/Options/Classes/InfectionStage.js +5 -0
- package/browser/ParticlesInfecter.js +7 -1
- package/browser/index.js +6 -3
- package/cjs/Infecter.js +22 -21
- package/cjs/InfectionPlugin.js +1 -3
- package/cjs/InfectionPluginInstance.js +2 -2
- package/cjs/Options/Classes/Infection.js +5 -0
- package/cjs/Options/Classes/InfectionStage.js +5 -0
- package/cjs/ParticlesInfecter.js +7 -1
- package/cjs/index.js +6 -3
- package/dist_browser_InfectionPluginInstance_js.js +3 -3
- package/dist_browser_InfectionPlugin_js.js +4 -4
- package/dist_browser_ParticlesInfecter_js.js +2 -2
- package/esm/Infecter.js +22 -21
- package/esm/InfectionPlugin.js +1 -3
- package/esm/InfectionPluginInstance.js +2 -2
- package/esm/Options/Classes/Infection.js +5 -0
- package/esm/Options/Classes/InfectionStage.js +5 -0
- package/esm/ParticlesInfecter.js +7 -1
- package/esm/index.js +6 -3
- package/package.json +3 -3
- package/report.html +3 -3
- package/tsparticles.plugin.infection.js +31 -19
- package/tsparticles.plugin.infection.min.js +2 -2
- package/types/InfectionPlugin.d.ts +1 -2
- package/types/ParticlesInfecter.d.ts +2 -0
- package/umd/Infecter.js +22 -21
- package/umd/InfectionPlugin.js +1 -3
- package/umd/InfectionPluginInstance.js +2 -2
- package/umd/Options/Classes/Infection.js +5 -0
- package/umd/Options/Classes/InfectionStage.js +5 -0
- package/umd/ParticlesInfecter.js +7 -1
- package/umd/index.js +6 -3
- package/249.min.js +0 -2
- package/249.min.js.LICENSE.txt +0 -1
- package/713.min.js +0 -2
- package/713.min.js.LICENSE.txt +0 -1
- package/835.min.js +0 -2
- package/835.min.js.LICENSE.txt +0 -1
- package/tsparticles.plugin.infection.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,16 +28,6 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
-
/***/ "./dist/browser/index.js"
|
|
32
|
-
/*!*******************************!*\
|
|
33
|
-
!*** ./dist/browser/index.js ***!
|
|
34
|
-
\*******************************/
|
|
35
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
36
|
-
|
|
37
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadInfectionPlugin: () => (/* binding */ loadInfectionPlugin)\n/* harmony export */ });\nasync function loadInfectionPlugin(engine) {\n engine.checkVersion(\"4.0.0-alpha.5\");\n await engine.register(async e => {\n const {\n loadInteractivityPlugin\n } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\", 19)),\n {\n InfectionPlugin\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_InfectionPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./InfectionPlugin.js */ \"./dist/browser/InfectionPlugin.js\"));\n await loadInteractivityPlugin(e);\n e.addPlugin(new InfectionPlugin());\n e.addInteractor?.(\"particlesInfection\", async container => {\n const {\n ParticlesInfecter\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_ParticlesInfecter_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ParticlesInfecter.js */ \"./dist/browser/ParticlesInfecter.js\"));\n return new ParticlesInfecter(container);\n });\n });\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-infection/./dist/browser/index.js?\n}");
|
|
38
|
-
|
|
39
|
-
/***/ },
|
|
40
|
-
|
|
41
31
|
/***/ "@tsparticles/engine"
|
|
42
32
|
/*!*********************************************************************************************************************************!*\
|
|
43
33
|
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
@@ -56,6 +46,16 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
56
46
|
|
|
57
47
|
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
58
48
|
|
|
49
|
+
/***/ },
|
|
50
|
+
|
|
51
|
+
/***/ "./dist/browser/index.js"
|
|
52
|
+
/*!*******************************!*\
|
|
53
|
+
!*** ./dist/browser/index.js ***!
|
|
54
|
+
\*******************************/
|
|
55
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
56
|
+
|
|
57
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadInfectionPlugin: () => (/* binding */ loadInfectionPlugin)\n/* harmony export */ });\nasync function loadInfectionPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.0\");\n await engine.register(async (e)=>{\n const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin }] = 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_InfectionPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./InfectionPlugin.js */ \"./dist/browser/InfectionPlugin.js\"))\n ]);\n ensureInteractivityPluginLoaded(e);\n e.addPlugin(new InfectionPlugin());\n e.addInteractor?.(\"particlesInfection\", async (container)=>{\n const { ParticlesInfecter } = await __webpack_require__.e(/*! import() */ \"dist_browser_ParticlesInfecter_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./ParticlesInfecter.js */ \"./dist/browser/ParticlesInfecter.js\"));\n return new ParticlesInfecter(container);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-infection/./dist/browser/index.js?\n}");
|
|
58
|
+
|
|
59
59
|
/***/ }
|
|
60
60
|
|
|
61
61
|
/******/ });
|
|
@@ -70,12 +70,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
70
70
|
/******/ if (cachedModule !== undefined) {
|
|
71
71
|
/******/ return cachedModule.exports;
|
|
72
72
|
/******/ }
|
|
73
|
-
/******/ // Check if module exists (development only)
|
|
74
|
-
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
75
|
-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
76
|
-
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
77
|
-
/******/ throw e;
|
|
78
|
-
/******/ }
|
|
79
73
|
/******/ // Create a new module (and put it into the cache)
|
|
80
74
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
81
75
|
/******/ // no module.id needed
|
|
@@ -84,6 +78,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
84
78
|
/******/ };
|
|
85
79
|
/******/
|
|
86
80
|
/******/ // Execute the module function
|
|
81
|
+
/******/ if (!(moduleId in __webpack_modules__)) {
|
|
82
|
+
/******/ delete __webpack_module_cache__[moduleId];
|
|
83
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
84
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
85
|
+
/******/ throw e;
|
|
86
|
+
/******/ }
|
|
87
87
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
88
88
|
/******/
|
|
89
89
|
/******/ // Return the exports of the module
|
|
@@ -158,6 +158,18 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
158
158
|
/******/ };
|
|
159
159
|
/******/ })();
|
|
160
160
|
/******/
|
|
161
|
+
/******/ /* webpack/runtime/global */
|
|
162
|
+
/******/ (() => {
|
|
163
|
+
/******/ __webpack_require__.g = (function() {
|
|
164
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
165
|
+
/******/ try {
|
|
166
|
+
/******/ return this || new Function('return this')();
|
|
167
|
+
/******/ } catch (e) {
|
|
168
|
+
/******/ if (typeof window === 'object') return window;
|
|
169
|
+
/******/ }
|
|
170
|
+
/******/ })();
|
|
171
|
+
/******/ })();
|
|
172
|
+
/******/
|
|
161
173
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
162
174
|
/******/ (() => {
|
|
163
175
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
@@ -222,8 +234,8 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
222
234
|
/******/ /* webpack/runtime/publicPath */
|
|
223
235
|
/******/ (() => {
|
|
224
236
|
/******/ var scriptUrl;
|
|
225
|
-
/******/ if (
|
|
226
|
-
/******/ var document =
|
|
237
|
+
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
238
|
+
/******/ var document = __webpack_require__.g.document;
|
|
227
239
|
/******/ if (!scriptUrl && document) {
|
|
228
240
|
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
|
|
229
241
|
/******/ 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,n,o={303(e){e.exports=t},702(t){t.exports=e}},a={};function c(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return o[e](r,r.exports,c),r.exports}c.m=o,l=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.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);c.r(r);var i={};s=s||[null,l({}),l([]),l(l)];for(var n=2&t&&e;("object"==typeof n||"function"==typeof n)&&!~s.indexOf(n);n=l(n))Object.getOwnPropertyNames(n).forEach(t=>i[t]=()=>e[t]);return i.default=()=>e,c.d(r,i),r},c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((t,r)=>(c.f[r](e,t),t),[])),c.u=e=>""+e+".min.js",c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p={},c.l=(e,t,r,i)=>{if(p[e])return void p[e].push(t);if(void 0!==r)for(var n,o,a=document.getElementsByTagName("script"),s=0;s<a.length;s++){var l=a[s];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="@tsparticles/plugin-infection:"+r){n=l;break}}n||(o=!0,(n=document.createElement("script")).charset="utf-8",c.nc&&n.setAttribute("nonce",c.nc),n.setAttribute("data-webpack","@tsparticles/plugin-infection:"+r),n.src=e),p[e]=[t];var u=(t,r)=>{n.onerror=n.onload=null,clearTimeout(f);var i=p[e];if(delete p[e],n.parentNode&&n.parentNode.removeChild(n),i&&i.forEach(e=>e(r)),t)return t(r)},f=setTimeout(u.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=u.bind(null,n.onerror),n.onload=u.bind(null,n.onload),o&&document.head.appendChild(n)},c.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.g.importScripts&&(u=c.g.location+"");var s,l,p,u,f=c.g.document;if(!u&&f&&(f.currentScript&&"SCRIPT"===f.currentScript.tagName.toUpperCase()&&(u=f.currentScript.src),!u)){var d=f.getElementsByTagName("script");if(d.length)for(var b=d.length-1;b>-1&&(!u||!/^http(s?):/.test(u));)u=d[b--].src}if(!u)throw Error("Automatic publicPath is not supported in this browser");c.p=u=u.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r={587:0},c.f.j=(e,t)=>{var i=c.o(r,e)?r[e]:void 0;if(0!==i)if(i)t.push(i[2]);else{var n=new Promise((t,n)=>i=r[e]=[t,n]);t.push(i[2]=n);var o=c.p+c.u(e),a=Error();c.l(o,t=>{if(c.o(r,e)&&(0!==(i=r[e])&&(r[e]=void 0),i)){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;a.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+n+": "+o+")",a.name="ChunkLoadError",a.type=n,a.request=o,i[1](a)}},"chunk-"+e,e)}},i=(e,t)=>{var i,n,[o,a,s]=t,l=0;if(o.some(e=>0!==r[e])){for(i in a)c.o(a,i)&&(c.m[i]=a[i]);s&&s(c)}for(e&&e(t);l<o.length;l++)n=o[l],c.o(r,n)&&r[n]&&r[n][0](),r[n]=0},(n=this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).forEach(i.bind(null,0)),n.push=i.bind(null,n.push.bind(n));var g={};async function h(e){e.checkVersion("4.0.0-beta.0"),await e.register(async e=>{let[{ensureInteractivityPluginLoaded:t},{InfectionPlugin:r}]=await Promise.all([Promise.resolve().then(c.t.bind(c,702,19)),c.e(392).then(c.bind(c,392))]);t(e),e.addPlugin(new r),e.addInteractor?.("particlesInfection",async e=>{let{ParticlesInfecter:t}=await c.e(91).then(c.bind(c,91));return new t(e)})})}return c.r(g),c.d(g,{loadInfectionPlugin:()=>h}),g})());
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Container, IContainerPlugin, IPlugin, RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import type { IInfectionOptions, InfectionOptions } from "./Types.js";
|
|
3
3
|
export declare class InfectionPlugin implements IPlugin {
|
|
4
|
-
readonly id
|
|
5
|
-
constructor();
|
|
4
|
+
readonly id = "infection";
|
|
6
5
|
getPlugin(container: Container): Promise<IContainerPlugin>;
|
|
7
6
|
loadOptions(_container: Container, options: InfectionOptions, source?: RecursivePartial<IInfectionOptions>): void;
|
|
8
7
|
needsPlugin(options?: RecursivePartial<IInfectionOptions>): boolean;
|
|
@@ -2,7 +2,9 @@ import { type IDelta } from "@tsparticles/engine";
|
|
|
2
2
|
import { type IInteractivityData, ParticlesInteractorBase } from "@tsparticles/plugin-interactivity";
|
|
3
3
|
import type { InfectableContainer, InfectableParticle } from "./Types.js";
|
|
4
4
|
export declare class ParticlesInfecter extends ParticlesInteractorBase<InfectableContainer> {
|
|
5
|
+
private _maxDistance;
|
|
5
6
|
constructor(container: InfectableContainer);
|
|
7
|
+
get maxDistance(): number;
|
|
6
8
|
clear(): void;
|
|
7
9
|
init(): void;
|
|
8
10
|
interact(p1: InfectableParticle, _interactivityData: IInteractivityData, delta: IDelta): void;
|
package/umd/Infecter.js
CHANGED
|
@@ -13,28 +13,8 @@
|
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const minStage = 0, minDuration = 0;
|
|
15
15
|
class Infecter {
|
|
16
|
+
_container;
|
|
16
17
|
constructor(container) {
|
|
17
|
-
this._nextInfectionStage = particle => {
|
|
18
|
-
const infectionOptions = this._container.actualOptions.infection, { infection } = particle;
|
|
19
|
-
if (!infectionOptions || !infection) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const stagesCount = infectionOptions.stages.length;
|
|
23
|
-
if (stagesCount <= minStage || infection.stage === undefined) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
infection.time = 0;
|
|
27
|
-
if (stagesCount <= ++infection.stage) {
|
|
28
|
-
if (infectionOptions.cure) {
|
|
29
|
-
delete infection.stage;
|
|
30
|
-
delete infection.time;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
infection.stage = 0;
|
|
34
|
-
infection.time = 0;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
18
|
this._container = container;
|
|
39
19
|
}
|
|
40
20
|
startInfection(particle, stage) {
|
|
@@ -105,6 +85,27 @@
|
|
|
105
85
|
infection.stage = stage;
|
|
106
86
|
infection.time = 0;
|
|
107
87
|
}
|
|
88
|
+
_nextInfectionStage = particle => {
|
|
89
|
+
const infectionOptions = this._container.actualOptions.infection, { infection } = particle;
|
|
90
|
+
if (!infectionOptions || !infection) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const stagesCount = infectionOptions.stages.length;
|
|
94
|
+
if (stagesCount <= minStage || infection.stage === undefined) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
infection.time = 0;
|
|
98
|
+
if (stagesCount <= ++infection.stage) {
|
|
99
|
+
if (infectionOptions.cure) {
|
|
100
|
+
delete infection.stage;
|
|
101
|
+
delete infection.time;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
infection.stage = 0;
|
|
105
|
+
infection.time = 0;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
108
109
|
}
|
|
109
110
|
exports.Infecter = Infecter;
|
|
110
111
|
});
|
package/umd/InfectionPlugin.js
CHANGED
|
@@ -46,9 +46,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
46
46
|
exports.InfectionPlugin = void 0;
|
|
47
47
|
const Infection_js_1 = require("./Options/Classes/Infection.js");
|
|
48
48
|
class InfectionPlugin {
|
|
49
|
-
|
|
50
|
-
this.id = "infection";
|
|
51
|
-
}
|
|
49
|
+
id = "infection";
|
|
52
50
|
async getPlugin(container) {
|
|
53
51
|
const { InfectionPluginInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./InfectionPluginInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./InfectionPluginInstance.js"], resolve_1, reject_1); }).then(__importStar));
|
|
54
52
|
return new InfectionPluginInstance(container);
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
const Infecter_js_1 = require("./Infecter.js");
|
|
15
15
|
const minStage = 0;
|
|
16
16
|
class InfectionPluginInstance {
|
|
17
|
+
_container;
|
|
17
18
|
constructor(container) {
|
|
18
19
|
this._container = container;
|
|
19
20
|
this._container.infecter = new Infecter_js_1.Infecter(this._container);
|
|
@@ -39,8 +40,7 @@
|
|
|
39
40
|
const infP = p;
|
|
40
41
|
infP.infection ??= {};
|
|
41
42
|
return infP.infection.stage === undefined;
|
|
42
|
-
});
|
|
43
|
-
const infected = (0, engine_1.itemFromArray)(notInfected);
|
|
43
|
+
}), infected = (0, engine_1.itemFromArray)(notInfected);
|
|
44
44
|
if (!infected) {
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
exports.InfectionStage = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
class InfectionStage {
|
|
15
|
+
color;
|
|
16
|
+
duration;
|
|
17
|
+
infectedStage;
|
|
18
|
+
radius;
|
|
19
|
+
rate;
|
|
15
20
|
constructor() {
|
|
16
21
|
this.color = new engine_1.OptionsColor();
|
|
17
22
|
this.color.value = "#ff0000";
|
package/umd/ParticlesInfecter.js
CHANGED
|
@@ -14,8 +14,13 @@
|
|
|
14
14
|
const plugin_interactivity_1 = require("@tsparticles/plugin-interactivity");
|
|
15
15
|
const minStagesCount = 1;
|
|
16
16
|
class ParticlesInfecter extends plugin_interactivity_1.ParticlesInteractorBase {
|
|
17
|
+
_maxDistance;
|
|
17
18
|
constructor(container) {
|
|
18
19
|
super(container);
|
|
20
|
+
this._maxDistance = 0;
|
|
21
|
+
}
|
|
22
|
+
get maxDistance() {
|
|
23
|
+
return this._maxDistance;
|
|
19
24
|
}
|
|
20
25
|
clear() {
|
|
21
26
|
}
|
|
@@ -38,7 +43,8 @@
|
|
|
38
43
|
if (!infectionStage1) {
|
|
39
44
|
return;
|
|
40
45
|
}
|
|
41
|
-
|
|
46
|
+
this._maxDistance = Math.max(this._maxDistance, infectionStage1.radius);
|
|
47
|
+
const pxRatio = container.retina.pixelRatio, radius = p1.getRadius() * engine_1.double + infectionStage1.radius * pxRatio, pos = p1.getPosition(), infectedStage1 = infectionStage1.infectedStage ?? p1.infection.stage, query = container.particles.grid.queryCircle(pos, radius), infections = infectionStage1.rate, neighbors = query.length;
|
|
42
48
|
for (const p2 of query) {
|
|
43
49
|
const infP2 = p2;
|
|
44
50
|
if (infP2 === p1 ||
|
package/umd/index.js
CHANGED
|
@@ -45,10 +45,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
46
|
exports.loadInfectionPlugin = loadInfectionPlugin;
|
|
47
47
|
async function loadInfectionPlugin(engine) {
|
|
48
|
-
engine.checkVersion("4.0.0-
|
|
48
|
+
engine.checkVersion("4.0.0-beta.0");
|
|
49
49
|
await engine.register(async (e) => {
|
|
50
|
-
const {
|
|
51
|
-
|
|
50
|
+
const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
|
|
51
|
+
__syncRequire ? Promise.resolve().then(() => __importStar(require("@tsparticles/plugin-interactivity"))) : new Promise((resolve_1, reject_1) => { require(["@tsparticles/plugin-interactivity"], resolve_1, reject_1); }).then(__importStar),
|
|
52
|
+
__syncRequire ? Promise.resolve().then(() => __importStar(require("./InfectionPlugin.js"))) : new Promise((resolve_2, reject_2) => { require(["./InfectionPlugin.js"], resolve_2, reject_2); }).then(__importStar),
|
|
53
|
+
]);
|
|
54
|
+
ensureInteractivityPluginLoaded(e);
|
|
52
55
|
e.addPlugin(new InfectionPlugin());
|
|
53
56
|
e.addInteractor?.("particlesInfection", async (container) => {
|
|
54
57
|
const { ParticlesInfecter } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./ParticlesInfecter.js"))) : new Promise((resolve_3, reject_3) => { require(["./ParticlesInfecter.js"], resolve_3, reject_3); }).then(__importStar));
|
package/249.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 249.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[249],{249(e,t,n){n.d(t,{ParticlesInfecter:()=>a});var i=n(303),s=n(702);class a extends s.ParticlesInteractorBase{constructor(e){super(e)}clear(){}init(){}interact(e,t,n){const s=this.container.infecter;if(!s)return;if(s.updateInfection(e,n.value),void 0===e.infection?.stage)return;const a=this.container,c=a.actualOptions.infection;if(!c?.enable||c.stages.length<1)return;const o=c.stages[e.infection.stage];if(!o)return;const r=a.retina.pixelRatio,f=e.getRadius()*i.double+o.radius*r,g=e.getPosition(),u=o.infectedStage??e.infection.stage,l=a.particles.quadTree.queryCircle(g,f),d=o.rate,p=l.length;for(const t of l){const n=t;if(!(n===e||n.destroyed||n.spawning||void 0!==n.infection?.stage&&n.infection.stage===e.infection.stage||(0,i.getRandom)()>=d/p))if(void 0===n.infection?.stage)s.startInfection(n,u);else if(n.infection.stage<e.infection.stage)s.updateInfectionStage(n,u);else if(n.infection.stage>e.infection.stage){const t=c.stages[n.infection.stage];if(!t)continue;const i=t.infectedStage??n.infection.stage;s.updateInfectionStage(e,i)}}}isEnabled(){return this.container.actualOptions.infection?.enable??!1}reset(){}}}}]);
|
package/249.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Infection Plugin v4.0.0-alpha.5 by Matteo Bruni */
|
package/713.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 713.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[713],{713(i,t,e){e.d(t,{InfectionPlugin:()=>a});var n=e(303);class s{constructor(){this.color=new n.OptionsColor,this.color.value="#ff0000",this.radius=0,this.rate=1}load(i){(0,n.isNull)(i)||(void 0!==i.color&&(this.color=n.OptionsColor.create(this.color,i.color)),this.duration=i.duration,this.infectedStage=i.infectedStage,void 0!==i.radius&&(this.radius=i.radius),void 0!==i.rate&&(this.rate=i.rate))}}class o{constructor(){this.cure=!1,this.delay=0,this.enable=!1,this.infections=0,this.stages=[]}load(i){(0,n.isNull)(i)||(void 0!==i.cure&&(this.cure=i.cure),void 0!==i.delay&&(this.delay=i.delay),void 0!==i.enable&&(this.enable=i.enable),void 0!==i.infections&&(this.infections=i.infections),void 0!==i.stages&&(this.stages=i.stages.map((i=>{const t=new s;return t.load(i),t}))))}}class a{constructor(){this.id="infection"}async getPlugin(i){const{InfectionPluginInstance:t}=await e.e(835).then(e.bind(e,835));return new t(i)}loadOptions(i,t,e){if(!this.needsPlugin(t)&&!this.needsPlugin(e))return;let n=t.infection;void 0===n?.load&&(t.infection=n=new o),n.load(e?.infection)}needsPlugin(i){return i?.infection?.enable??!1}}}}]);
|
package/713.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Infection Plugin v4.0.0-alpha.5 by Matteo Bruni */
|
package/835.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 835.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[835],{835(t,e,i){i.d(e,{InfectionPluginInstance:()=>s});var n=i(303);class o{constructor(t){this._nextInfectionStage=t=>{const e=this._container.actualOptions.infection,{infection:i}=t;if(!e||!i)return;const n=e.stages.length;n<=0||void 0===i.stage||(i.time=0,n<=++i.stage&&(e.cure?(delete i.stage,delete i.time):(i.stage=0,i.time=0)))},this._container=t}startInfection(t,e){const i=this._container.actualOptions.infection,{infection:n}=t;if(!i||!n)return;e>i.stages.length||e<0||(n.delay=0,n.delayStage=e)}updateInfection(t,e){const i=this._container.actualOptions.infection,{infection:o}=t;if(!i||!o)return;const s=i.stages,a=s.length;if(void 0!==o.delay&&void 0!==o.delayStage){const t=o.delayStage;if(t>a||t<0)return;o.delay>=i.delay*n.millisecondsToSeconds?(o.stage=t,o.time=0,delete o.delay,delete o.delayStage):o.delay+=e}else delete o.delay,delete o.delayStage;if(void 0!==o.stage&&void 0!==o.time){const i=s[o.stage];void 0!==i?.duration&&i.duration>=0&&o.time>i.duration*n.millisecondsToSeconds?this._nextInfectionStage(t):o.time+=e}else delete o.stage,delete o.time}updateInfectionStage(t,e){const i=this._container.actualOptions,{infection:n}=t;if(!i.infection||!n)return;e>i.infection.stages.length||e<0||void 0!==n.stage&&n.stage>e||(n.stage=e,n.time=0)}}class s{constructor(t){this._container=t,this._container.infecter=new o(this._container)}particleFillColor(t){const e=this._container.actualOptions;if(!t.infection||!e.infection)return;const i=t.infection.stage,n=e.infection.stages;return void 0===i?void 0:n[i]?.color}particleStrokeColor(t){return this.particleFillColor(t)}particlesSetup(){const t=this._container.actualOptions;if(t.infection)for(let e=0;e<t.infection.infections;e++){const t=this._container.particles.filter((t=>{const e=t;return e.infection??={},void 0===e.infection.stage})),e=(0,n.itemFromArray)(t);e&&this._container.infecter?.startInfection(e,0)}}}}}]);
|
package/835.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Infection Plugin v4.0.0-alpha.5 by Matteo Bruni */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Infection Plugin v4.0.0-alpha.5 by Matteo Bruni */
|