@tsparticles/plugin-infection 4.0.0-alpha.23 → 4.0.0-alpha.25
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/{926.min.js → 200.min.js} +1 -1
- package/492.min.js +1 -0
- package/{901.min.js → 929.min.js} +1 -1
- package/browser/ParticlesInfecter.js +7 -1
- package/browser/index.js +1 -1
- package/cjs/ParticlesInfecter.js +7 -1
- package/cjs/index.js +1 -1
- package/dist_browser_InfectionPluginInstance_js.js +1 -1
- package/dist_browser_InfectionPlugin_js.js +1 -1
- package/dist_browser_ParticlesInfecter_js.js +2 -2
- package/esm/ParticlesInfecter.js +7 -1
- package/esm/index.js +1 -1
- package/package.json +3 -3
- package/report.html +1 -1
- package/tsparticles.plugin.infection.js +2 -2
- package/tsparticles.plugin.infection.min.js +1 -1
- package/types/ParticlesInfecter.d.ts +2 -0
- package/umd/ParticlesInfecter.js +7 -1
- package/umd/index.js +1 -1
- package/202.min.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[200],{200(e,t,i){i.d(t,{InfectionPluginInstance:()=>o});var n=i(303);class a{_container;constructor(e){this._container=e}startInfection(e,t){let i=this._container.actualOptions.infection,{infection:n}=e;!i||!n||t>i.stages.length||t<0||(n.delay=0,n.delayStage=t)}updateInfection(e,t){let i=this._container.actualOptions.infection,{infection:a}=e;if(!i||!a)return;let o=i.stages,s=o.length;if(void 0!==a.delay&&void 0!==a.delayStage){let e=a.delayStage;if(e>s||e<0)return;a.delay>=i.delay*n.millisecondsToSeconds?(a.stage=e,a.time=0,delete a.delay,delete a.delayStage):a.delay+=t}else delete a.delay,delete a.delayStage;if(void 0!==a.stage&&void 0!==a.time){let i=o[a.stage];i?.duration!==void 0&&i.duration>=0&&a.time>i.duration*n.millisecondsToSeconds?this._nextInfectionStage(e):a.time+=t}else delete a.stage,delete a.time}updateInfectionStage(e,t){let i=this._container.actualOptions,{infection:n}=e;!i.infection||!n||t>i.infection.stages.length||t<0||void 0!==n.stage&&n.stage>t||(n.stage=t,n.time=0)}_nextInfectionStage=e=>{let t=this._container.actualOptions.infection,{infection:i}=e;if(!t||!i)return;let n=t.stages.length;!(n<=0)&&void 0!==i.stage&&(i.time=0,n<=++i.stage&&(t.cure?(delete i.stage,delete i.time):(i.stage=0,i.time=0)))}}class o{_container;constructor(e){this._container=e,this._container.infecter=new a(this._container)}particleFillColor(e){let t=this._container.actualOptions;if(!e.infection||!t.infection)return;let i=e.infection.stage,n=t.infection.stages;return void 0===i?void 0:n[i]?.color}particleStrokeColor(e){return this.particleFillColor(e)}particlesSetup(){let e=this._container.actualOptions;if(e.infection)for(let t=0;t<e.infection.infections;t++){let e=this._container.particles.filter(e=>(e.infection??={},void 0===e.infection.stage)),t=(0,n.itemFromArray)(e);t&&this._container.infecter?.startInfection(t,0)}}}}}]);
|
package/492.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[492],{492(e,t,i){i.d(t,{ParticlesInfecter:()=>s});var n=i(303),a=i(702);class s extends a.ParticlesInteractorBase{_maxDistance;constructor(e){super(e),this._maxDistance=0}get maxDistance(){return this._maxDistance}clear(){}init(){}interact(e,t,i){let a=this.container.infecter;if(!a||(a.updateInfection(e,i.value),e.infection?.stage===void 0))return;let s=this.container,c=s.actualOptions.infection;if(!c?.enable||c.stages.length<1)return;let o=c.stages[e.infection.stage];if(!o)return;this._maxDistance=Math.max(this._maxDistance,o.radius);let r=s.retina.pixelRatio,f=e.getRadius()*n.double+o.radius*r,g=e.getPosition(),l=o.infectedStage??e.infection.stage,u=s.particles.grid.queryCircle(g,f),d=o.rate,p=u.length;for(let t of u)if(!(t===e||t.destroyed||t.spawning||t.infection?.stage!==void 0&&t.infection.stage===e.infection.stage||(0,n.getRandom)()>=d/p)){if(t.infection?.stage===void 0)a.startInfection(t,l);else if(t.infection.stage<e.infection.stage)a.updateInfectionStage(t,l);else if(t.infection.stage>e.infection.stage){let i=c.stages[t.infection.stage];if(!i)continue;let n=i.infectedStage??t.infection.stage;a.updateInfectionStage(e,n)}}}isEnabled(){return this.container.actualOptions.infection?.enable??!1}reset(){}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[929],{929(i,e,t){t.r(e),t.d(e,{InfectionPlugin:()=>a});var s=t(303);class n{color;duration;infectedStage;radius;rate;constructor(){this.color=new s.OptionsColor,this.color.value="#ff0000",this.radius=0,this.rate=1}load(i){(0,s.isNull)(i)||(void 0!==i.color&&(this.color=s.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{cure;delay;enable;infections;stages;constructor(){this.cure=!1,this.delay=0,this.enable=!1,this.infections=0,this.stages=[]}load(i){(0,s.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=>{let e=new n;return e.load(i),e})))}}class a{id="infection";async getPlugin(i){let{InfectionPluginInstance:e}=await t.e(200).then(t.bind(t,200));return new e(i)}loadOptions(i,e,t){if(!this.needsPlugin(e)&&!this.needsPlugin(t))return;let s=e.infection;s?.load===void 0&&(e.infection=s=new o),s.load(t?.infection)}needsPlugin(i){return i?.infection?.enable??!1}}}}]);
|
|
@@ -2,8 +2,13 @@ import { double, getRandom } from "@tsparticles/engine";
|
|
|
2
2
|
import { ParticlesInteractorBase } from "@tsparticles/plugin-interactivity";
|
|
3
3
|
const minStagesCount = 1;
|
|
4
4
|
export class ParticlesInfecter extends ParticlesInteractorBase {
|
|
5
|
+
_maxDistance;
|
|
5
6
|
constructor(container) {
|
|
6
7
|
super(container);
|
|
8
|
+
this._maxDistance = 0;
|
|
9
|
+
}
|
|
10
|
+
get maxDistance() {
|
|
11
|
+
return this._maxDistance;
|
|
7
12
|
}
|
|
8
13
|
clear() {
|
|
9
14
|
}
|
|
@@ -26,7 +31,8 @@ export class ParticlesInfecter extends ParticlesInteractorBase {
|
|
|
26
31
|
if (!infectionStage1) {
|
|
27
32
|
return;
|
|
28
33
|
}
|
|
29
|
-
|
|
34
|
+
this._maxDistance = Math.max(this._maxDistance, infectionStage1.radius);
|
|
35
|
+
const pxRatio = container.retina.pixelRatio, radius = p1.getRadius() * 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;
|
|
30
36
|
for (const p2 of query) {
|
|
31
37
|
const infP2 = p2;
|
|
32
38
|
if (infP2 === p1 ||
|
package/browser/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadInfectionPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.25");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
4
|
const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-interactivity"),
|
package/cjs/ParticlesInfecter.js
CHANGED
|
@@ -2,8 +2,13 @@ import { double, getRandom } from "@tsparticles/engine";
|
|
|
2
2
|
import { ParticlesInteractorBase } from "@tsparticles/plugin-interactivity";
|
|
3
3
|
const minStagesCount = 1;
|
|
4
4
|
export class ParticlesInfecter extends ParticlesInteractorBase {
|
|
5
|
+
_maxDistance;
|
|
5
6
|
constructor(container) {
|
|
6
7
|
super(container);
|
|
8
|
+
this._maxDistance = 0;
|
|
9
|
+
}
|
|
10
|
+
get maxDistance() {
|
|
11
|
+
return this._maxDistance;
|
|
7
12
|
}
|
|
8
13
|
clear() {
|
|
9
14
|
}
|
|
@@ -26,7 +31,8 @@ export class ParticlesInfecter extends ParticlesInteractorBase {
|
|
|
26
31
|
if (!infectionStage1) {
|
|
27
32
|
return;
|
|
28
33
|
}
|
|
29
|
-
|
|
34
|
+
this._maxDistance = Math.max(this._maxDistance, infectionStage1.radius);
|
|
35
|
+
const pxRatio = container.retina.pixelRatio, radius = p1.getRadius() * 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;
|
|
30
36
|
for (const p2 of query) {
|
|
31
37
|
const infP2 = p2;
|
|
32
38
|
if (infP2 === p1 ||
|
package/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadInfectionPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.25");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
4
|
const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-interactivity"),
|
|
@@ -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-alpha.
|
|
7
|
+
* v4.0.0-alpha.25
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
\*******************************************/
|
|
24
24
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
25
|
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ParticlesInfecter: () => (/* binding */ ParticlesInfecter)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\");\n\n\nconst minStagesCount = 1;\nclass ParticlesInfecter extends _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_1__.ParticlesInteractorBase {\n constructor(container){\n super(container);\n }\n clear() {}\n init() {}\n interact(p1, _interactivityData, delta) {\n const infecter = this.container.infecter;\n if (!infecter) {\n return;\n }\n infecter.updateInfection(p1, delta.value);\n if (p1.infection?.stage === undefined) {\n return;\n }\n const container = this.container, options = container.actualOptions, infectionOptions = options.infection;\n if (!infectionOptions?.enable || infectionOptions.stages.length < minStagesCount) {\n return;\n }\n const infectionStage1 = infectionOptions.stages[p1.infection.stage];\n if (!infectionStage1) {\n return;\n }\n const pxRatio = container.retina.pixelRatio, radius = p1.getRadius() * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double + infectionStage1.radius * pxRatio, pos = p1.getPosition(), infectedStage1 = infectionStage1.infectedStage ?? p1.infection.stage, query = container.particles.
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ParticlesInfecter: () => (/* binding */ ParticlesInfecter)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\");\n\n\nconst minStagesCount = 1;\nclass ParticlesInfecter extends _tsparticles_plugin_interactivity__WEBPACK_IMPORTED_MODULE_1__.ParticlesInteractorBase {\n _maxDistance;\n constructor(container){\n super(container);\n this._maxDistance = 0;\n }\n get maxDistance() {\n return this._maxDistance;\n }\n clear() {}\n init() {}\n interact(p1, _interactivityData, delta) {\n const infecter = this.container.infecter;\n if (!infecter) {\n return;\n }\n infecter.updateInfection(p1, delta.value);\n if (p1.infection?.stage === undefined) {\n return;\n }\n const container = this.container, options = container.actualOptions, infectionOptions = options.infection;\n if (!infectionOptions?.enable || infectionOptions.stages.length < minStagesCount) {\n return;\n }\n const infectionStage1 = infectionOptions.stages[p1.infection.stage];\n if (!infectionStage1) {\n return;\n }\n this._maxDistance = Math.max(this._maxDistance, infectionStage1.radius);\n const pxRatio = container.retina.pixelRatio, radius = p1.getRadius() * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.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;\n for (const p2 of query){\n const infP2 = p2;\n if (infP2 === p1 || infP2.destroyed || infP2.spawning || !(infP2.infection?.stage === undefined || infP2.infection.stage !== p1.infection.stage) || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() >= infections / neighbors) {\n continue;\n }\n if (infP2.infection?.stage === undefined) {\n infecter.startInfection(infP2, infectedStage1);\n } else if (infP2.infection.stage < p1.infection.stage) {\n infecter.updateInfectionStage(infP2, infectedStage1);\n } else if (infP2.infection.stage > p1.infection.stage) {\n const infectionStage2 = infectionOptions.stages[infP2.infection.stage];\n if (!infectionStage2) {\n continue;\n }\n const infectedStage2 = infectionStage2.infectedStage ?? infP2.infection.stage;\n infecter.updateInfectionStage(p1, infectedStage2);\n }\n }\n }\n isEnabled() {\n return this.container.actualOptions.infection?.enable ?? false;\n }\n reset() {}\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-infection/./dist/browser/ParticlesInfecter.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ }
|
|
29
29
|
|
package/esm/ParticlesInfecter.js
CHANGED
|
@@ -2,8 +2,13 @@ import { double, getRandom } from "@tsparticles/engine";
|
|
|
2
2
|
import { ParticlesInteractorBase } from "@tsparticles/plugin-interactivity";
|
|
3
3
|
const minStagesCount = 1;
|
|
4
4
|
export class ParticlesInfecter extends ParticlesInteractorBase {
|
|
5
|
+
_maxDistance;
|
|
5
6
|
constructor(container) {
|
|
6
7
|
super(container);
|
|
8
|
+
this._maxDistance = 0;
|
|
9
|
+
}
|
|
10
|
+
get maxDistance() {
|
|
11
|
+
return this._maxDistance;
|
|
7
12
|
}
|
|
8
13
|
clear() {
|
|
9
14
|
}
|
|
@@ -26,7 +31,8 @@ export class ParticlesInfecter extends ParticlesInteractorBase {
|
|
|
26
31
|
if (!infectionStage1) {
|
|
27
32
|
return;
|
|
28
33
|
}
|
|
29
|
-
|
|
34
|
+
this._maxDistance = Math.max(this._maxDistance, infectionStage1.radius);
|
|
35
|
+
const pxRatio = container.retina.pixelRatio, radius = p1.getRadius() * 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;
|
|
30
36
|
for (const p2 of query) {
|
|
31
37
|
const infP2 = p2;
|
|
32
38
|
if (infP2 === p1 ||
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadInfectionPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.25");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
4
|
const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-interactivity"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-infection",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.25",
|
|
4
4
|
"description": "tsParticles infection plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"./package.json": "./package.json"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@tsparticles/engine": "4.0.0-alpha.
|
|
104
|
-
"@tsparticles/plugin-interactivity": "4.0.0-alpha.
|
|
103
|
+
"@tsparticles/engine": "4.0.0-alpha.25",
|
|
104
|
+
"@tsparticles/plugin-interactivity": "4.0.0-alpha.25"
|
|
105
105
|
},
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
-
<title>@tsparticles/plugin-infection [
|
|
6
|
+
<title>@tsparticles/plugin-infection [21 Feb 2026 at 12:52]</title>
|
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv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
|
|
@@ -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-alpha.
|
|
7
|
+
* v4.0.0-alpha.25
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -54,7 +54,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
54
54
|
\*******************************/
|
|
55
55
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
56
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-alpha.
|
|
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-alpha.25\");\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
58
|
|
|
59
59
|
/***/ }
|
|
60
60
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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-alpha.
|
|
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-alpha.25"),await e.register(async e=>{let[{ensureInteractivityPluginLoaded:t},{InfectionPlugin:r}]=await Promise.all([Promise.resolve().then(c.t.bind(c,702,19)),c.e(929).then(c.bind(c,929))]);t(e),e.addPlugin(new r),e.addInteractor?.("particlesInfection",async e=>{let{ParticlesInfecter:t}=await c.e(492).then(c.bind(c,492));return new t(e)})})}return c.r(g),c.d(g,{loadInfectionPlugin:()=>h}),g})());
|
|
@@ -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/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,7 +45,7 @@ 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-alpha.
|
|
48
|
+
engine.checkVersion("4.0.0-alpha.25");
|
|
49
49
|
await engine.register(async (e) => {
|
|
50
50
|
const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
|
|
51
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),
|
package/202.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[202],{202(e,t,i){i.d(t,{ParticlesInfecter:()=>s});var n=i(303),a=i(702);class s extends a.ParticlesInteractorBase{constructor(e){super(e)}clear(){}init(){}interact(e,t,i){let a=this.container.infecter;if(!a||(a.updateInfection(e,i.value),e.infection?.stage===void 0))return;let s=this.container,c=s.actualOptions.infection;if(!c?.enable||c.stages.length<1)return;let o=c.stages[e.infection.stage];if(!o)return;let r=s.retina.pixelRatio,f=e.getRadius()*n.double+o.radius*r,l=e.getPosition(),g=o.infectedStage??e.infection.stage,u=s.particles.quadTree.queryCircle(l,f),d=o.rate,p=u.length;for(let t of u)if(!(t===e||t.destroyed||t.spawning||t.infection?.stage!==void 0&&t.infection.stage===e.infection.stage||(0,n.getRandom)()>=d/p)){if(t.infection?.stage===void 0)a.startInfection(t,g);else if(t.infection.stage<e.infection.stage)a.updateInfectionStage(t,g);else if(t.infection.stage>e.infection.stage){let i=c.stages[t.infection.stage];if(!i)continue;let n=i.infectedStage??t.infection.stage;a.updateInfectionStage(e,n)}}}isEnabled(){return this.container.actualOptions.infection?.enable??!1}reset(){}}}}]);
|