@tsparticles/plugin-infection 4.0.0-beta.0 → 4.0.0-beta.10
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/{800.min.js → 707.min.js} +1 -1
- package/85.min.js +1 -0
- package/974.min.js +1 -0
- package/README.md +27 -0
- package/browser/index.js +4 -4
- package/cjs/index.js +4 -4
- package/dist_browser_InfectionPluginInstance_js.js +1 -1
- package/dist_browser_InfectionPlugin_js.js +1 -1
- package/dist_browser_ParticlesInfecter_js.js +1 -1
- package/esm/index.js +4 -4
- package/package.json +5 -6
- package/report.html +84 -29
- package/tsparticles.plugin.infection.js +2 -2
- package/tsparticles.plugin.infection.min.js +2 -2
- package/392.min.js +0 -1
- package/91.min.js +0 -1
- package/umd/Infecter.js +0 -111
- package/umd/InfectionPlugin.js +0 -69
- package/umd/InfectionPluginInstance.js +0 -52
- package/umd/Options/Classes/Infection.js +0 -55
- package/umd/Options/Classes/InfectionStage.js +0 -44
- package/umd/Options/Interfaces/IInfection.js +0 -12
- package/umd/Options/Interfaces/IInfectionStage.js +0 -12
- package/umd/ParticlesInfecter.js +0 -80
- package/umd/Types.js +0 -12
- package/umd/index.js +0 -62
|
@@ -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([[707],{707(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/85.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[85],{85(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(707).then(t.bind(t,707));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}}}}]);
|
package/974.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[974],{974(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(){}}}}]);
|
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/tsparticles/tsparticles) plugin for particles infection simulation effect.
|
|
10
10
|
|
|
11
|
+
## Quick checklist
|
|
12
|
+
|
|
13
|
+
1. Install `@tsparticles/engine` (or use the CDN bundle below)
|
|
14
|
+
2. Call the package loader function(s) before `tsParticles.load(...)`
|
|
15
|
+
3. Apply the package options in your `tsParticles.load(...)` config
|
|
16
|
+
|
|
11
17
|
## How to use it
|
|
12
18
|
|
|
13
19
|
### CDN / Vanilla JS / jQuery
|
|
@@ -77,3 +83,24 @@ import { loadInfectionPlugin } from "@tsparticles/plugin-infection";
|
|
|
77
83
|
await loadInfectionPlugin(tsParticles);
|
|
78
84
|
})();
|
|
79
85
|
```
|
|
86
|
+
|
|
87
|
+
## Option mapping
|
|
88
|
+
|
|
89
|
+
- Primary options key: `infection`
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"infection": {}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Common pitfalls
|
|
98
|
+
|
|
99
|
+
- Calling `tsParticles.load(...)` before `loadInteractivityPlugin(...)`
|
|
100
|
+
- Verify required peer packages before enabling advanced options
|
|
101
|
+
- Change one option group at a time to isolate regressions quickly
|
|
102
|
+
|
|
103
|
+
## Related docs
|
|
104
|
+
|
|
105
|
+
- All packages catalog: <https://github.com/tsparticles/tsparticles>
|
|
106
|
+
- Main docs: <https://particles.js.org/docs/>
|
package/browser/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export async function loadInfectionPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(async (e) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-interactivity"),
|
|
6
6
|
import("./InfectionPlugin.js"),
|
|
7
7
|
]);
|
|
8
8
|
ensureInteractivityPluginLoaded(e);
|
|
9
|
-
e.addPlugin(new InfectionPlugin());
|
|
10
|
-
e.addInteractor?.("particlesInfection", async (container) => {
|
|
9
|
+
e.pluginManager.addPlugin(new InfectionPlugin());
|
|
10
|
+
e.pluginManager.addInteractor?.("particlesInfection", async (container) => {
|
|
11
11
|
const { ParticlesInfecter } = await import("./ParticlesInfecter.js");
|
|
12
12
|
return new ParticlesInfecter(container);
|
|
13
13
|
});
|
package/cjs/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export async function loadInfectionPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(async (e) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-interactivity"),
|
|
6
6
|
import("./InfectionPlugin.js"),
|
|
7
7
|
]);
|
|
8
8
|
ensureInteractivityPluginLoaded(e);
|
|
9
|
-
e.addPlugin(new InfectionPlugin());
|
|
10
|
-
e.addInteractor?.("particlesInfection", async (container) => {
|
|
9
|
+
e.pluginManager.addPlugin(new InfectionPlugin());
|
|
10
|
+
e.pluginManager.addInteractor?.("particlesInfection", async (container) => {
|
|
11
11
|
const { ParticlesInfecter } = await import("./ParticlesInfecter.js");
|
|
12
12
|
return new ParticlesInfecter(container);
|
|
13
13
|
});
|
package/esm/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export async function loadInfectionPlugin(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(async (e) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const [{ ensureInteractivityPluginLoaded }, { InfectionPlugin },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-interactivity"),
|
|
6
6
|
import("./InfectionPlugin.js"),
|
|
7
7
|
]);
|
|
8
8
|
ensureInteractivityPluginLoaded(e);
|
|
9
|
-
e.addPlugin(new InfectionPlugin());
|
|
10
|
-
e.addInteractor?.("particlesInfection", async (container) => {
|
|
9
|
+
e.pluginManager.addPlugin(new InfectionPlugin());
|
|
10
|
+
e.pluginManager.addInteractor?.("particlesInfection", async (container) => {
|
|
11
11
|
const { ParticlesInfecter } = await import("./ParticlesInfecter.js");
|
|
12
12
|
return new ParticlesInfecter(container);
|
|
13
13
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-infection",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "tsParticles infection plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -94,14 +94,13 @@
|
|
|
94
94
|
"browser": "./browser/index.js",
|
|
95
95
|
"import": "./esm/index.js",
|
|
96
96
|
"require": "./cjs/index.js",
|
|
97
|
-
"
|
|
98
|
-
"default": "./cjs/index.js"
|
|
97
|
+
"default": "./esm/index.js"
|
|
99
98
|
},
|
|
100
99
|
"./package.json": "./package.json"
|
|
101
100
|
},
|
|
102
|
-
"
|
|
103
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
104
|
-
"@tsparticles/plugin-interactivity": "4.0.0-beta.
|
|
101
|
+
"peerDependencies": {
|
|
102
|
+
"@tsparticles/engine": "4.0.0-beta.10",
|
|
103
|
+
"@tsparticles/plugin-interactivity": "4.0.0-beta.10"
|
|
105
104
|
},
|
|
106
105
|
"publishConfig": {
|
|
107
106
|
"access": "public"
|