@tsparticles/interaction-external-bubble 4.0.0-alpha.8 → 4.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/537.min.js +1 -0
- package/README.md +5 -0
- package/browser/Bubbler.js +206 -198
- package/browser/Options/Classes/Bubble.js +1 -0
- package/browser/Options/Classes/BubbleBase.js +6 -0
- package/browser/Options/Classes/BubbleDiv.js +1 -0
- package/browser/index.js +3 -3
- package/cjs/Bubbler.js +206 -198
- package/cjs/Options/Classes/Bubble.js +1 -0
- package/cjs/Options/Classes/BubbleBase.js +6 -0
- package/cjs/Options/Classes/BubbleDiv.js +1 -0
- package/cjs/index.js +3 -3
- package/dist_browser_Bubbler_js.js +4 -4
- package/esm/Bubbler.js +206 -198
- package/esm/Options/Classes/Bubble.js +1 -0
- package/esm/Options/Classes/BubbleBase.js +6 -0
- package/esm/Options/Classes/BubbleDiv.js +1 -0
- package/esm/index.js +3 -3
- package/package.json +3 -3
- package/report.html +1 -1
- package/tsparticles.interaction.external.bubble.js +45 -33
- package/tsparticles.interaction.external.bubble.min.js +2 -2
- package/types/Bubbler.d.ts +2 -0
- package/umd/Bubbler.js +206 -198
- package/umd/Options/Classes/Bubble.js +1 -0
- package/umd/Options/Classes/BubbleBase.js +6 -0
- package/umd/Options/Classes/BubbleDiv.js +1 -0
- package/umd/index.js +3 -3
- package/132.min.js +0 -2
- package/132.min.js.LICENSE.txt +0 -1
- package/tsparticles.interaction.external.bubble.min.js.LICENSE.txt +0 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-
|
|
7
|
+
* v4.0.0-beta.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,13 +28,33 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
+
/***/ "@tsparticles/engine"
|
|
32
|
+
/*!*********************************************************************************************************************************!*\
|
|
33
|
+
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
34
|
+
\*********************************************************************************************************************************/
|
|
35
|
+
(module) {
|
|
36
|
+
|
|
37
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
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
|
+
|
|
31
51
|
/***/ "./dist/browser/Options/Classes/Bubble.js"
|
|
32
52
|
/*!************************************************!*\
|
|
33
53
|
!*** ./dist/browser/Options/Classes/Bubble.js ***!
|
|
34
54
|
\************************************************/
|
|
35
55
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
36
56
|
|
|
37
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Bubble: () => (/* binding */ Bubble)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BubbleBase.js */ \"./dist/browser/Options/Classes/BubbleBase.js\");\n/* harmony import */ var _BubbleDiv_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BubbleDiv.js */ \"./dist/browser/Options/Classes/BubbleDiv.js\");\n\n\n\nclass Bubble extends _BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__.BubbleBase {\n
|
|
57
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Bubble: () => (/* binding */ Bubble)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BubbleBase.js */ \"./dist/browser/Options/Classes/BubbleBase.js\");\n/* harmony import */ var _BubbleDiv_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BubbleDiv.js */ \"./dist/browser/Options/Classes/BubbleDiv.js\");\n\n\n\nclass Bubble extends _BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__.BubbleBase {\n divs;\n load(data) {\n super.load(data);\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n this.divs = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(data.divs, (div)=>{\n const tmp = new _BubbleDiv_js__WEBPACK_IMPORTED_MODULE_2__.BubbleDiv();\n tmp.load(div);\n return tmp;\n });\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Options/Classes/Bubble.js?\n}");
|
|
38
58
|
|
|
39
59
|
/***/ },
|
|
40
60
|
|
|
@@ -44,7 +64,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
44
64
|
\****************************************************/
|
|
45
65
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
46
66
|
|
|
47
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BubbleBase: () => (/* binding */ BubbleBase)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass BubbleBase {\n
|
|
67
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BubbleBase: () => (/* binding */ BubbleBase)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass BubbleBase {\n color;\n distance;\n duration;\n mix;\n opacity;\n size;\n constructor(){\n this.distance = 200;\n this.duration = 0.4;\n this.mix = false;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.distance !== undefined) {\n this.distance = data.distance;\n }\n if (data.duration !== undefined) {\n this.duration = data.duration;\n }\n if (data.mix !== undefined) {\n this.mix = data.mix;\n }\n if (data.opacity !== undefined) {\n this.opacity = data.opacity;\n }\n if (data.color !== undefined) {\n const sourceColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isArray)(this.color) ? undefined : this.color;\n this.color = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(data.color, (color)=>{\n return _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(sourceColor, color);\n });\n }\n if (data.size !== undefined) {\n this.size = data.size;\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Options/Classes/BubbleBase.js?\n}");
|
|
48
68
|
|
|
49
69
|
/***/ },
|
|
50
70
|
|
|
@@ -54,7 +74,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
54
74
|
\***************************************************/
|
|
55
75
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
56
76
|
|
|
57
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BubbleDiv: () => (/* binding */ BubbleDiv)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BubbleBase.js */ \"./dist/browser/Options/Classes/BubbleBase.js\");\n\n\nclass BubbleDiv extends _BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__.BubbleBase {\n
|
|
77
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BubbleDiv: () => (/* binding */ BubbleDiv)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BubbleBase.js */ \"./dist/browser/Options/Classes/BubbleBase.js\");\n\n\nclass BubbleDiv extends _BubbleBase_js__WEBPACK_IMPORTED_MODULE_1__.BubbleBase {\n selectors;\n constructor(){\n super();\n this.selectors = [];\n }\n load(data) {\n super.load(data);\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.selectors !== undefined) {\n this.selectors = data.selectors;\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Options/Classes/BubbleDiv.js?\n}");
|
|
58
78
|
|
|
59
79
|
/***/ },
|
|
60
80
|
|
|
@@ -64,27 +84,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
64
84
|
\*******************************/
|
|
65
85
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
66
86
|
|
|
67
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Bubble: () => (/* reexport safe */ _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__.Bubble),\n/* harmony export */ BubbleBase: () => (/* reexport safe */ _Options_Classes_BubbleBase_js__WEBPACK_IMPORTED_MODULE_0__.BubbleBase),\n/* harmony export */ BubbleDiv: () => (/* reexport safe */ _Options_Classes_BubbleDiv_js__WEBPACK_IMPORTED_MODULE_1__.BubbleDiv),\n/* harmony export */ loadExternalBubbleInteraction: () => (/* binding */ loadExternalBubbleInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_BubbleBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/BubbleBase.js */ \"./dist/browser/Options/Classes/BubbleBase.js\");\n/* harmony import */ var _Options_Classes_BubbleDiv_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/BubbleDiv.js */ \"./dist/browser/Options/Classes/BubbleDiv.js\");\n/* harmony import */ var _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Bubble.js */ \"./dist/browser/Options/Classes/Bubble.js\");\nasync function loadExternalBubbleInteraction(engine) {\n
|
|
68
|
-
|
|
69
|
-
/***/ },
|
|
70
|
-
|
|
71
|
-
/***/ "@tsparticles/engine"
|
|
72
|
-
/*!*********************************************************************************************************************************!*\
|
|
73
|
-
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
74
|
-
\*********************************************************************************************************************************/
|
|
75
|
-
(module) {
|
|
76
|
-
|
|
77
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
78
|
-
|
|
79
|
-
/***/ },
|
|
80
|
-
|
|
81
|
-
/***/ "@tsparticles/plugin-interactivity"
|
|
82
|
-
/*!***************************************************************************************************************************************************************************!*\
|
|
83
|
-
!*** external {"commonjs":"@tsparticles/plugin-interactivity","commonjs2":"@tsparticles/plugin-interactivity","amd":"@tsparticles/plugin-interactivity","root":"window"} ***!
|
|
84
|
-
\***************************************************************************************************************************************************************************/
|
|
85
|
-
(module) {
|
|
86
|
-
|
|
87
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
87
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Bubble: () => (/* reexport safe */ _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__.Bubble),\n/* harmony export */ BubbleBase: () => (/* reexport safe */ _Options_Classes_BubbleBase_js__WEBPACK_IMPORTED_MODULE_0__.BubbleBase),\n/* harmony export */ BubbleDiv: () => (/* reexport safe */ _Options_Classes_BubbleDiv_js__WEBPACK_IMPORTED_MODULE_1__.BubbleDiv),\n/* harmony export */ loadExternalBubbleInteraction: () => (/* binding */ loadExternalBubbleInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_BubbleBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/BubbleBase.js */ \"./dist/browser/Options/Classes/BubbleBase.js\");\n/* harmony import */ var _Options_Classes_BubbleDiv_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/BubbleDiv.js */ \"./dist/browser/Options/Classes/BubbleDiv.js\");\n/* harmony import */ var _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Bubble.js */ \"./dist/browser/Options/Classes/Bubble.js\");\nasync function loadExternalBubbleInteraction(engine) {\n engine.checkVersion(\"4.0.0-beta.0\");\n await engine.register(async (e)=>{\n const { ensureInteractivityPluginLoaded } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! @tsparticles/plugin-interactivity */ \"@tsparticles/plugin-interactivity\", 19));\n ensureInteractivityPluginLoaded(e);\n e.addInteractor?.(\"externalBubble\", async (container)=>{\n const { Bubbler } = await __webpack_require__.e(/*! import() */ \"dist_browser_Bubbler_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Bubbler.js */ \"./dist/browser/Bubbler.js\"));\n return new Bubbler(e, container);\n });\n });\n}\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/index.js?\n}");
|
|
88
88
|
|
|
89
89
|
/***/ }
|
|
90
90
|
|
|
@@ -100,12 +100,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
100
100
|
/******/ if (cachedModule !== undefined) {
|
|
101
101
|
/******/ return cachedModule.exports;
|
|
102
102
|
/******/ }
|
|
103
|
-
/******/ // Check if module exists (development only)
|
|
104
|
-
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
105
|
-
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
106
|
-
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
107
|
-
/******/ throw e;
|
|
108
|
-
/******/ }
|
|
109
103
|
/******/ // Create a new module (and put it into the cache)
|
|
110
104
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
111
105
|
/******/ // no module.id needed
|
|
@@ -114,6 +108,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
114
108
|
/******/ };
|
|
115
109
|
/******/
|
|
116
110
|
/******/ // Execute the module function
|
|
111
|
+
/******/ if (!(moduleId in __webpack_modules__)) {
|
|
112
|
+
/******/ delete __webpack_module_cache__[moduleId];
|
|
113
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
114
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
115
|
+
/******/ throw e;
|
|
116
|
+
/******/ }
|
|
117
117
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
118
118
|
/******/
|
|
119
119
|
/******/ // Return the exports of the module
|
|
@@ -188,6 +188,18 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
188
188
|
/******/ };
|
|
189
189
|
/******/ })();
|
|
190
190
|
/******/
|
|
191
|
+
/******/ /* webpack/runtime/global */
|
|
192
|
+
/******/ (() => {
|
|
193
|
+
/******/ __webpack_require__.g = (function() {
|
|
194
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
195
|
+
/******/ try {
|
|
196
|
+
/******/ return this || new Function('return this')();
|
|
197
|
+
/******/ } catch (e) {
|
|
198
|
+
/******/ if (typeof window === 'object') return window;
|
|
199
|
+
/******/ }
|
|
200
|
+
/******/ })();
|
|
201
|
+
/******/ })();
|
|
202
|
+
/******/
|
|
191
203
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
192
204
|
/******/ (() => {
|
|
193
205
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
@@ -252,8 +264,8 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_plugin_interactivity__;
|
|
|
252
264
|
/******/ /* webpack/runtime/publicPath */
|
|
253
265
|
/******/ (() => {
|
|
254
266
|
/******/ var scriptUrl;
|
|
255
|
-
/******/ if (
|
|
256
|
-
/******/ var document =
|
|
267
|
+
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
268
|
+
/******/ var document = __webpack_require__.g.document;
|
|
257
269
|
/******/ if (!scriptUrl && document) {
|
|
258
270
|
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
|
|
259
271
|
/******/ 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/engine"),require("@tsparticles/plugin-interactivity"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/plugin-interactivity"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/plugin-interactivity")):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,o,n={303(t){t.exports=e},702(e){e.exports=t},767(e,t,r){r.d(t,{Z:()=>a});var i=r(303),o=r(782),n=r(912);class a extends o.u{divs;load(e){super.load(e),(0,i.isNull)(e)||(this.divs=(0,i.executeOnSingleOrMultiple)(e.divs,e=>{let t=new n.C;return t.load(e),t}))}}},782(e,t,r){r.d(t,{u:()=>o});var i=r(303);class o{color;distance;duration;mix;opacity;size;constructor(){this.distance=200,this.duration=.4,this.mix=!1}load(e){if(!(0,i.isNull)(e)){if(void 0!==e.distance&&(this.distance=e.distance),void 0!==e.duration&&(this.duration=e.duration),void 0!==e.mix&&(this.mix=e.mix),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.color){let t=(0,i.isArray)(this.color)?void 0:this.color;this.color=(0,i.executeOnSingleOrMultiple)(e.color,e=>i.OptionsColor.create(t,e))}void 0!==e.size&&(this.size=e.size)}}}},912(e,t,r){r.d(t,{C:()=>n});var i=r(303),o=r(782);class n extends o.u{selectors;constructor(){super(),this.selectors=[]}load(e){super.load(e),(0,i.isNull)(e)||void 0!==e.selectors&&(this.selectors=e.selectors)}}}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return n[e](r,r.exports,s),r.exports}s.m=n,c=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 i={};l=l||[null,c({}),c([]),c(c)];for(var o=2&t&&e;("object"==typeof o||"function"==typeof o)&&!~l.indexOf(o);o=c(o))Object.getOwnPropertyNames(o).forEach(t=>i[t]=()=>e[t]);return i.default=()=>e,s.d(r,i),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),u={},s.l=(e,t,r,i)=>{if(u[e])return void u[e].push(t);if(void 0!==r)for(var o,n,a=document.getElementsByTagName("script"),l=0;l<a.length;l++){var c=a[l];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")=="@tsparticles/interaction-external-bubble:"+r){o=c;break}}o||(n=!0,(o=document.createElement("script")).charset="utf-8",s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-webpack","@tsparticles/interaction-external-bubble:"+r),o.src=e),u[e]=[t];var p=(t,r)=>{o.onerror=o.onload=null,clearTimeout(d);var i=u[e];if(delete u[e],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(e=>e(r)),t)return t(r)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=p.bind(null,o.onerror),o.onload=p.bind(null,o.onload),n&&document.head.appendChild(o)},s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(p=s.g.location+"");var l,c,u,p,d=s.g.document;if(!p&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(p=d.currentScript.src),!p)){var b=d.getElementsByTagName("script");if(b.length)for(var f=b.length-1;f>-1&&(!p||!/^http(s?):/.test(p));)p=b[f--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");s.p=p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r={108:0},s.f.j=(e,t)=>{var i=s.o(r,e)?r[e]:void 0;if(0!==i)if(i)t.push(i[2]);else{var o=new Promise((t,o)=>i=r[e]=[t,o]);t.push(i[2]=o);var n=s.p+s.u(e),a=Error();s.l(n,t=>{if(s.o(r,e)&&(0!==(i=r[e])&&(r[e]=void 0),i)){var o=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;a.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+o+": "+n+")",a.name="ChunkLoadError",a.type=o,a.request=n,i[1](a)}},"chunk-"+e,e)}},i=(e,t)=>{var i,o,[n,a,l]=t,c=0;if(n.some(e=>0!==r[e])){for(i in a)s.o(a,i)&&(s.m[i]=a[i]);l&&l(s)}for(e&&e(t);c<n.length;c++)o=n[c],s.o(r,o)&&r[o]&&r[o][0](),r[o]=0},(o=this.webpackChunk_tsparticles_interaction_external_bubble=this.webpackChunk_tsparticles_interaction_external_bubble||[]).forEach(i.bind(null,0)),o.push=i.bind(null,o.push.bind(o));var h={};s.r(h),s.d(h,{Bubble:()=>g.Z,BubbleBase:()=>v.u,BubbleDiv:()=>y.C,loadExternalBubbleInteraction:()=>m});var v=s(782),y=s(912),g=s(767);async function m(e){e.checkVersion("4.0.0-beta.0"),await e.register(async e=>{let{ensureInteractivityPluginLoaded:t}=await Promise.resolve().then(s.t.bind(s,702,19));t(e),e.addInteractor?.("externalBubble",async t=>{let{Bubbler:r}=await s.e(537).then(s.bind(s,537));return new r(e,t)})})}return h})());
|
package/types/Bubbler.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ import { ExternalInteractorBase, type IInteractivityData, type IModes, type Inte
|
|
|
4
4
|
export declare class Bubbler extends ExternalInteractorBase<BubbleContainer> {
|
|
5
5
|
handleClickMode: (mode: string, interactivityData: IInteractivityData) => void;
|
|
6
6
|
private readonly _engine;
|
|
7
|
+
private _maxDistance;
|
|
7
8
|
constructor(engine: Engine, container: BubbleContainer);
|
|
9
|
+
get maxDistance(): number;
|
|
8
10
|
clear(particle: Particle, _delta: IDelta, force?: boolean): void;
|
|
9
11
|
init(): void;
|
|
10
12
|
interact(interactivityData: IInteractivityData, delta: IDelta): void;
|
package/umd/Bubbler.js
CHANGED
|
@@ -17,207 +17,13 @@
|
|
|
17
17
|
const Utils_js_1 = require("./Utils.js");
|
|
18
18
|
const bubbleMode = "bubble", minDistance = 0, defaultClickTime = 0, defaultOpacity = 1, ratioOffset = 1, defaultBubbleValue = 0, minRatio = 0, defaultRatio = 1;
|
|
19
19
|
class Bubbler extends plugin_interactivity_1.ExternalInteractorBase {
|
|
20
|
+
handleClickMode;
|
|
21
|
+
_engine;
|
|
22
|
+
_maxDistance;
|
|
20
23
|
constructor(engine, container) {
|
|
21
24
|
super(container);
|
|
22
|
-
this._clickBubble = interactivityData => {
|
|
23
|
-
const container = this.container, options = container.actualOptions, mouseClickPos = interactivityData.mouse.clickPosition, bubbleOptions = options.interactivity?.modes.bubble;
|
|
24
|
-
if (!bubbleOptions || !mouseClickPos) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
container.bubble ??= {};
|
|
28
|
-
const distance = container.retina.bubbleModeDistance;
|
|
29
|
-
if (!distance || distance < minDistance) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(interactivityData, p)), { bubble } = container;
|
|
33
|
-
for (const particle of query) {
|
|
34
|
-
if (!bubble.clicking) {
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
particle.bubble.inRange = !bubble.durationEnd;
|
|
38
|
-
const pos = particle.getPosition(), distMouse = (0, engine_1.getDistance)(pos, mouseClickPos), timeSpent = (new Date().getTime() - (interactivityData.mouse.clickTime ?? defaultClickTime)) / engine_1.millisecondsToSeconds;
|
|
39
|
-
if (timeSpent > bubbleOptions.duration) {
|
|
40
|
-
bubble.durationEnd = true;
|
|
41
|
-
}
|
|
42
|
-
if (timeSpent > bubbleOptions.duration * engine_1.double) {
|
|
43
|
-
bubble.clicking = false;
|
|
44
|
-
bubble.durationEnd = false;
|
|
45
|
-
}
|
|
46
|
-
const sizeData = {
|
|
47
|
-
bubbleObj: {
|
|
48
|
-
optValue: container.retina.bubbleModeSize,
|
|
49
|
-
value: particle.bubble.radius,
|
|
50
|
-
},
|
|
51
|
-
particlesObj: {
|
|
52
|
-
optValue: (0, engine_1.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,
|
|
53
|
-
value: particle.size.value,
|
|
54
|
-
},
|
|
55
|
-
type: Enums_js_1.ProcessBubbleType.size,
|
|
56
|
-
};
|
|
57
|
-
this._process(particle, distMouse, timeSpent, sizeData);
|
|
58
|
-
const opacityData = {
|
|
59
|
-
bubbleObj: {
|
|
60
|
-
optValue: bubbleOptions.opacity,
|
|
61
|
-
value: particle.bubble.opacity,
|
|
62
|
-
},
|
|
63
|
-
particlesObj: {
|
|
64
|
-
optValue: (0, engine_1.getRangeMax)(particle.options.opacity.value),
|
|
65
|
-
value: particle.opacity?.value ?? defaultOpacity,
|
|
66
|
-
},
|
|
67
|
-
type: Enums_js_1.ProcessBubbleType.opacity,
|
|
68
|
-
};
|
|
69
|
-
this._process(particle, distMouse, timeSpent, opacityData);
|
|
70
|
-
if (!bubble.durationEnd && distMouse <= distance) {
|
|
71
|
-
this._hoverBubbleColor(particle, distMouse);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
delete particle.bubble.color;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
this._hoverBubble = interactivityData => {
|
|
79
|
-
const container = this.container, mousePos = interactivityData.mouse.position, distance = container.retina.bubbleModeDistance;
|
|
80
|
-
if (!distance || distance < minDistance || !mousePos) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(interactivityData, p));
|
|
84
|
-
for (const particle of query) {
|
|
85
|
-
particle.bubble.inRange = true;
|
|
86
|
-
const pos = particle.getPosition(), pointDistance = (0, engine_1.getDistance)(pos, mousePos), ratio = ratioOffset - pointDistance / distance;
|
|
87
|
-
if (pointDistance <= distance) {
|
|
88
|
-
if (ratio >= minRatio && interactivityData.status === plugin_interactivity_1.mouseMoveEvent) {
|
|
89
|
-
this._hoverBubbleSize(particle, ratio);
|
|
90
|
-
this._hoverBubbleOpacity(particle, ratio);
|
|
91
|
-
this._hoverBubbleColor(particle, ratio);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
this.reset(interactivityData, particle);
|
|
96
|
-
}
|
|
97
|
-
if (interactivityData.status === plugin_interactivity_1.mouseLeaveEvent) {
|
|
98
|
-
this.reset(interactivityData, particle);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
this._hoverBubbleColor = (particle, ratio, divBubble) => {
|
|
103
|
-
const options = this.container.actualOptions, bubbleOptions = divBubble ?? options.interactivity?.modes.bubble;
|
|
104
|
-
if (!bubbleOptions) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (!particle.bubble.finalColor) {
|
|
108
|
-
const modeColor = bubbleOptions.color;
|
|
109
|
-
if (!modeColor) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const bubbleColor = (0, engine_1.itemFromSingleOrMultiple)(modeColor);
|
|
113
|
-
particle.bubble.finalColor = (0, engine_1.rangeColorToHsl)(this._engine, bubbleColor);
|
|
114
|
-
}
|
|
115
|
-
if (!particle.bubble.finalColor) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (bubbleOptions.mix) {
|
|
119
|
-
particle.bubble.color = undefined;
|
|
120
|
-
const pColor = particle.getFillColor();
|
|
121
|
-
particle.bubble.color = pColor
|
|
122
|
-
? (0, engine_1.rgbToHsl)((0, engine_1.colorMix)(pColor, particle.bubble.finalColor, ratioOffset - ratio, ratio))
|
|
123
|
-
: particle.bubble.finalColor;
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
particle.bubble.color = particle.bubble.finalColor;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
this._hoverBubbleOpacity = (particle, ratio, divBubble) => {
|
|
130
|
-
const container = this.container, options = container.actualOptions, modeOpacity = divBubble?.opacity ?? options.interactivity?.modes.bubble?.opacity;
|
|
131
|
-
if (!modeOpacity) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const optOpacity = particle.options.opacity.value, pOpacity = particle.opacity?.value ?? defaultOpacity, opacity = (0, Utils_js_1.calculateBubbleValue)(pOpacity, modeOpacity, (0, engine_1.getRangeMax)(optOpacity), ratio);
|
|
135
|
-
if (opacity !== undefined) {
|
|
136
|
-
particle.bubble.opacity = opacity;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
this._hoverBubbleSize = (particle, ratio, divBubble) => {
|
|
140
|
-
const container = this.container, modeSize = divBubble?.size ? divBubble.size * container.retina.pixelRatio : container.retina.bubbleModeSize;
|
|
141
|
-
if (modeSize === undefined) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
const optSize = (0, engine_1.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio, pSize = particle.size.value, size = (0, Utils_js_1.calculateBubbleValue)(pSize, modeSize, optSize, ratio);
|
|
145
|
-
if (size !== undefined) {
|
|
146
|
-
particle.bubble.radius = size;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
this._process = (particle, distMouse, timeSpent, data) => {
|
|
150
|
-
const container = this.container, bubbleParam = data.bubbleObj.optValue, options = container.actualOptions, bubbleOptions = options.interactivity?.modes.bubble;
|
|
151
|
-
if (!bubbleOptions || bubbleParam === undefined) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const bubbleDuration = bubbleOptions.duration, bubbleDistance = container.retina.bubbleModeDistance, particlesParam = data.particlesObj.optValue, pObjBubble = data.bubbleObj.value, pObj = data.particlesObj.value ?? defaultBubbleValue, type = data.type;
|
|
155
|
-
if (!bubbleDistance || bubbleDistance < minDistance || bubbleParam === particlesParam) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
container.bubble ??= {};
|
|
159
|
-
if (container.bubble.durationEnd) {
|
|
160
|
-
if (pObjBubble) {
|
|
161
|
-
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
162
|
-
delete particle.bubble.radius;
|
|
163
|
-
}
|
|
164
|
-
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
165
|
-
delete particle.bubble.opacity;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
if (distMouse <= bubbleDistance) {
|
|
171
|
-
const obj = pObjBubble ?? pObj;
|
|
172
|
-
if (obj !== bubbleParam) {
|
|
173
|
-
const value = pObj - (timeSpent * (pObj - bubbleParam)) / bubbleDuration;
|
|
174
|
-
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
175
|
-
particle.bubble.radius = value;
|
|
176
|
-
}
|
|
177
|
-
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
178
|
-
particle.bubble.opacity = value;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
184
|
-
delete particle.bubble.radius;
|
|
185
|
-
}
|
|
186
|
-
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
187
|
-
delete particle.bubble.opacity;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
this._singleSelectorHover = (interactivityData, delta, selector, div) => {
|
|
193
|
-
const container = this.container, selectors = (0, engine_1.safeDocument)().querySelectorAll(selector), bubble = container.actualOptions.interactivity?.modes.bubble;
|
|
194
|
-
if (!bubble || !selectors.length) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
selectors.forEach(item => {
|
|
198
|
-
const elem = item, pxRatio = container.retina.pixelRatio, pos = {
|
|
199
|
-
x: (elem.offsetLeft + elem.offsetWidth * engine_1.half) * pxRatio,
|
|
200
|
-
y: (elem.offsetTop + elem.offsetHeight * engine_1.half) * pxRatio,
|
|
201
|
-
}, repulseRadius = elem.offsetWidth * engine_1.half * pxRatio, area = div.type === plugin_interactivity_1.DivType.circle
|
|
202
|
-
? new engine_1.Circle(pos.x, pos.y, repulseRadius)
|
|
203
|
-
: new engine_1.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.quadTree.query(area, p => this.isEnabled(interactivityData, p));
|
|
204
|
-
for (const particle of query) {
|
|
205
|
-
if (!area.contains(particle.getPosition())) {
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
particle.bubble.inRange = true;
|
|
209
|
-
const divs = bubble.divs, divBubble = (0, plugin_interactivity_1.divMode)(divs, elem);
|
|
210
|
-
if (!particle.bubble.div || particle.bubble.div !== elem) {
|
|
211
|
-
this.clear(particle, delta, true);
|
|
212
|
-
particle.bubble.div = elem;
|
|
213
|
-
}
|
|
214
|
-
this._hoverBubbleSize(particle, defaultRatio, divBubble);
|
|
215
|
-
this._hoverBubbleOpacity(particle, defaultRatio, divBubble);
|
|
216
|
-
this._hoverBubbleColor(particle, defaultRatio, divBubble);
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
25
|
this._engine = engine;
|
|
26
|
+
this._maxDistance = 0;
|
|
221
27
|
container.bubble ??= {};
|
|
222
28
|
this.handleClickMode = (mode) => {
|
|
223
29
|
if (mode !== bubbleMode) {
|
|
@@ -227,6 +33,9 @@
|
|
|
227
33
|
container.bubble.clicking = true;
|
|
228
34
|
};
|
|
229
35
|
}
|
|
36
|
+
get maxDistance() {
|
|
37
|
+
return this._maxDistance;
|
|
38
|
+
}
|
|
230
39
|
clear(particle, _delta, force) {
|
|
231
40
|
if (particle.bubble.inRange && !force) {
|
|
232
41
|
return;
|
|
@@ -241,6 +50,7 @@
|
|
|
241
50
|
if (!bubble) {
|
|
242
51
|
return;
|
|
243
52
|
}
|
|
53
|
+
this._maxDistance = bubble.distance;
|
|
244
54
|
container.retina.bubbleModeDistance = bubble.distance * container.retina.pixelRatio;
|
|
245
55
|
if (bubble.size !== undefined) {
|
|
246
56
|
container.retina.bubbleModeSize = bubble.size * container.retina.pixelRatio;
|
|
@@ -284,6 +94,204 @@
|
|
|
284
94
|
reset(_interactivityData, particle) {
|
|
285
95
|
particle.bubble.inRange = false;
|
|
286
96
|
}
|
|
97
|
+
_clickBubble = interactivityData => {
|
|
98
|
+
const container = this.container, options = container.actualOptions, mouseClickPos = interactivityData.mouse.clickPosition, bubbleOptions = options.interactivity?.modes.bubble;
|
|
99
|
+
if (!bubbleOptions || !mouseClickPos) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
container.bubble ??= {};
|
|
103
|
+
const distance = container.retina.bubbleModeDistance;
|
|
104
|
+
if (!distance || distance < minDistance) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const query = container.particles.grid.queryCircle(mouseClickPos, distance, p => this.isEnabled(interactivityData, p)), { bubble } = container;
|
|
108
|
+
for (const particle of query) {
|
|
109
|
+
if (!bubble.clicking) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
particle.bubble.inRange = !bubble.durationEnd;
|
|
113
|
+
const pos = particle.getPosition(), distMouse = (0, engine_1.getDistance)(pos, mouseClickPos), timeSpent = (performance.now() - (interactivityData.mouse.clickTime ?? defaultClickTime)) / engine_1.millisecondsToSeconds;
|
|
114
|
+
if (timeSpent > bubbleOptions.duration) {
|
|
115
|
+
bubble.durationEnd = true;
|
|
116
|
+
}
|
|
117
|
+
if (timeSpent > bubbleOptions.duration * engine_1.double) {
|
|
118
|
+
bubble.clicking = false;
|
|
119
|
+
bubble.durationEnd = false;
|
|
120
|
+
}
|
|
121
|
+
const sizeData = {
|
|
122
|
+
bubbleObj: {
|
|
123
|
+
optValue: container.retina.bubbleModeSize,
|
|
124
|
+
value: particle.bubble.radius,
|
|
125
|
+
},
|
|
126
|
+
particlesObj: {
|
|
127
|
+
optValue: (0, engine_1.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,
|
|
128
|
+
value: particle.size.value,
|
|
129
|
+
},
|
|
130
|
+
type: Enums_js_1.ProcessBubbleType.size,
|
|
131
|
+
};
|
|
132
|
+
this._process(particle, distMouse, timeSpent, sizeData);
|
|
133
|
+
const opacityData = {
|
|
134
|
+
bubbleObj: {
|
|
135
|
+
optValue: bubbleOptions.opacity,
|
|
136
|
+
value: particle.bubble.opacity,
|
|
137
|
+
},
|
|
138
|
+
particlesObj: {
|
|
139
|
+
optValue: (0, engine_1.getRangeMax)(particle.options.opacity.value),
|
|
140
|
+
value: particle.opacity?.value ?? defaultOpacity,
|
|
141
|
+
},
|
|
142
|
+
type: Enums_js_1.ProcessBubbleType.opacity,
|
|
143
|
+
};
|
|
144
|
+
this._process(particle, distMouse, timeSpent, opacityData);
|
|
145
|
+
if (!bubble.durationEnd && distMouse <= distance) {
|
|
146
|
+
this._hoverBubbleColor(particle, distMouse);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
delete particle.bubble.color;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
_hoverBubble = interactivityData => {
|
|
154
|
+
const container = this.container, mousePos = interactivityData.mouse.position, distance = container.retina.bubbleModeDistance;
|
|
155
|
+
if (!distance || distance < minDistance || !mousePos) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const query = container.particles.grid.queryCircle(mousePos, distance, p => this.isEnabled(interactivityData, p));
|
|
159
|
+
for (const particle of query) {
|
|
160
|
+
particle.bubble.inRange = true;
|
|
161
|
+
const pos = particle.getPosition(), pointDistance = (0, engine_1.getDistance)(pos, mousePos), ratio = ratioOffset - pointDistance / distance;
|
|
162
|
+
if (pointDistance <= distance) {
|
|
163
|
+
if (ratio >= minRatio && interactivityData.status === plugin_interactivity_1.mouseMoveEvent) {
|
|
164
|
+
this._hoverBubbleSize(particle, ratio);
|
|
165
|
+
this._hoverBubbleOpacity(particle, ratio);
|
|
166
|
+
this._hoverBubbleColor(particle, ratio);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
this.reset(interactivityData, particle);
|
|
171
|
+
}
|
|
172
|
+
if (interactivityData.status === plugin_interactivity_1.mouseLeaveEvent) {
|
|
173
|
+
this.reset(interactivityData, particle);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
_hoverBubbleColor = (particle, ratio, divBubble) => {
|
|
178
|
+
const options = this.container.actualOptions, bubbleOptions = divBubble ?? options.interactivity?.modes.bubble;
|
|
179
|
+
if (!bubbleOptions) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (!particle.bubble.finalColor) {
|
|
183
|
+
const modeColor = bubbleOptions.color;
|
|
184
|
+
if (!modeColor) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const bubbleColor = (0, engine_1.itemFromSingleOrMultiple)(modeColor);
|
|
188
|
+
particle.bubble.finalColor = (0, engine_1.rangeColorToHsl)(this._engine, bubbleColor);
|
|
189
|
+
}
|
|
190
|
+
if (!particle.bubble.finalColor) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (bubbleOptions.mix) {
|
|
194
|
+
particle.bubble.color = undefined;
|
|
195
|
+
const pColor = particle.getFillColor();
|
|
196
|
+
particle.bubble.color = pColor
|
|
197
|
+
? (0, engine_1.rgbToHsl)((0, engine_1.colorMix)(pColor, particle.bubble.finalColor, ratioOffset - ratio, ratio))
|
|
198
|
+
: particle.bubble.finalColor;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
particle.bubble.color = particle.bubble.finalColor;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
_hoverBubbleOpacity = (particle, ratio, divBubble) => {
|
|
205
|
+
const container = this.container, options = container.actualOptions, modeOpacity = divBubble?.opacity ?? options.interactivity?.modes.bubble?.opacity;
|
|
206
|
+
if (!modeOpacity) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const optOpacity = particle.options.opacity.value, pOpacity = particle.opacity?.value ?? defaultOpacity, opacity = (0, Utils_js_1.calculateBubbleValue)(pOpacity, modeOpacity, (0, engine_1.getRangeMax)(optOpacity), ratio);
|
|
210
|
+
if (opacity !== undefined) {
|
|
211
|
+
particle.bubble.opacity = opacity;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
_hoverBubbleSize = (particle, ratio, divBubble) => {
|
|
215
|
+
const container = this.container, modeSize = divBubble?.size ? divBubble.size * container.retina.pixelRatio : container.retina.bubbleModeSize;
|
|
216
|
+
if (modeSize === undefined) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const optSize = (0, engine_1.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio, pSize = particle.size.value, size = (0, Utils_js_1.calculateBubbleValue)(pSize, modeSize, optSize, ratio);
|
|
220
|
+
if (size !== undefined) {
|
|
221
|
+
particle.bubble.radius = size;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
_process = (particle, distMouse, timeSpent, data) => {
|
|
225
|
+
const container = this.container, bubbleParam = data.bubbleObj.optValue, options = container.actualOptions, bubbleOptions = options.interactivity?.modes.bubble;
|
|
226
|
+
if (!bubbleOptions || bubbleParam === undefined) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const bubbleDuration = bubbleOptions.duration, bubbleDistance = container.retina.bubbleModeDistance, particlesParam = data.particlesObj.optValue, pObjBubble = data.bubbleObj.value, pObj = data.particlesObj.value ?? defaultBubbleValue, type = data.type;
|
|
230
|
+
if (!bubbleDistance || bubbleDistance < minDistance || bubbleParam === particlesParam) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
container.bubble ??= {};
|
|
234
|
+
if (container.bubble.durationEnd) {
|
|
235
|
+
if (pObjBubble) {
|
|
236
|
+
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
237
|
+
delete particle.bubble.radius;
|
|
238
|
+
}
|
|
239
|
+
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
240
|
+
delete particle.bubble.opacity;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
if (distMouse <= bubbleDistance) {
|
|
246
|
+
const obj = pObjBubble ?? pObj;
|
|
247
|
+
if (obj !== bubbleParam) {
|
|
248
|
+
const value = pObj - (timeSpent * (pObj - bubbleParam)) / bubbleDuration;
|
|
249
|
+
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
250
|
+
particle.bubble.radius = value;
|
|
251
|
+
}
|
|
252
|
+
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
253
|
+
particle.bubble.opacity = value;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
if (type === Enums_js_1.ProcessBubbleType.size) {
|
|
259
|
+
delete particle.bubble.radius;
|
|
260
|
+
}
|
|
261
|
+
if (type === Enums_js_1.ProcessBubbleType.opacity) {
|
|
262
|
+
delete particle.bubble.opacity;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
_singleSelectorHover = (interactivityData, delta, selector, div) => {
|
|
268
|
+
const container = this.container, selectors = (0, engine_1.safeDocument)().querySelectorAll(selector), bubble = container.actualOptions.interactivity?.modes.bubble;
|
|
269
|
+
if (!bubble || !selectors.length) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
selectors.forEach(item => {
|
|
273
|
+
const elem = item, pxRatio = container.retina.pixelRatio, pos = {
|
|
274
|
+
x: (elem.offsetLeft + elem.offsetWidth * engine_1.half) * pxRatio,
|
|
275
|
+
y: (elem.offsetTop + elem.offsetHeight * engine_1.half) * pxRatio,
|
|
276
|
+
}, repulseRadius = elem.offsetWidth * engine_1.half * pxRatio, area = div.type === plugin_interactivity_1.DivType.circle
|
|
277
|
+
? new engine_1.Circle(pos.x, pos.y, repulseRadius)
|
|
278
|
+
: new engine_1.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), query = container.particles.grid.query(area, p => this.isEnabled(interactivityData, p));
|
|
279
|
+
for (const particle of query) {
|
|
280
|
+
if (!area.contains(particle.getPosition())) {
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
particle.bubble.inRange = true;
|
|
284
|
+
const divs = bubble.divs, divBubble = (0, plugin_interactivity_1.divMode)(divs, elem);
|
|
285
|
+
if (!particle.bubble.div || particle.bubble.div !== elem) {
|
|
286
|
+
this.clear(particle, delta, true);
|
|
287
|
+
particle.bubble.div = elem;
|
|
288
|
+
}
|
|
289
|
+
this._hoverBubbleSize(particle, defaultRatio, divBubble);
|
|
290
|
+
this._hoverBubbleOpacity(particle, defaultRatio, divBubble);
|
|
291
|
+
this._hoverBubbleColor(particle, defaultRatio, divBubble);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
};
|
|
287
295
|
}
|
|
288
296
|
exports.Bubbler = Bubbler;
|
|
289
297
|
});
|