@tsparticles/plugin-infection 4.0.0-alpha.2 → 4.0.0-alpha.20
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/202.min.js +1 -0
- package/901.min.js +1 -0
- package/926.min.js +1 -0
- package/README.md +5 -0
- package/browser/Infecter.js +22 -21
- package/browser/InfectionPlugin.js +5 -7
- package/browser/{InfectionInstance.js → InfectionPluginInstance.js} +3 -3
- package/browser/Options/Classes/Infection.js +5 -0
- package/browser/Options/Classes/InfectionStage.js +5 -0
- package/browser/ParticlesInfecter.js +4 -3
- package/browser/index.js +9 -5
- package/cjs/Infecter.js +22 -21
- package/cjs/InfectionPlugin.js +5 -7
- package/cjs/{InfectionInstance.js → InfectionPluginInstance.js} +3 -3
- package/cjs/Options/Classes/Infection.js +5 -0
- package/cjs/Options/Classes/InfectionStage.js +5 -0
- package/cjs/ParticlesInfecter.js +4 -3
- package/cjs/index.js +9 -5
- package/dist_browser_InfectionPluginInstance_js.js +40 -0
- package/dist_browser_InfectionPlugin_js.js +4 -24
- package/dist_browser_ParticlesInfecter_js.js +2 -2
- package/esm/Infecter.js +22 -21
- package/esm/InfectionPlugin.js +5 -7
- package/esm/{InfectionInstance.js → InfectionPluginInstance.js} +3 -3
- package/esm/Options/Classes/Infection.js +5 -0
- package/esm/Options/Classes/InfectionStage.js +5 -0
- package/esm/ParticlesInfecter.js +4 -3
- package/esm/index.js +9 -5
- package/package.json +3 -2
- package/report.html +3 -3
- package/tsparticles.plugin.infection.js +55 -15
- package/tsparticles.plugin.infection.min.js +2 -2
- package/types/InfectionPlugin.d.ts +4 -6
- package/types/{InfectionInstance.d.ts → InfectionPluginInstance.d.ts} +1 -1
- package/types/ParticlesInfecter.d.ts +3 -2
- package/types/Types.d.ts +5 -4
- package/types/index.d.ts +1 -1
- package/umd/Infecter.js +22 -21
- package/umd/InfectionPlugin.js +40 -8
- package/umd/{InfectionInstance.js → InfectionPluginInstance.js} +5 -5
- package/umd/Options/Classes/Infection.js +5 -0
- package/umd/Options/Classes/InfectionStage.js +5 -0
- package/umd/ParticlesInfecter.js +6 -5
- package/umd/index.js +10 -6
- package/492.min.js +0 -2
- package/492.min.js.LICENSE.txt +0 -1
- package/796.min.js +0 -2
- package/796.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-alpha.
|
|
7
|
+
* v4.0.0-alpha.20
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -16,28 +16,18 @@
|
|
|
16
16
|
*/
|
|
17
17
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
18
18
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
19
|
-
module.exports = factory(require("@tsparticles/engine"));
|
|
19
|
+
module.exports = factory(require("@tsparticles/plugin-interactivity"), require("@tsparticles/engine"));
|
|
20
20
|
else if(typeof define === 'function' && define.amd)
|
|
21
|
-
define(["@tsparticles/engine"], factory);
|
|
21
|
+
define(["@tsparticles/plugin-interactivity", "@tsparticles/engine"], factory);
|
|
22
22
|
else {
|
|
23
|
-
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
23
|
+
var a = typeof exports === 'object' ? factory(require("@tsparticles/plugin-interactivity"), require("@tsparticles/engine")) : factory(root["window"], root["window"]);
|
|
24
24
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
25
25
|
}
|
|
26
|
-
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
|
|
26
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__, __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
|
|
27
27
|
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 */ });\nfunction loadInfectionPlugin(engine) {\n engine.checkVersion(\"4.0.0-alpha.2\");\n engine.register(async e => {\n const {\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 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"} ***!
|
|
@@ -46,6 +36,26 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
46
36
|
|
|
47
37
|
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
48
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
|
+
|
|
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-alpha.20\");\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
|
+
|
|
49
59
|
/***/ }
|
|
50
60
|
|
|
51
61
|
/******/ });
|
|
@@ -84,6 +94,36 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
84
94
|
/******/ __webpack_require__.m = __webpack_modules__;
|
|
85
95
|
/******/
|
|
86
96
|
/************************************************************************/
|
|
97
|
+
/******/ /* webpack/runtime/create fake namespace object */
|
|
98
|
+
/******/ (() => {
|
|
99
|
+
/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
|
|
100
|
+
/******/ var leafPrototypes;
|
|
101
|
+
/******/ // create a fake namespace object
|
|
102
|
+
/******/ // mode & 1: value is a module id, require it
|
|
103
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
104
|
+
/******/ // mode & 4: return value when already ns object
|
|
105
|
+
/******/ // mode & 16: return value when it's Promise-like
|
|
106
|
+
/******/ // mode & 8|1: behave like require
|
|
107
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
108
|
+
/******/ if(mode & 1) value = this(value);
|
|
109
|
+
/******/ if(mode & 8) return value;
|
|
110
|
+
/******/ if(typeof value === 'object' && value) {
|
|
111
|
+
/******/ if((mode & 4) && value.__esModule) return value;
|
|
112
|
+
/******/ if((mode & 16) && typeof value.then === 'function') return value;
|
|
113
|
+
/******/ }
|
|
114
|
+
/******/ var ns = Object.create(null);
|
|
115
|
+
/******/ __webpack_require__.r(ns);
|
|
116
|
+
/******/ var def = {};
|
|
117
|
+
/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
|
|
118
|
+
/******/ for(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {
|
|
119
|
+
/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
|
|
120
|
+
/******/ }
|
|
121
|
+
/******/ def['default'] = () => (value);
|
|
122
|
+
/******/ __webpack_require__.d(ns, def);
|
|
123
|
+
/******/ return ns;
|
|
124
|
+
/******/ };
|
|
125
|
+
/******/ })();
|
|
126
|
+
/******/
|
|
87
127
|
/******/ /* webpack/runtime/define property getters */
|
|
88
128
|
/******/ (() => {
|
|
89
129
|
/******/ // define getter functions for harmony exports
|
|
@@ -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-alpha.20"),await e.register(async e=>{let[{ensureInteractivityPluginLoaded:t},{InfectionPlugin:r}]=await Promise.all([Promise.resolve().then(c.t.bind(c,702,19)),c.e(901).then(c.bind(c,901))]);t(e),e.addPlugin(new r),e.addInteractor?.("particlesInfection",async e=>{let{ParticlesInfecter:t}=await c.e(202).then(c.bind(c,202));return new t(e)})})}return c.r(g),c.d(g,{loadInfectionPlugin:()=>h}),g})());
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { Container, IPlugin, RecursivePartial } from "@tsparticles/engine";
|
|
1
|
+
import type { Container, IContainerPlugin, IPlugin, RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import type { IInfectionOptions, InfectionOptions } from "./Types.js";
|
|
3
|
-
import { InfectionInstance } from "./InfectionInstance.js";
|
|
4
3
|
export declare class InfectionPlugin implements IPlugin {
|
|
5
|
-
readonly id
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
loadOptions(options: InfectionOptions, source?: RecursivePartial<IInfectionOptions>): void;
|
|
4
|
+
readonly id = "infection";
|
|
5
|
+
getPlugin(container: Container): Promise<IContainerPlugin>;
|
|
6
|
+
loadOptions(_container: Container, options: InfectionOptions, source?: RecursivePartial<IInfectionOptions>): void;
|
|
9
7
|
needsPlugin(options?: RecursivePartial<IInfectionOptions>): boolean;
|
|
10
8
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IContainerPlugin, type IOptionsColor, type Particle } from "@tsparticles/engine";
|
|
2
2
|
import type { InfectableContainer, InfectableParticle } from "./Types.js";
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class InfectionPluginInstance implements IContainerPlugin {
|
|
4
4
|
private readonly _container;
|
|
5
5
|
constructor(container: InfectableContainer);
|
|
6
6
|
particleFillColor(particle: InfectableParticle): string | IOptionsColor | undefined;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { type IDelta
|
|
1
|
+
import { type IDelta } from "@tsparticles/engine";
|
|
2
|
+
import { type IInteractivityData, ParticlesInteractorBase } from "@tsparticles/plugin-interactivity";
|
|
2
3
|
import type { InfectableContainer, InfectableParticle } from "./Types.js";
|
|
3
4
|
export declare class ParticlesInfecter extends ParticlesInteractorBase<InfectableContainer> {
|
|
4
5
|
constructor(container: InfectableContainer);
|
|
5
6
|
clear(): void;
|
|
6
7
|
init(): void;
|
|
7
|
-
interact(p1: InfectableParticle, delta: IDelta): void;
|
|
8
|
+
interact(p1: InfectableParticle, _interactivityData: IInteractivityData, delta: IDelta): void;
|
|
8
9
|
isEnabled(): boolean;
|
|
9
10
|
reset(): void;
|
|
10
11
|
}
|
package/types/Types.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IInteractivityOptions, InteractivityContainer, InteractivityOptions } from "@tsparticles/plugin-interactivity";
|
|
2
2
|
import type { IInfection } from "./Options/Interfaces/IInfection.js";
|
|
3
3
|
import type { Infecter } from "./Infecter.js";
|
|
4
4
|
import type { Infection } from "./Options/Classes/Infection.js";
|
|
5
|
+
import type { Particle } from "@tsparticles/engine";
|
|
5
6
|
export interface IParticleInfection {
|
|
6
7
|
delay?: number;
|
|
7
8
|
delayStage?: number;
|
|
8
9
|
stage?: number;
|
|
9
10
|
time?: number;
|
|
10
11
|
}
|
|
11
|
-
export type InfectableContainer =
|
|
12
|
+
export type InfectableContainer = InteractivityContainer & {
|
|
12
13
|
actualOptions: InfectionOptions;
|
|
13
14
|
infecter?: Infecter;
|
|
14
15
|
};
|
|
15
|
-
export type IInfectionOptions =
|
|
16
|
+
export type IInfectionOptions = IInteractivityOptions & {
|
|
16
17
|
infection: IInfection;
|
|
17
18
|
};
|
|
18
|
-
export type InfectionOptions =
|
|
19
|
+
export type InfectionOptions = InteractivityOptions & {
|
|
19
20
|
infection?: Infection;
|
|
20
21
|
};
|
|
21
22
|
export type InfectableParticle = Particle & {
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Engine } from "@tsparticles/engine";
|
|
2
|
-
export declare function loadInfectionPlugin(engine: Engine): void
|
|
2
|
+
export declare function loadInfectionPlugin(engine: Engine): Promise<void>;
|
|
3
3
|
export type * from "./Options/Interfaces/IInfection.js";
|
|
4
4
|
export type * from "./Options/Interfaces/IInfectionStage.js";
|
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
|
@@ -1,25 +1,57 @@
|
|
|
1
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
+
if (k2 === undefined) k2 = k;
|
|
3
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(o, k2, desc);
|
|
8
|
+
}) : (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
o[k2] = m[k];
|
|
11
|
+
}));
|
|
12
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
+
}) : function(o, v) {
|
|
15
|
+
o["default"] = v;
|
|
16
|
+
});
|
|
17
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
18
|
+
var ownKeys = function(o) {
|
|
19
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
20
|
+
var ar = [];
|
|
21
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
22
|
+
return ar;
|
|
23
|
+
};
|
|
24
|
+
return ownKeys(o);
|
|
25
|
+
};
|
|
26
|
+
return function (mod) {
|
|
27
|
+
if (mod && mod.__esModule) return mod;
|
|
28
|
+
var result = {};
|
|
29
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
30
|
+
__setModuleDefault(result, mod);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
1
34
|
(function (factory) {
|
|
2
35
|
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
36
|
var v = factory(require, exports);
|
|
4
37
|
if (v !== undefined) module.exports = v;
|
|
5
38
|
}
|
|
6
39
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "./Options/Classes/Infection.js"
|
|
40
|
+
define(["require", "exports", "./Options/Classes/Infection.js"], factory);
|
|
8
41
|
}
|
|
9
42
|
})(function (require, exports) {
|
|
10
43
|
"use strict";
|
|
44
|
+
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
11
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
46
|
exports.InfectionPlugin = void 0;
|
|
13
47
|
const Infection_js_1 = require("./Options/Classes/Infection.js");
|
|
14
|
-
const InfectionInstance_js_1 = require("./InfectionInstance.js");
|
|
15
48
|
class InfectionPlugin {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return Promise.resolve(new InfectionInstance_js_1.InfectionInstance(container));
|
|
49
|
+
id = "infection";
|
|
50
|
+
async getPlugin(container) {
|
|
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));
|
|
52
|
+
return new InfectionPluginInstance(container);
|
|
21
53
|
}
|
|
22
|
-
loadOptions(options, source) {
|
|
54
|
+
loadOptions(_container, options, source) {
|
|
23
55
|
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
|
24
56
|
return;
|
|
25
57
|
}
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.InfectionPluginInstance = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const Infecter_js_1 = require("./Infecter.js");
|
|
15
15
|
const minStage = 0;
|
|
16
|
-
class
|
|
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
|
}
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
exports.
|
|
51
|
+
exports.InfectionPluginInstance = InfectionPluginInstance;
|
|
52
52
|
});
|
|
@@ -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
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "@tsparticles/plugin-interactivity"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ParticlesInfecter = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const plugin_interactivity_1 = require("@tsparticles/plugin-interactivity");
|
|
15
|
+
const minStagesCount = 1;
|
|
16
|
+
class ParticlesInfecter extends plugin_interactivity_1.ParticlesInteractorBase {
|
|
16
17
|
constructor(container) {
|
|
17
18
|
super(container);
|
|
18
19
|
}
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
}
|
|
21
22
|
init() {
|
|
22
23
|
}
|
|
23
|
-
interact(p1, delta) {
|
|
24
|
+
interact(p1, _interactivityData, delta) {
|
|
24
25
|
const infecter = this.container.infecter;
|
|
25
26
|
if (!infecter) {
|
|
26
27
|
return;
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
if (!infectionStage1) {
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
|
-
const pxRatio = container.retina.pixelRatio, radius = p1.getRadius() * double + infectionStage1.radius * pxRatio, pos = p1.getPosition(), infectedStage1 = infectionStage1.infectedStage ?? p1.infection.stage, query = container.particles.quadTree.queryCircle(pos, radius), infections = infectionStage1.rate, neighbors = query.length;
|
|
41
|
+
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.quadTree.queryCircle(pos, radius), infections = infectionStage1.rate, neighbors = query.length;
|
|
41
42
|
for (const p2 of query) {
|
|
42
43
|
const infP2 = p2;
|
|
43
44
|
if (infP2 === p1 ||
|
package/umd/index.js
CHANGED
|
@@ -44,13 +44,17 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
44
44
|
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
46
|
exports.loadInfectionPlugin = loadInfectionPlugin;
|
|
47
|
-
function loadInfectionPlugin(engine) {
|
|
48
|
-
engine.checkVersion("4.0.0-alpha.
|
|
49
|
-
engine.register(async (e) => {
|
|
50
|
-
const {
|
|
47
|
+
async function loadInfectionPlugin(engine) {
|
|
48
|
+
engine.checkVersion("4.0.0-alpha.20");
|
|
49
|
+
await engine.register(async (e) => {
|
|
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);
|
|
51
55
|
e.addPlugin(new InfectionPlugin());
|
|
52
|
-
e.addInteractor("particlesInfection", async (container) => {
|
|
53
|
-
const { ParticlesInfecter } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./ParticlesInfecter.js"))) : new Promise((
|
|
56
|
+
e.addInteractor?.("particlesInfection", async (container) => {
|
|
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));
|
|
54
58
|
return new ParticlesInfecter(container);
|
|
55
59
|
});
|
|
56
60
|
});
|
package/492.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 492.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[492],{492(t,e,i){i.d(e,{InfectionPlugin:()=>r});var n=i(303);class o{constructor(){this.color=new n.OptionsColor,this.color.value="#ff0000",this.radius=0,this.rate=1}load(t){(0,n.isNull)(t)||(void 0!==t.color&&(this.color=n.OptionsColor.create(this.color,t.color)),this.duration=t.duration,this.infectedStage=t.infectedStage,void 0!==t.radius&&(this.radius=t.radius),void 0!==t.rate&&(this.rate=t.rate))}}class s{constructor(){this.cure=!1,this.delay=0,this.enable=!1,this.infections=0,this.stages=[]}load(t){(0,n.isNull)(t)||(void 0!==t.cure&&(this.cure=t.cure),void 0!==t.delay&&(this.delay=t.delay),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.infections&&(this.infections=t.infections),void 0!==t.stages&&(this.stages=t.stages.map((t=>{const e=new o;return e.load(t),e}))))}}class a{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 c{constructor(t){this._container=t,this._container.infecter=new a(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)}}}class r{constructor(){this.id="infection"}getPlugin(t){return Promise.resolve(new c(t))}loadOptions(t,e){if(!this.needsPlugin(t)&&!this.needsPlugin(e))return;let i=t.infection;void 0===i?.load&&(t.infection=i=new s),i.load(e?.infection)}needsPlugin(t){return t?.infection?.enable??!1}}}}]);
|
package/492.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Infection Plugin v4.0.0-alpha.2 by Matteo Bruni */
|
package/796.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 796.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_plugin_infection=this.webpackChunk_tsparticles_plugin_infection||[]).push([[796],{796(t,e,n){n.d(e,{ParticlesInfecter:()=>s});var i=n(303);class s extends i.ParticlesInteractorBase{constructor(t){super(t)}clear(){}init(){}interact(t,e){const n=this.container.infecter;if(!n)return;if(n.updateInfection(t,e.value),void 0===t.infection?.stage)return;const s=this.container,a=s.actualOptions.infection;if(!a?.enable||a.stages.length<1)return;const c=a.stages[t.infection.stage];if(!c)return;const o=s.retina.pixelRatio,r=2*t.getRadius()+c.radius*o,f=t.getPosition(),g=c.infectedStage??t.infection.stage,u=s.particles.quadTree.queryCircle(f,r),l=c.rate,d=u.length;for(const e of u){const s=e;if(!(s===t||s.destroyed||s.spawning||void 0!==s.infection?.stage&&s.infection.stage===t.infection.stage||(0,i.getRandom)()>=l/d))if(void 0===s.infection?.stage)n.startInfection(s,g);else if(s.infection.stage<t.infection.stage)n.updateInfectionStage(s,g);else if(s.infection.stage>t.infection.stage){const e=a.stages[s.infection.stage];if(!e)continue;const i=e.infectedStage??s.infection.stage;n.updateInfectionStage(t,i)}}}isEnabled(){return this.container.actualOptions.infection?.enable??!1}reset(){}}}}]);
|
package/796.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Infection Plugin v4.0.0-alpha.2 by Matteo Bruni */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Infection Plugin v4.0.0-alpha.2 by Matteo Bruni */
|