@tsparticles/plugin-absorbers 4.0.0-alpha.8 → 4.0.0-beta.1
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/122.min.js +1 -0
- package/285.min.js +1 -0
- package/677.min.js +1 -0
- package/698.min.js +1 -0
- package/998.min.js +1 -0
- package/README.md +5 -0
- package/browser/AbsorberInstance.js +126 -59
- package/browser/AbsorbersInstancesManager.js +5 -3
- package/browser/AbsorbersInteractor.js +11 -6
- package/browser/AbsorbersPlugin.js +2 -1
- package/browser/AbsorbersPluginInstance.js +2 -0
- package/browser/Options/Classes/Absorber.js +14 -0
- package/browser/Options/Classes/AbsorberLife.js +27 -0
- package/browser/Options/Classes/AbsorberSize.js +2 -0
- package/browser/Options/Classes/AbsorberSizeLimit.js +2 -0
- package/browser/Options/Interfaces/IAbsorberLife.js +1 -0
- package/browser/index.js +10 -6
- package/cjs/AbsorberInstance.js +126 -59
- package/cjs/AbsorbersInstancesManager.js +5 -3
- package/cjs/AbsorbersInteractor.js +11 -6
- package/cjs/AbsorbersPlugin.js +2 -1
- package/cjs/AbsorbersPluginInstance.js +2 -0
- package/cjs/Options/Classes/Absorber.js +14 -0
- package/cjs/Options/Classes/AbsorberLife.js +27 -0
- package/cjs/Options/Classes/AbsorberSize.js +2 -0
- package/cjs/Options/Classes/AbsorberSizeLimit.js +2 -0
- package/cjs/Options/Interfaces/IAbsorberLife.js +1 -0
- package/cjs/index.js +10 -6
- package/dist_browser_AbsorberInstance_js.js +15 -5
- package/dist_browser_AbsorbersInstancesManager_js.js +2 -2
- package/dist_browser_AbsorbersInteractor_js.js +15 -5
- package/dist_browser_AbsorbersPluginInstance_js.js +2 -2
- package/dist_browser_AbsorbersPlugin_js.js +15 -5
- package/esm/AbsorberInstance.js +126 -59
- package/esm/AbsorbersInstancesManager.js +5 -3
- package/esm/AbsorbersInteractor.js +11 -6
- package/esm/AbsorbersPlugin.js +2 -1
- package/esm/AbsorbersPluginInstance.js +2 -0
- package/esm/Options/Classes/Absorber.js +14 -0
- package/esm/Options/Classes/AbsorberLife.js +27 -0
- package/esm/Options/Classes/AbsorberSize.js +2 -0
- package/esm/Options/Classes/AbsorberSizeLimit.js +2 -0
- package/esm/Options/Interfaces/IAbsorberLife.js +1 -0
- package/esm/index.js +10 -6
- package/package.json +3 -3
- package/report.html +84 -29
- package/tsparticles.plugin.absorbers.js +31 -19
- package/tsparticles.plugin.absorbers.min.js +2 -2
- package/types/AbsorberInstance.d.ts +14 -4
- package/types/AbsorbersInstancesManager.d.ts +3 -3
- package/types/AbsorbersInteractor.d.ts +3 -2
- package/types/AbsorbersPlugin.d.ts +1 -1
- package/types/AbsorbersPluginInstance.d.ts +2 -2
- package/types/Options/Classes/Absorber.d.ts +2 -0
- package/types/Options/Classes/AbsorberLife.d.ts +10 -0
- package/types/Options/Interfaces/IAbsorber.d.ts +2 -0
- package/types/Options/Interfaces/IAbsorberLife.d.ts +7 -0
- package/umd/AbsorberInstance.js +125 -58
- package/umd/AbsorbersInstancesManager.js +5 -3
- package/umd/AbsorbersInteractor.js +11 -6
- package/umd/AbsorbersPlugin.js +2 -1
- package/umd/AbsorbersPluginInstance.js +2 -0
- package/umd/Options/Classes/Absorber.js +15 -1
- package/umd/Options/Classes/AbsorberLife.js +41 -0
- package/umd/Options/Classes/AbsorberSize.js +2 -0
- package/umd/Options/Classes/AbsorberSizeLimit.js +2 -0
- package/umd/Options/Interfaces/IAbsorberLife.js +12 -0
- package/umd/index.js +10 -6
- package/215.min.js +0 -2
- package/215.min.js.LICENSE.txt +0 -1
- package/384.min.js +0 -2
- package/384.min.js.LICENSE.txt +0 -1
- package/688.min.js +0 -2
- package/688.min.js.LICENSE.txt +0 -1
- package/903.min.js +0 -2
- package/903.min.js.LICENSE.txt +0 -1
- package/980.min.js +0 -2
- package/980.min.js.LICENSE.txt +0 -1
- package/tsparticles.plugin.absorbers.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.1
|
|
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 */ loadAbsorbersPlugin: () => (/* binding */ loadAbsorbersPlugin)\n/* harmony export */ });\nasync function loadAbsorbersPlugin(engine) {\n engine.checkVersion(\"4.0.0-alpha.8\");\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 AbsorbersInstancesManager\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_AbsorbersInstancesManager_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./AbsorbersInstancesManager.js */ \"./dist/browser/AbsorbersInstancesManager.js\")),\n {\n AbsorbersPlugin\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_AbsorbersPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./AbsorbersPlugin.js */ \"./dist/browser/AbsorbersPlugin.js\")),\n instancesManager = new AbsorbersInstancesManager(e);\n await loadInteractivityPlugin(e);\n e.addPlugin(new AbsorbersPlugin(instancesManager));\n e.addInteractor?.(\"externalAbsorbers\", async container => {\n const {\n AbsorbersInteractor\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_AbsorbersInteractor_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./AbsorbersInteractor.js */ \"./dist/browser/AbsorbersInteractor.js\"));\n return new AbsorbersInteractor(container, instancesManager);\n });\n });\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-absorbers/./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 */ loadAbsorbersPlugin: () => (/* binding */ loadAbsorbersPlugin)\n/* harmony export */ });\nasync function loadAbsorbersPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.1\");\n await engine.pluginManager.register(async (e)=>{\n const [{ ensureInteractivityPluginLoaded }, { AbsorbersInstancesManager }, { AbsorbersPlugin }] = 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_AbsorbersInstancesManager_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./AbsorbersInstancesManager.js */ \"./dist/browser/AbsorbersInstancesManager.js\")),\n __webpack_require__.e(/*! import() */ \"dist_browser_AbsorbersPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./AbsorbersPlugin.js */ \"./dist/browser/AbsorbersPlugin.js\"))\n ]), pluginManager = e.pluginManager, instancesManager = new AbsorbersInstancesManager(pluginManager);\n ensureInteractivityPluginLoaded(e);\n pluginManager.addPlugin(new AbsorbersPlugin(instancesManager));\n pluginManager.addInteractor?.(\"externalAbsorbers\", async (container)=>{\n const { AbsorbersInteractor } = await __webpack_require__.e(/*! import() */ \"dist_browser_AbsorbersInteractor_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./AbsorbersInteractor.js */ \"./dist/browser/AbsorbersInteractor.js\"));\n return new AbsorbersInteractor(container, instancesManager);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-absorbers/./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 o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e,t)=>(()=>{"use strict";var r,o,n,i={303(e){e.exports=t},702(t){t.exports=e}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return i[e](r,r.exports,s),r.exports}s.m=i,l=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.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);s.r(r);var o={};c=c||[null,l({}),l([]),l(l)];for(var n=2&t&&e;("object"==typeof n||"function"==typeof n)&&!~c.indexOf(n);n=l(n))Object.getOwnPropertyNames(n).forEach(t=>o[t]=()=>e[t]);return o.default=()=>e,s.d(r,o),r},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((t,r)=>(s.f[r](e,t),t),[])),s.u=e=>""+e+".min.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p={},s.l=(e,t,r,o)=>{if(p[e])return void p[e].push(t);if(void 0!==r)for(var n,i,a=document.getElementsByTagName("script"),c=0;c<a.length;c++){var l=a[c];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="@tsparticles/plugin-absorbers:"+r){n=l;break}}n||(i=!0,(n=document.createElement("script")).charset="utf-8",s.nc&&n.setAttribute("nonce",s.nc),n.setAttribute("data-webpack","@tsparticles/plugin-absorbers:"+r),n.src=e),p[e]=[t];var u=(t,r)=>{n.onerror=n.onload=null,clearTimeout(d);var o=p[e];if(delete p[e],n.parentNode&&n.parentNode.removeChild(n),o&&o.forEach(e=>e(r)),t)return t(r)},d=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),i&&document.head.appendChild(n)},s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(u=s.g.location+"");var c,l,p,u,d=s.g.document;if(!u&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(u=d.currentScript.src),!u)){var f=d.getElementsByTagName("script");if(f.length)for(var b=f.length-1;b>-1&&(!u||!/^http(s?):/.test(u));)u=f[b--].src}if(!u)throw Error("Automatic publicPath is not supported in this browser");s.p=u=u.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r={425:0},s.f.j=(e,t)=>{var o=s.o(r,e)?r[e]:void 0;if(0!==o)if(o)t.push(o[2]);else{var n=new Promise((t,n)=>o=r[e]=[t,n]);t.push(o[2]=n);var i=s.p+s.u(e),a=Error();s.l(i,t=>{if(s.o(r,e)&&(0!==(o=r[e])&&(r[e]=void 0),o)){var n=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;a.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+n+": "+i+")",a.name="ChunkLoadError",a.type=n,a.request=i,o[1](a)}},"chunk-"+e,e)}},o=(e,t)=>{var o,n,[i,a,c]=t,l=0;if(i.some(e=>0!==r[e])){for(o in a)s.o(a,o)&&(s.m[o]=a[o]);c&&c(s)}for(e&&e(t);l<i.length;l++)n=i[l],s.o(r,n)&&r[n]&&r[n][0](),r[n]=0},(n=this.webpackChunk_tsparticles_plugin_absorbers=this.webpackChunk_tsparticles_plugin_absorbers||[]).forEach(o.bind(null,0)),n.push=o.bind(null,n.push.bind(n));var g={};async function h(e){e.checkVersion("4.0.0-beta.1"),await e.pluginManager.register(async e=>{let[{ensureInteractivityPluginLoaded:t},{AbsorbersInstancesManager:r},{AbsorbersPlugin:o}]=await Promise.all([Promise.resolve().then(s.t.bind(s,702,19)),s.e(122).then(s.bind(s,122)),s.e(998).then(s.bind(s,998))]),n=e.pluginManager,i=new r(n);t(e),n.addPlugin(new o(i)),n.addInteractor?.("externalAbsorbers",async e=>{let{AbsorbersInteractor:t}=await s.e(698).then(s.bind(s,698));return new t(e,i)})})}return s.r(g),s.d(g,{loadAbsorbersPlugin:()=>h}),g})());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CanvasContextType, type Container, type ICoordinates, type IDelta, type IRgb, type Particle, type PluginManager, type RecursivePartial, RotateDirection, Vector } from "@tsparticles/engine";
|
|
2
2
|
import { Absorber } from "./Options/Classes/Absorber.js";
|
|
3
3
|
import type { IAbsorber } from "./Options/Interfaces/IAbsorber.js";
|
|
4
4
|
import type { IAbsorberSizeLimit } from "./Options/Interfaces/IAbsorberSizeLimit.js";
|
|
@@ -17,13 +17,23 @@ export declare class AbsorberInstance {
|
|
|
17
17
|
position: Vector;
|
|
18
18
|
size: number;
|
|
19
19
|
private readonly _container;
|
|
20
|
-
private
|
|
20
|
+
private _currentDuration;
|
|
21
|
+
private _currentSpawnDelay;
|
|
22
|
+
private _duration?;
|
|
23
|
+
private _firstSpawn;
|
|
24
|
+
private readonly _immortal;
|
|
25
|
+
private _lifeCount;
|
|
26
|
+
private readonly _pluginManager;
|
|
27
|
+
private _spawnDelay?;
|
|
21
28
|
private readonly initialPosition?;
|
|
22
|
-
constructor(
|
|
29
|
+
constructor(pluginManager: PluginManager, container: Container, options: RecursivePartial<IAbsorber>, position?: ICoordinates);
|
|
23
30
|
attract(particle: OrbitingParticle, delta: IDelta): void;
|
|
24
|
-
draw(context:
|
|
31
|
+
draw(context: CanvasContextType): void;
|
|
25
32
|
resize(): void;
|
|
33
|
+
update(delta: IDelta): void;
|
|
26
34
|
private readonly _calcPosition;
|
|
35
|
+
private readonly _prepareToDie;
|
|
27
36
|
private readonly _updateParticlePosition;
|
|
37
|
+
private readonly play;
|
|
28
38
|
}
|
|
29
39
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ICoordinates, type PluginManager, type RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import type { AbsorberContainer } from "./AbsorberContainer.js";
|
|
3
3
|
import type { AbsorberInstance } from "./AbsorberInstance.js";
|
|
4
4
|
import type { IAbsorber } from "./Options/Interfaces/IAbsorber.js";
|
|
5
5
|
export declare class AbsorbersInstancesManager {
|
|
6
6
|
private readonly _containerArrays;
|
|
7
|
-
private readonly
|
|
8
|
-
constructor(
|
|
7
|
+
private readonly _pluginManager;
|
|
8
|
+
constructor(pluginManager: PluginManager);
|
|
9
9
|
addAbsorber(container: AbsorberContainer, options: RecursivePartial<IAbsorber>, position?: ICoordinates): Promise<AbsorberInstance>;
|
|
10
10
|
clear(container: AbsorberContainer): void;
|
|
11
11
|
getArray(container: AbsorberContainer): AbsorberInstance[];
|
|
@@ -5,9 +5,10 @@ import type { AbsorberContainer } from "./AbsorberContainer.js";
|
|
|
5
5
|
import type { AbsorbersInstancesManager } from "./AbsorbersInstancesManager.js";
|
|
6
6
|
export declare class AbsorbersInteractor extends ExternalInteractorBase<AbsorberContainer> {
|
|
7
7
|
handleClickMode: (mode: string, interactivityData: IInteractivityData) => void;
|
|
8
|
+
readonly maxDistance: number;
|
|
9
|
+
private _dragging;
|
|
10
|
+
private _draggingAbsorber;
|
|
8
11
|
private readonly _instancesManager;
|
|
9
|
-
private dragging;
|
|
10
|
-
private draggingAbsorber;
|
|
11
12
|
constructor(container: AbsorberContainer, instancesManager: AbsorbersInstancesManager);
|
|
12
13
|
clear(): void;
|
|
13
14
|
init(): void;
|
|
@@ -3,7 +3,7 @@ import { type Container, type IContainerPlugin, type IOptions, type IPlugin, typ
|
|
|
3
3
|
import type { AbsorberContainer } from "./AbsorberContainer.js";
|
|
4
4
|
import type { AbsorbersInstancesManager } from "./AbsorbersInstancesManager.js";
|
|
5
5
|
export declare class AbsorbersPlugin implements IPlugin {
|
|
6
|
-
readonly id
|
|
6
|
+
readonly id = "absorbers";
|
|
7
7
|
private readonly _instancesManager;
|
|
8
8
|
constructor(instancesManager: AbsorbersInstancesManager);
|
|
9
9
|
getPlugin(container: AbsorberContainer): Promise<IContainerPlugin>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type IContainerPlugin, type IDelta, type Particle } from "@tsparticles/engine";
|
|
1
|
+
import { type CanvasContextType, type IContainerPlugin, type IDelta, type Particle } from "@tsparticles/engine";
|
|
2
2
|
import type { AbsorberContainer } from "./AbsorberContainer.js";
|
|
3
3
|
import type { AbsorbersInstancesManager } from "./AbsorbersInstancesManager.js";
|
|
4
4
|
export declare class AbsorbersPluginInstance implements IContainerPlugin {
|
|
5
5
|
private readonly _container;
|
|
6
6
|
private readonly _instancesManager;
|
|
7
7
|
constructor(container: AbsorberContainer, instancesManager: AbsorbersInstancesManager);
|
|
8
|
-
draw(context:
|
|
8
|
+
draw(context: CanvasContextType): void;
|
|
9
9
|
init(): Promise<void>;
|
|
10
10
|
particleUpdate(particle: Particle, delta: IDelta): void;
|
|
11
11
|
resize(): void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type IOptionLoader, type IRangedCoordinates, OptionsColor, type RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import { AbsorberLife } from "./AbsorberLife.js";
|
|
2
3
|
import { AbsorberSize } from "./AbsorberSize.js";
|
|
3
4
|
import type { IAbsorber } from "../Interfaces/IAbsorber.js";
|
|
4
5
|
export declare class Absorber implements IAbsorber, IOptionLoader<IAbsorber> {
|
|
5
6
|
color: OptionsColor;
|
|
6
7
|
destroy: boolean;
|
|
7
8
|
draggable: boolean;
|
|
9
|
+
life: AbsorberLife;
|
|
8
10
|
name?: string;
|
|
9
11
|
opacity: number;
|
|
10
12
|
orbits: boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type IOptionLoader, type RangeValue, type RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import type { IAbsorberLife } from "../Interfaces/IAbsorberLife.js";
|
|
3
|
+
export declare class AbsorberLife implements IAbsorberLife, IOptionLoader<IAbsorberLife> {
|
|
4
|
+
count?: number;
|
|
5
|
+
delay?: RangeValue;
|
|
6
|
+
duration?: RangeValue;
|
|
7
|
+
wait: boolean;
|
|
8
|
+
constructor();
|
|
9
|
+
load(data?: RecursivePartial<IAbsorberLife>): void;
|
|
10
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { IOptionsColor, IRangedCoordinates, RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import type { IAbsorberLife } from "./IAbsorberLife.js";
|
|
2
3
|
import type { IAbsorberSize } from "./IAbsorberSize.js";
|
|
3
4
|
export interface IAbsorber {
|
|
4
5
|
color: string | IOptionsColor;
|
|
5
6
|
destroy: boolean;
|
|
6
7
|
draggable: boolean;
|
|
8
|
+
life: IAbsorberLife;
|
|
7
9
|
name?: string;
|
|
8
10
|
opacity: number;
|
|
9
11
|
orbits: boolean;
|
package/umd/AbsorberInstance.js
CHANGED
|
@@ -12,62 +12,31 @@
|
|
|
12
12
|
exports.AbsorberInstance = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const Absorber_js_1 = require("./Options/Classes/Absorber.js");
|
|
15
|
-
const squareExp = 2, absorbFactor = 0.033, minOrbitLength = 0, minRadius = 0, minMass = 0, minAngle = 0, maxAngle = engine_1.doublePI, minVelocity = 0;
|
|
15
|
+
const squareExp = 2, absorbFactor = 0.033, minOrbitLength = 0, minRadius = 0, minMass = 0, minAngle = 0, maxAngle = engine_1.doublePI, maxDegreeAngle = 360, angleIncrementFactor = engine_1.identity / maxDegreeAngle, minVelocity = 0, defaultLifeDelay = 0, minLifeCount = 0, defaultSpawnDelay = 0, defaultLifeCount = -1;
|
|
16
16
|
class AbsorberInstance {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
if (this.options.orbits) {
|
|
38
|
-
if (particle.absorberOrbit === undefined) {
|
|
39
|
-
particle.absorberOrbit = engine_1.Vector.origin;
|
|
40
|
-
particle.absorberOrbit.length = (0, engine_1.getDistance)(particle.getPosition(), this.position);
|
|
41
|
-
particle.absorberOrbit.angle = (0, engine_1.getRandom)() * maxAngle;
|
|
42
|
-
}
|
|
43
|
-
if (particle.absorberOrbit.length <= this.size && !this.options.destroy) {
|
|
44
|
-
const minSize = Math.min(canvasSize.width, canvasSize.height), offset = 1, randomOffset = 0.1, randomFactor = 0.2;
|
|
45
|
-
particle.absorberOrbit.length = minSize * (offset + ((0, engine_1.getRandom)() * randomFactor - randomOffset));
|
|
46
|
-
}
|
|
47
|
-
particle.absorberOrbitDirection ??=
|
|
48
|
-
particle.velocity.x >= minVelocity ? engine_1.RotateDirection.clockwise : engine_1.RotateDirection.counterClockwise;
|
|
49
|
-
const orbitRadius = particle.absorberOrbit.length, orbitAngle = particle.absorberOrbit.angle, orbitDirection = particle.absorberOrbitDirection;
|
|
50
|
-
particle.velocity.setTo(engine_1.Vector.origin);
|
|
51
|
-
const updateFunc = {
|
|
52
|
-
x: orbitDirection === engine_1.RotateDirection.clockwise ? Math.cos : Math.sin,
|
|
53
|
-
y: orbitDirection === engine_1.RotateDirection.clockwise ? Math.sin : Math.cos,
|
|
54
|
-
};
|
|
55
|
-
particle.position.x = this.position.x + orbitRadius * updateFunc.x(orbitAngle);
|
|
56
|
-
particle.position.y = this.position.y + orbitRadius * updateFunc.y(orbitAngle);
|
|
57
|
-
particle.absorberOrbit.length -= v.length;
|
|
58
|
-
particle.absorberOrbit.angle +=
|
|
59
|
-
(((particle.retina.moveSpeed ?? minVelocity) * container.retina.pixelRatio) / engine_1.percentDenominator) *
|
|
60
|
-
container.retina.reduceFactor;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
const addV = engine_1.Vector.origin;
|
|
64
|
-
addV.length = v.length;
|
|
65
|
-
addV.angle = v.angle;
|
|
66
|
-
particle.velocity.addTo(addV);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
17
|
+
color;
|
|
18
|
+
limit;
|
|
19
|
+
mass;
|
|
20
|
+
name;
|
|
21
|
+
opacity;
|
|
22
|
+
options;
|
|
23
|
+
position;
|
|
24
|
+
size;
|
|
25
|
+
_container;
|
|
26
|
+
_currentDuration;
|
|
27
|
+
_currentSpawnDelay;
|
|
28
|
+
_duration;
|
|
29
|
+
_firstSpawn;
|
|
30
|
+
_immortal;
|
|
31
|
+
_lifeCount;
|
|
32
|
+
_pluginManager;
|
|
33
|
+
_spawnDelay;
|
|
34
|
+
initialPosition;
|
|
35
|
+
constructor(pluginManager, container, options, position) {
|
|
69
36
|
this._container = container;
|
|
70
|
-
this.
|
|
37
|
+
this._pluginManager = pluginManager;
|
|
38
|
+
this._currentDuration = 0;
|
|
39
|
+
this._currentSpawnDelay = 0;
|
|
71
40
|
this.initialPosition = position ? engine_1.Vector.create(position.x, position.y) : undefined;
|
|
72
41
|
if (options instanceof Absorber_js_1.Absorber) {
|
|
73
42
|
this.options = options;
|
|
@@ -85,12 +54,19 @@
|
|
|
85
54
|
radius: limit.radius * container.retina.pixelRatio * container.retina.reduceFactor,
|
|
86
55
|
mass: limit.mass,
|
|
87
56
|
};
|
|
88
|
-
this.color = (0, engine_1.rangeColorToRgb)(this.
|
|
57
|
+
this.color = (0, engine_1.rangeColorToRgb)(this._pluginManager, this.options.color) ?? {
|
|
89
58
|
b: 0,
|
|
90
59
|
g: 0,
|
|
91
60
|
r: 0,
|
|
92
61
|
};
|
|
93
62
|
this.position = this.initialPosition?.copy() ?? this._calcPosition();
|
|
63
|
+
this._firstSpawn = !this.options.life.wait;
|
|
64
|
+
this._lifeCount = this.options.life.count ?? defaultLifeCount;
|
|
65
|
+
this._immortal = this._lifeCount <= minLifeCount;
|
|
66
|
+
this._spawnDelay = container.retina.reduceFactor
|
|
67
|
+
? ((0, engine_1.getRangeValue)(this.options.life.delay ?? defaultLifeDelay) * engine_1.millisecondsToSeconds) /
|
|
68
|
+
container.retina.reduceFactor
|
|
69
|
+
: Infinity;
|
|
94
70
|
}
|
|
95
71
|
attract(particle, delta) {
|
|
96
72
|
const container = this._container, options = this.options, pos = particle.getPosition(), { dx, dy, distance } = (0, engine_1.getDistances)(this.position, pos), v = engine_1.Vector.create(dx, dy);
|
|
@@ -104,14 +80,14 @@
|
|
|
104
80
|
}
|
|
105
81
|
else {
|
|
106
82
|
particle.needsNewPosition = true;
|
|
107
|
-
this._updateParticlePosition(particle, v);
|
|
83
|
+
this._updateParticlePosition(particle, delta, v);
|
|
108
84
|
}
|
|
109
85
|
}
|
|
110
86
|
else {
|
|
111
87
|
if (options.destroy) {
|
|
112
88
|
particle.size.value -= sizeFactor;
|
|
113
89
|
}
|
|
114
|
-
this._updateParticlePosition(particle, v);
|
|
90
|
+
this._updateParticlePosition(particle, delta, v);
|
|
115
91
|
}
|
|
116
92
|
if (this.limit.radius <= minRadius || this.size < this.limit.radius) {
|
|
117
93
|
this.size += sizeFactor;
|
|
@@ -121,7 +97,7 @@
|
|
|
121
97
|
}
|
|
122
98
|
}
|
|
123
99
|
else {
|
|
124
|
-
this._updateParticlePosition(particle, v);
|
|
100
|
+
this._updateParticlePosition(particle, delta, v);
|
|
125
101
|
}
|
|
126
102
|
}
|
|
127
103
|
draw(context) {
|
|
@@ -139,6 +115,97 @@
|
|
|
139
115
|
? initialPosition
|
|
140
116
|
: this._calcPosition();
|
|
141
117
|
}
|
|
118
|
+
update(delta) {
|
|
119
|
+
if (this._firstSpawn) {
|
|
120
|
+
this._firstSpawn = false;
|
|
121
|
+
this._currentSpawnDelay = this._spawnDelay ?? defaultSpawnDelay;
|
|
122
|
+
}
|
|
123
|
+
if (this._duration !== undefined) {
|
|
124
|
+
this._currentDuration += delta.value;
|
|
125
|
+
if (this._currentDuration >= this._duration) {
|
|
126
|
+
if (!this._immortal) {
|
|
127
|
+
this._lifeCount--;
|
|
128
|
+
}
|
|
129
|
+
if (this._lifeCount > minLifeCount || this._immortal) {
|
|
130
|
+
this.position = this._calcPosition();
|
|
131
|
+
this._spawnDelay = this._container.retina.reduceFactor
|
|
132
|
+
? ((0, engine_1.getRangeValue)(this.options.life.delay ?? defaultLifeDelay) * engine_1.millisecondsToSeconds) /
|
|
133
|
+
this._container.retina.reduceFactor
|
|
134
|
+
: Infinity;
|
|
135
|
+
}
|
|
136
|
+
this._currentDuration -= this._duration;
|
|
137
|
+
delete this._duration;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (this._spawnDelay !== undefined) {
|
|
141
|
+
this._currentSpawnDelay += delta.value;
|
|
142
|
+
if (this._currentSpawnDelay >= this._spawnDelay) {
|
|
143
|
+
this.play();
|
|
144
|
+
this._currentSpawnDelay -= this._spawnDelay;
|
|
145
|
+
delete this._spawnDelay;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
_calcPosition = () => {
|
|
150
|
+
const exactPosition = (0, engine_1.calcPositionOrRandomFromSizeRanged)({
|
|
151
|
+
size: this._container.canvas.size,
|
|
152
|
+
position: this.options.position,
|
|
153
|
+
});
|
|
154
|
+
return engine_1.Vector.create(exactPosition.x, exactPosition.y);
|
|
155
|
+
};
|
|
156
|
+
_prepareToDie = () => {
|
|
157
|
+
const duration = this.options.life.duration !== undefined ? (0, engine_1.getRangeValue)(this.options.life.duration) : undefined, minDuration = 0;
|
|
158
|
+
if ((this._lifeCount > minLifeCount || this._immortal) && duration !== undefined && duration > minDuration) {
|
|
159
|
+
this._duration = duration * engine_1.millisecondsToSeconds;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
_updateParticlePosition = (particle, delta, v) => {
|
|
163
|
+
if (particle.destroyed) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const container = this._container, canvasSize = container.canvas.size;
|
|
167
|
+
if (particle.needsNewPosition) {
|
|
168
|
+
const newPosition = (0, engine_1.calcPositionOrRandomFromSize)({ size: canvasSize });
|
|
169
|
+
particle.position.setTo(newPosition);
|
|
170
|
+
particle.velocity.setTo(particle.initialVelocity);
|
|
171
|
+
particle.absorberOrbit = undefined;
|
|
172
|
+
particle.needsNewPosition = false;
|
|
173
|
+
}
|
|
174
|
+
if (this.options.orbits) {
|
|
175
|
+
if (particle.absorberOrbit === undefined) {
|
|
176
|
+
particle.absorberOrbit = engine_1.Vector.origin;
|
|
177
|
+
particle.absorberOrbit.length = (0, engine_1.getDistance)(particle.getPosition(), this.position);
|
|
178
|
+
particle.absorberOrbit.angle = (0, engine_1.getRandom)() * maxAngle;
|
|
179
|
+
}
|
|
180
|
+
if (particle.absorberOrbit.length <= this.size && !this.options.destroy) {
|
|
181
|
+
const minSize = Math.min(canvasSize.width, canvasSize.height), offset = 1, randomOffset = 0.1, randomFactor = 0.2;
|
|
182
|
+
particle.absorberOrbit.length = minSize * (offset + ((0, engine_1.getRandom)() * randomFactor - randomOffset));
|
|
183
|
+
}
|
|
184
|
+
particle.absorberOrbitDirection ??=
|
|
185
|
+
particle.velocity.x >= minVelocity ? engine_1.RotateDirection.clockwise : engine_1.RotateDirection.counterClockwise;
|
|
186
|
+
const orbitRadius = particle.absorberOrbit.length, orbitAngle = particle.absorberOrbit.angle, orbitDirection = particle.absorberOrbitDirection;
|
|
187
|
+
particle.velocity.setTo(engine_1.Vector.origin);
|
|
188
|
+
const maxSize = (0, engine_1.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio, sizeFactor = particle.options.move.size ? particle.getRadius() / maxSize : engine_1.identity, deltaFactor = delta.factor || engine_1.identity, baseSpeed = particle.retina.moveSpeed, moveSpeed = baseSpeed * sizeFactor * deltaFactor * engine_1.half;
|
|
189
|
+
particle.position.x = this.position.x + orbitRadius * Math.cos(orbitAngle);
|
|
190
|
+
particle.position.y =
|
|
191
|
+
this.position.y +
|
|
192
|
+
orbitRadius * (orbitDirection === engine_1.RotateDirection.clockwise ? engine_1.identity : -engine_1.identity) * Math.sin(orbitAngle);
|
|
193
|
+
particle.absorberOrbit.length = Math.max(minOrbitLength, particle.absorberOrbit.length - v.length);
|
|
194
|
+
particle.absorberOrbit.angle += moveSpeed * angleIncrementFactor * container.retina.reduceFactor;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
particle.velocity.addTo(v);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
play = () => {
|
|
201
|
+
if (!((this._lifeCount > minLifeCount || this._immortal || !this.options.life.count) &&
|
|
202
|
+
(this._firstSpawn || this._currentSpawnDelay >= (this._spawnDelay ?? defaultSpawnDelay)))) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (this._lifeCount > minLifeCount || this._immortal) {
|
|
206
|
+
this._prepareToDie();
|
|
207
|
+
}
|
|
208
|
+
};
|
|
142
209
|
}
|
|
143
210
|
exports.AbsorberInstance = AbsorberInstance;
|
|
144
211
|
});
|
|
@@ -47,12 +47,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
47
47
|
const engine_1 = require("@tsparticles/engine");
|
|
48
48
|
const defaultIndex = 0;
|
|
49
49
|
class AbsorbersInstancesManager {
|
|
50
|
-
|
|
50
|
+
_containerArrays;
|
|
51
|
+
_pluginManager;
|
|
52
|
+
constructor(pluginManager) {
|
|
53
|
+
this._pluginManager = pluginManager;
|
|
51
54
|
this._containerArrays = new Map();
|
|
52
|
-
this._engine = engine;
|
|
53
55
|
}
|
|
54
56
|
async addAbsorber(container, options, position) {
|
|
55
|
-
const { AbsorberInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./AbsorberInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./AbsorberInstance.js"], resolve_1, reject_1); }).then(__importStar)), absorber = new AbsorberInstance(this.
|
|
57
|
+
const { AbsorberInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./AbsorberInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./AbsorberInstance.js"], resolve_1, reject_1); }).then(__importStar)), absorber = new AbsorberInstance(this._pluginManager, container, options, position), array = this.getArray(container);
|
|
56
58
|
array.push(absorber);
|
|
57
59
|
return absorber;
|
|
58
60
|
}
|
|
@@ -15,9 +15,14 @@
|
|
|
15
15
|
const Absorber_js_1 = require("./Options/Classes/Absorber.js");
|
|
16
16
|
const absorbersMode = "absorbers";
|
|
17
17
|
class AbsorbersInteractor extends plugin_interactivity_1.ExternalInteractorBase {
|
|
18
|
+
handleClickMode;
|
|
19
|
+
maxDistance;
|
|
20
|
+
_dragging = false;
|
|
21
|
+
_draggingAbsorber;
|
|
22
|
+
_instancesManager;
|
|
18
23
|
constructor(container, instancesManager) {
|
|
19
24
|
super(container);
|
|
20
|
-
this.
|
|
25
|
+
this.maxDistance = 0;
|
|
21
26
|
this._instancesManager = instancesManager;
|
|
22
27
|
this._instancesManager.initContainer(container);
|
|
23
28
|
this.handleClickMode = (mode, interactivityData) => {
|
|
@@ -50,15 +55,15 @@
|
|
|
50
55
|
if (mouse.clicking && mouse.downPosition) {
|
|
51
56
|
const mouseDist = (0, engine_1.getDistance)(absorber.position, mouse.downPosition);
|
|
52
57
|
if (mouseDist <= absorber.size) {
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
58
|
+
this._dragging = true;
|
|
59
|
+
this._draggingAbsorber = absorber;
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
else {
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
63
|
+
this._dragging = false;
|
|
64
|
+
this._draggingAbsorber = undefined;
|
|
60
65
|
}
|
|
61
|
-
if (this.
|
|
66
|
+
if (this._dragging && this._draggingAbsorber == absorber && mouse.position) {
|
|
62
67
|
absorber.position.x = mouse.position.x;
|
|
63
68
|
absorber.position.y = mouse.position.y;
|
|
64
69
|
}
|
package/umd/AbsorbersPlugin.js
CHANGED
|
@@ -47,8 +47,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
47
47
|
const engine_1 = require("@tsparticles/engine");
|
|
48
48
|
const Absorber_js_1 = require("./Options/Classes/Absorber.js");
|
|
49
49
|
class AbsorbersPlugin {
|
|
50
|
+
id = "absorbers";
|
|
51
|
+
_instancesManager;
|
|
50
52
|
constructor(instancesManager) {
|
|
51
|
-
this.id = "absorbers";
|
|
52
53
|
this._instancesManager = instancesManager;
|
|
53
54
|
}
|
|
54
55
|
async getPlugin(container) {
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
exports.AbsorbersPluginInstance = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
class AbsorbersPluginInstance {
|
|
15
|
+
_container;
|
|
16
|
+
_instancesManager;
|
|
15
17
|
constructor(container, instancesManager) {
|
|
16
18
|
this._container = container;
|
|
17
19
|
this._instancesManager = instancesManager;
|
|
@@ -4,15 +4,25 @@
|
|
|
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", "./AbsorberSize.js"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "./AbsorberLife.js", "./AbsorberSize.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Absorber = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const AbsorberLife_js_1 = require("./AbsorberLife.js");
|
|
14
15
|
const AbsorberSize_js_1 = require("./AbsorberSize.js");
|
|
15
16
|
class Absorber {
|
|
17
|
+
color;
|
|
18
|
+
destroy;
|
|
19
|
+
draggable;
|
|
20
|
+
life;
|
|
21
|
+
name;
|
|
22
|
+
opacity;
|
|
23
|
+
orbits;
|
|
24
|
+
position;
|
|
25
|
+
size;
|
|
16
26
|
constructor() {
|
|
17
27
|
this.color = new engine_1.OptionsColor();
|
|
18
28
|
this.color.value = "#000000";
|
|
@@ -20,6 +30,7 @@
|
|
|
20
30
|
this.opacity = 1;
|
|
21
31
|
this.destroy = true;
|
|
22
32
|
this.orbits = false;
|
|
33
|
+
this.life = new AbsorberLife_js_1.AbsorberLife();
|
|
23
34
|
this.size = new AbsorberSize_js_1.AbsorberSize();
|
|
24
35
|
}
|
|
25
36
|
load(data) {
|
|
@@ -32,6 +43,9 @@
|
|
|
32
43
|
if (data.draggable !== undefined) {
|
|
33
44
|
this.draggable = data.draggable;
|
|
34
45
|
}
|
|
46
|
+
if (data.life !== undefined) {
|
|
47
|
+
this.life.load(data.life);
|
|
48
|
+
}
|
|
35
49
|
this.name = data.name;
|
|
36
50
|
if (data.opacity !== undefined) {
|
|
37
51
|
this.opacity = data.opacity;
|