@tsparticles/interaction-external-bubble 3.2.2 → 3.3.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/201.min.js +2 -0
- package/201.min.js.LICENSE.txt +1 -0
- package/browser/Bubbler.js +1 -2
- package/cjs/Bubbler.js +1 -2
- package/cjs/index.js +1 -13
- package/dist_browser_Bubbler_js.js +2 -2
- package/esm/Bubbler.js +1 -2
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.interaction.external.bubble.js +2 -2
- package/tsparticles.interaction.external.bubble.min.js +1 -1
- package/tsparticles.interaction.external.bubble.min.js.LICENSE.txt +1 -1
- package/types/Bubbler.d.ts +1 -1
- package/umd/Bubbler.js +1 -2
- package/582.min.js +0 -2
- package/582.min.js.LICENSE.txt +0 -1
package/201.min.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 201.min.js.LICENSE.txt */
|
|
2
|
+
(this.webpackChunk_tsparticles_interaction_external_bubble=this.webpackChunk_tsparticles_interaction_external_bubble||[]).push([[201],{201:(e,t,i)=>{i.d(t,{Bubbler:()=>a});var b=i(303),o=i(510);function l(e,t,i,o){if(t>=i){const l=e+(t-i)*o;return(0,b.clamp)(l,e,t)}if(t<i){const l=e-(i-t)*o;return(0,b.clamp)(l,t,e)}}const n="bubble";class a extends b.ExternalInteractorBase{constructor(e){super(e),this._clickBubble=()=>{const e=this.container,t=e.actualOptions,i=e.interactivity.mouse.clickPosition,o=t.interactivity.modes.bubble;if(!o||!i)return;e.bubble||(e.bubble={});const l=e.retina.bubbleModeDistance;if(!l||l<0)return;const n=e.particles.quadTree.queryCircle(i,l,(e=>this.isEnabled(e))),{bubble:a}=e;for(const t of n){if(!a.clicking)continue;t.bubble.inRange=!a.durationEnd;const n=t.getPosition(),s=(0,b.getDistance)(n,i),r=((new Date).getTime()-(e.interactivity.mouse.clickTime??0))/b.millisecondsToSeconds;r>o.duration&&(a.durationEnd=!0),r>2*o.duration&&(a.clicking=!1,a.durationEnd=!1);const c={bubbleObj:{optValue:e.retina.bubbleModeSize,value:t.bubble.radius},particlesObj:{optValue:(0,b.getRangeMax)(t.options.size.value)*e.retina.pixelRatio,value:t.size.value},type:"size"};this._process(t,s,r,c);const u={bubbleObj:{optValue:o.opacity,value:t.bubble.opacity},particlesObj:{optValue:(0,b.getRangeMax)(t.options.opacity.value),value:t.opacity?.value??1},type:"opacity"};this._process(t,s,r,u),!a.durationEnd&&s<=l?this._hoverBubbleColor(t,s):delete t.bubble.color}},this._hoverBubble=()=>{const e=this.container,t=e.interactivity.mouse.position,i=e.retina.bubbleModeDistance;if(!i||i<0||!t)return;const o=e.particles.quadTree.queryCircle(t,i,(e=>this.isEnabled(e)));for(const l of o){l.bubble.inRange=!0;const o=l.getPosition(),n=(0,b.getDistance)(o,t),a=1-n/i;n<=i?a>=0&&e.interactivity.status===b.mouseMoveEvent&&(this._hoverBubbleSize(l,a),this._hoverBubbleOpacity(l,a),this._hoverBubbleColor(l,a)):this.reset(l),e.interactivity.status===b.mouseLeaveEvent&&this.reset(l)}},this._hoverBubbleColor=(e,t,i)=>{const o=this.container.actualOptions,l=i??o.interactivity.modes.bubble;if(l){if(!e.bubble.finalColor){const t=l.color;if(!t)return;const i=(0,b.itemFromSingleOrMultiple)(t);e.bubble.finalColor=(0,b.rangeColorToHsl)(i)}if(e.bubble.finalColor)if(l.mix){e.bubble.color=void 0;const i=e.getFillColor();e.bubble.color=i?(0,b.rgbToHsl)((0,b.colorMix)(i,e.bubble.finalColor,1-t,t)):e.bubble.finalColor}else e.bubble.color=e.bubble.finalColor}},this._hoverBubbleOpacity=(e,t,i)=>{const o=this.container.actualOptions,n=i?.opacity??o.interactivity.modes.bubble?.opacity;if(!n)return;const a=e.options.opacity.value,s=l(e.opacity?.value??1,n,(0,b.getRangeMax)(a),t);void 0!==s&&(e.bubble.opacity=s)},this._hoverBubbleSize=(e,t,i)=>{const o=this.container,n=i?.size?i.size*o.retina.pixelRatio:o.retina.bubbleModeSize;if(void 0===n)return;const a=(0,b.getRangeMax)(e.options.size.value)*o.retina.pixelRatio,s=l(e.size.value,n,a,t);void 0!==s&&(e.bubble.radius=s)},this._process=(e,t,i,b)=>{const o=this.container,l=b.bubbleObj.optValue,n=o.actualOptions.interactivity.modes.bubble;if(!n||void 0===l)return;const a=n.duration,s=o.retina.bubbleModeDistance,r=b.particlesObj.optValue,c=b.bubbleObj.value,u=b.particlesObj.value??0,d=b.type;if(s&&!(s<0)&&l!==r)if(o.bubble||(o.bubble={}),o.bubble.durationEnd)c&&("size"===d&&delete e.bubble.radius,"opacity"===d&&delete e.bubble.opacity);else if(t<=s){if((c??u)!==l){const t=u-i*(u-l)/a;"size"===d&&(e.bubble.radius=t),"opacity"===d&&(e.bubble.opacity=t)}}else"size"===d&&delete e.bubble.radius,"opacity"===d&&delete e.bubble.opacity},this._singleSelectorHover=(e,t,i)=>{const o=this.container,l=document.querySelectorAll(t),n=o.actualOptions.interactivity.modes.bubble;n&&l.length&&l.forEach((t=>{const l=t,a=o.retina.pixelRatio,s={x:(l.offsetLeft+.5*l.offsetWidth)*a,y:(l.offsetTop+.5*l.offsetHeight)*a},r=.5*l.offsetWidth*a,c="circle"===i.type?new b.Circle(s.x,s.y,r):new b.Rectangle(l.offsetLeft*a,l.offsetTop*a,l.offsetWidth*a,l.offsetHeight*a),u=o.particles.quadTree.query(c,(e=>this.isEnabled(e)));for(const t of u){if(!c.contains(t.getPosition()))continue;t.bubble.inRange=!0;const i=n.divs,o=(0,b.divMode)(i,l);t.bubble.div&&t.bubble.div===l||(this.clear(t,e,!0),t.bubble.div=l),this._hoverBubbleSize(t,1,o),this._hoverBubbleOpacity(t,1,o),this._hoverBubbleColor(t,1,o)}}))},e.bubble||(e.bubble={}),this.handleClickMode=t=>{t===n&&(e.bubble||(e.bubble={}),e.bubble.clicking=!0)}}clear(e,t,i){e.bubble.inRange&&!i||(delete e.bubble.div,delete e.bubble.opacity,delete e.bubble.radius,delete e.bubble.color)}init(){const e=this.container,t=e.actualOptions.interactivity.modes.bubble;t&&(e.retina.bubbleModeDistance=t.distance*e.retina.pixelRatio,void 0!==t.size&&(e.retina.bubbleModeSize=t.size*e.retina.pixelRatio))}interact(e){const t=this.container.actualOptions.interactivity.events,i=t.onHover,o=t.onClick,l=i.enable,a=i.mode,s=o.enable,r=o.mode,c=t.onDiv;l&&(0,b.isInArray)(n,a)?this._hoverBubble():s&&(0,b.isInArray)(n,r)?this._clickBubble():(0,b.divModeExecute)(n,c,((t,i)=>this._singleSelectorHover(e,t,i)))}isEnabled(e){const t=this.container,i=t.actualOptions,o=t.interactivity.mouse,l=(e?.interactivity??i.interactivity).events,{onClick:a,onDiv:s,onHover:r}=l,c=(0,b.isDivModeEnabled)(n,s);return!!(c||r.enable&&o.position||a.enable&&o.clickPosition)&&((0,b.isInArray)(n,r.mode)||(0,b.isInArray)(n,a.mode)||c)}loadModeOptions(e,...t){e.bubble||(e.bubble=new o.Z);for(const i of t)e.bubble.load(i?.bubble)}reset(e){e.bubble.inRange=!1}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Bubble External Interaction v3.3.0 by Matteo Bruni */
|
package/browser/Bubbler.js
CHANGED
|
@@ -240,7 +240,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
240
240
|
container.retina.bubbleModeSize = bubble.size * container.retina.pixelRatio;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
|
|
243
|
+
interact(delta) {
|
|
244
244
|
const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
|
|
245
245
|
if (hoverEnabled && isInArray(bubbleMode, hoverMode)) {
|
|
246
246
|
this._hoverBubble();
|
|
@@ -251,7 +251,6 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
251
251
|
else {
|
|
252
252
|
divModeExecute(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
|
|
253
253
|
}
|
|
254
|
-
await Promise.resolve();
|
|
255
254
|
}
|
|
256
255
|
isEnabled(particle) {
|
|
257
256
|
const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, { onClick, onDiv, onHover } = events, divBubble = isDivModeEnabled(bubbleMode, onDiv);
|
package/cjs/Bubbler.js
CHANGED
|
@@ -243,7 +243,7 @@ class Bubbler extends engine_1.ExternalInteractorBase {
|
|
|
243
243
|
container.retina.bubbleModeSize = bubble.size * container.retina.pixelRatio;
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
|
|
246
|
+
interact(delta) {
|
|
247
247
|
const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
|
|
248
248
|
if (hoverEnabled && (0, engine_1.isInArray)(bubbleMode, hoverMode)) {
|
|
249
249
|
this._hoverBubble();
|
|
@@ -254,7 +254,6 @@ class Bubbler extends engine_1.ExternalInteractorBase {
|
|
|
254
254
|
else {
|
|
255
255
|
(0, engine_1.divModeExecute)(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
|
|
256
256
|
}
|
|
257
|
-
await Promise.resolve();
|
|
258
257
|
}
|
|
259
258
|
isEnabled(particle) {
|
|
260
259
|
const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, { onClick, onDiv, onHover } = events, divBubble = (0, engine_1.isDivModeEnabled)(bubbleMode, onDiv);
|
package/cjs/index.js
CHANGED
|
@@ -10,18 +10,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
15
|
};
|
|
@@ -29,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
17
|
exports.loadExternalBubbleInteraction = void 0;
|
|
30
18
|
async function loadExternalBubbleInteraction(engine, refresh = true) {
|
|
31
19
|
await engine.addInteractor("externalBubble", async (container) => {
|
|
32
|
-
const { Bubbler } = await
|
|
20
|
+
const { Bubbler } = await import("./Bubbler.js");
|
|
33
21
|
return new Bubbler(container);
|
|
34
22
|
}, refresh);
|
|
35
23
|
}
|
|
@@ -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
|
-
* v3.
|
|
7
|
+
* v3.3.0
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
\*********************************/
|
|
24
24
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
25
|
|
|
26
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Bubbler: () => (/* binding */ Bubbler)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Bubble.js */ \"./dist/browser/Options/Classes/Bubble.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nconst bubbleMode = \"bubble\",\n minDistance = 0,\n defaultClickTime = 0,\n double = 2,\n defaultOpacity = 1,\n ratioOffset = 1,\n defaultBubbleValue = 0,\n minRatio = 0,\n half = 0.5,\n defaultRatio = 1;\nclass Bubbler extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(container) {\n super(container);\n this._clickBubble = () => {\n const container = this.container,\n options = container.actualOptions,\n mouseClickPos = container.interactivity.mouse.clickPosition,\n bubbleOptions = options.interactivity.modes.bubble;\n if (!bubbleOptions || !mouseClickPos) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n const distance = container.retina.bubbleModeDistance;\n if (!distance || distance < minDistance) {\n return;\n }\n const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(p)),\n {\n bubble\n } = container;\n for (const particle of query) {\n if (!bubble.clicking) {\n continue;\n }\n particle.bubble.inRange = !bubble.durationEnd;\n const pos = particle.getPosition(),\n distMouse = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, mouseClickPos),\n timeSpent = (new Date().getTime() - (container.interactivity.mouse.clickTime ?? defaultClickTime)) / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds;\n if (timeSpent > bubbleOptions.duration) {\n bubble.durationEnd = true;\n }\n if (timeSpent > bubbleOptions.duration * double) {\n bubble.clicking = false;\n bubble.durationEnd = false;\n }\n const sizeData = {\n bubbleObj: {\n optValue: container.retina.bubbleModeSize,\n value: particle.bubble.radius\n },\n particlesObj: {\n optValue: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,\n value: particle.size.value\n },\n type: \"size\"\n };\n this._process(particle, distMouse, timeSpent, sizeData);\n const opacityData = {\n bubbleObj: {\n optValue: bubbleOptions.opacity,\n value: particle.bubble.opacity\n },\n particlesObj: {\n optValue: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.opacity.value),\n value: particle.opacity?.value ?? defaultOpacity\n },\n type: \"opacity\"\n };\n this._process(particle, distMouse, timeSpent, opacityData);\n if (!bubble.durationEnd && distMouse <= distance) {\n this._hoverBubbleColor(particle, distMouse);\n } else {\n delete particle.bubble.color;\n }\n }\n };\n this._hoverBubble = () => {\n const container = this.container,\n mousePos = container.interactivity.mouse.position,\n distance = container.retina.bubbleModeDistance;\n if (!distance || distance < minDistance || !mousePos) {\n return;\n }\n const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));\n for (const particle of query) {\n particle.bubble.inRange = true;\n const pos = particle.getPosition(),\n pointDistance = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, mousePos),\n ratio = ratioOffset - pointDistance / distance;\n if (pointDistance <= distance) {\n if (ratio >= minRatio && container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseMoveEvent) {\n this._hoverBubbleSize(particle, ratio);\n this._hoverBubbleOpacity(particle, ratio);\n this._hoverBubbleColor(particle, ratio);\n }\n } else {\n this.reset(particle);\n }\n if (container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseLeaveEvent) {\n this.reset(particle);\n }\n }\n };\n this._hoverBubbleColor = (particle, ratio, divBubble) => {\n const options = this.container.actualOptions,\n bubbleOptions = divBubble ?? options.interactivity.modes.bubble;\n if (!bubbleOptions) {\n return;\n }\n if (!particle.bubble.finalColor) {\n const modeColor = bubbleOptions.color;\n if (!modeColor) {\n return;\n }\n const bubbleColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(modeColor);\n particle.bubble.finalColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(bubbleColor);\n }\n if (!particle.bubble.finalColor) {\n return;\n }\n if (bubbleOptions.mix) {\n particle.bubble.color = undefined;\n const pColor = particle.getFillColor();\n particle.bubble.color = pColor ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rgbToHsl)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.colorMix)(pColor, particle.bubble.finalColor, ratioOffset - ratio, ratio)) : particle.bubble.finalColor;\n } else {\n particle.bubble.color = particle.bubble.finalColor;\n }\n };\n this._hoverBubbleOpacity = (particle, ratio, divBubble) => {\n const container = this.container,\n options = container.actualOptions,\n modeOpacity = divBubble?.opacity ?? options.interactivity.modes.bubble?.opacity;\n if (!modeOpacity) {\n return;\n }\n const optOpacity = particle.options.opacity.value,\n pOpacity = particle.opacity?.value ?? defaultOpacity,\n opacity = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.calculateBubbleValue)(pOpacity, modeOpacity, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(optOpacity), ratio);\n if (opacity !== undefined) {\n particle.bubble.opacity = opacity;\n }\n };\n this._hoverBubbleSize = (particle, ratio, divBubble) => {\n const container = this.container,\n modeSize = divBubble?.size ? divBubble.size * container.retina.pixelRatio : container.retina.bubbleModeSize;\n if (modeSize === undefined) {\n return;\n }\n const optSize = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,\n pSize = particle.size.value,\n size = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.calculateBubbleValue)(pSize, modeSize, optSize, ratio);\n if (size !== undefined) {\n particle.bubble.radius = size;\n }\n };\n this._process = (particle, distMouse, timeSpent, data) => {\n const container = this.container,\n bubbleParam = data.bubbleObj.optValue,\n options = container.actualOptions,\n bubbleOptions = options.interactivity.modes.bubble;\n if (!bubbleOptions || bubbleParam === undefined) {\n return;\n }\n const bubbleDuration = bubbleOptions.duration,\n bubbleDistance = container.retina.bubbleModeDistance,\n particlesParam = data.particlesObj.optValue,\n pObjBubble = data.bubbleObj.value,\n pObj = data.particlesObj.value ?? defaultBubbleValue,\n type = data.type;\n if (!bubbleDistance || bubbleDistance < minDistance || bubbleParam === particlesParam) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n if (container.bubble.durationEnd) {\n if (pObjBubble) {\n if (type === \"size\") {\n delete particle.bubble.radius;\n }\n if (type === \"opacity\") {\n delete particle.bubble.opacity;\n }\n }\n } else {\n if (distMouse <= bubbleDistance) {\n const obj = pObjBubble ?? pObj;\n if (obj !== bubbleParam) {\n const value = pObj - timeSpent * (pObj - bubbleParam) / bubbleDuration;\n if (type === \"size\") {\n particle.bubble.radius = value;\n }\n if (type === \"opacity\") {\n particle.bubble.opacity = value;\n }\n }\n } else {\n if (type === \"size\") {\n delete particle.bubble.radius;\n }\n if (type === \"opacity\") {\n delete particle.bubble.opacity;\n }\n }\n }\n };\n this._singleSelectorHover = (delta, selector, div) => {\n const container = this.container,\n selectors = document.querySelectorAll(selector),\n bubble = container.actualOptions.interactivity.modes.bubble;\n if (!bubble || !selectors.length) {\n return;\n }\n selectors.forEach(item => {\n const elem = item,\n pxRatio = container.retina.pixelRatio,\n pos = {\n x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,\n y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio\n },\n repulseRadius = elem.offsetWidth * half * pxRatio,\n area = div.type === \"circle\" ? new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(pos.x, pos.y, repulseRadius) : new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),\n query = container.particles.quadTree.query(area, p => this.isEnabled(p));\n for (const particle of query) {\n if (!area.contains(particle.getPosition())) {\n continue;\n }\n particle.bubble.inRange = true;\n const divs = bubble.divs,\n divBubble = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divMode)(divs, elem);\n if (!particle.bubble.div || particle.bubble.div !== elem) {\n this.clear(particle, delta, true);\n particle.bubble.div = elem;\n }\n this._hoverBubbleSize(particle, defaultRatio, divBubble);\n this._hoverBubbleOpacity(particle, defaultRatio, divBubble);\n this._hoverBubbleColor(particle, defaultRatio, divBubble);\n }\n });\n };\n if (!container.bubble) {\n container.bubble = {};\n }\n this.handleClickMode = mode => {\n if (mode !== bubbleMode) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n container.bubble.clicking = true;\n };\n }\n clear(particle, delta, force) {\n if (particle.bubble.inRange && !force) {\n return;\n }\n delete particle.bubble.div;\n delete particle.bubble.opacity;\n delete particle.bubble.radius;\n delete particle.bubble.color;\n }\n init() {\n const container = this.container,\n bubble = container.actualOptions.interactivity.modes.bubble;\n if (!bubble) {\n return;\n }\n container.retina.bubbleModeDistance = bubble.distance * container.retina.pixelRatio;\n if (bubble.size !== undefined) {\n container.retina.bubbleModeSize = bubble.size * container.retina.pixelRatio;\n }\n }\n async interact(delta) {\n const options = this.container.actualOptions,\n events = options.interactivity.events,\n onHover = events.onHover,\n onClick = events.onClick,\n hoverEnabled = onHover.enable,\n hoverMode = onHover.mode,\n clickEnabled = onClick.enable,\n clickMode = onClick.mode,\n divs = events.onDiv;\n if (hoverEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, hoverMode)) {\n this._hoverBubble();\n } else if (clickEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, clickMode)) {\n this._clickBubble();\n } else {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divModeExecute)(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));\n }\n await Promise.resolve();\n }\n isEnabled(particle) {\n const container = this.container,\n options = container.actualOptions,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? options.interactivity).events,\n {\n onClick,\n onDiv,\n onHover\n } = events,\n divBubble = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isDivModeEnabled)(bubbleMode, onDiv);\n if (!(divBubble || onHover.enable && !!mouse.position || onClick.enable && mouse.clickPosition)) {\n return false;\n }\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, onHover.mode) || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, onClick.mode) || divBubble;\n }\n loadModeOptions(options, ...sources) {\n if (!options.bubble) {\n options.bubble = new _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__.Bubble();\n }\n for (const source of sources) {\n options.bubble.load(source?.bubble);\n }\n }\n reset(particle) {\n particle.bubble.inRange = false;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Bubbler.js?");
|
|
26
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Bubbler: () => (/* binding */ Bubbler)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Bubble.js */ \"./dist/browser/Options/Classes/Bubble.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nconst bubbleMode = \"bubble\",\n minDistance = 0,\n defaultClickTime = 0,\n double = 2,\n defaultOpacity = 1,\n ratioOffset = 1,\n defaultBubbleValue = 0,\n minRatio = 0,\n half = 0.5,\n defaultRatio = 1;\nclass Bubbler extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(container) {\n super(container);\n this._clickBubble = () => {\n const container = this.container,\n options = container.actualOptions,\n mouseClickPos = container.interactivity.mouse.clickPosition,\n bubbleOptions = options.interactivity.modes.bubble;\n if (!bubbleOptions || !mouseClickPos) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n const distance = container.retina.bubbleModeDistance;\n if (!distance || distance < minDistance) {\n return;\n }\n const query = container.particles.quadTree.queryCircle(mouseClickPos, distance, p => this.isEnabled(p)),\n {\n bubble\n } = container;\n for (const particle of query) {\n if (!bubble.clicking) {\n continue;\n }\n particle.bubble.inRange = !bubble.durationEnd;\n const pos = particle.getPosition(),\n distMouse = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, mouseClickPos),\n timeSpent = (new Date().getTime() - (container.interactivity.mouse.clickTime ?? defaultClickTime)) / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds;\n if (timeSpent > bubbleOptions.duration) {\n bubble.durationEnd = true;\n }\n if (timeSpent > bubbleOptions.duration * double) {\n bubble.clicking = false;\n bubble.durationEnd = false;\n }\n const sizeData = {\n bubbleObj: {\n optValue: container.retina.bubbleModeSize,\n value: particle.bubble.radius\n },\n particlesObj: {\n optValue: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,\n value: particle.size.value\n },\n type: \"size\"\n };\n this._process(particle, distMouse, timeSpent, sizeData);\n const opacityData = {\n bubbleObj: {\n optValue: bubbleOptions.opacity,\n value: particle.bubble.opacity\n },\n particlesObj: {\n optValue: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.opacity.value),\n value: particle.opacity?.value ?? defaultOpacity\n },\n type: \"opacity\"\n };\n this._process(particle, distMouse, timeSpent, opacityData);\n if (!bubble.durationEnd && distMouse <= distance) {\n this._hoverBubbleColor(particle, distMouse);\n } else {\n delete particle.bubble.color;\n }\n }\n };\n this._hoverBubble = () => {\n const container = this.container,\n mousePos = container.interactivity.mouse.position,\n distance = container.retina.bubbleModeDistance;\n if (!distance || distance < minDistance || !mousePos) {\n return;\n }\n const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));\n for (const particle of query) {\n particle.bubble.inRange = true;\n const pos = particle.getPosition(),\n pointDistance = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, mousePos),\n ratio = ratioOffset - pointDistance / distance;\n if (pointDistance <= distance) {\n if (ratio >= minRatio && container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseMoveEvent) {\n this._hoverBubbleSize(particle, ratio);\n this._hoverBubbleOpacity(particle, ratio);\n this._hoverBubbleColor(particle, ratio);\n }\n } else {\n this.reset(particle);\n }\n if (container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseLeaveEvent) {\n this.reset(particle);\n }\n }\n };\n this._hoverBubbleColor = (particle, ratio, divBubble) => {\n const options = this.container.actualOptions,\n bubbleOptions = divBubble ?? options.interactivity.modes.bubble;\n if (!bubbleOptions) {\n return;\n }\n if (!particle.bubble.finalColor) {\n const modeColor = bubbleOptions.color;\n if (!modeColor) {\n return;\n }\n const bubbleColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(modeColor);\n particle.bubble.finalColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(bubbleColor);\n }\n if (!particle.bubble.finalColor) {\n return;\n }\n if (bubbleOptions.mix) {\n particle.bubble.color = undefined;\n const pColor = particle.getFillColor();\n particle.bubble.color = pColor ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rgbToHsl)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.colorMix)(pColor, particle.bubble.finalColor, ratioOffset - ratio, ratio)) : particle.bubble.finalColor;\n } else {\n particle.bubble.color = particle.bubble.finalColor;\n }\n };\n this._hoverBubbleOpacity = (particle, ratio, divBubble) => {\n const container = this.container,\n options = container.actualOptions,\n modeOpacity = divBubble?.opacity ?? options.interactivity.modes.bubble?.opacity;\n if (!modeOpacity) {\n return;\n }\n const optOpacity = particle.options.opacity.value,\n pOpacity = particle.opacity?.value ?? defaultOpacity,\n opacity = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.calculateBubbleValue)(pOpacity, modeOpacity, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(optOpacity), ratio);\n if (opacity !== undefined) {\n particle.bubble.opacity = opacity;\n }\n };\n this._hoverBubbleSize = (particle, ratio, divBubble) => {\n const container = this.container,\n modeSize = divBubble?.size ? divBubble.size * container.retina.pixelRatio : container.retina.bubbleModeSize;\n if (modeSize === undefined) {\n return;\n }\n const optSize = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeMax)(particle.options.size.value) * container.retina.pixelRatio,\n pSize = particle.size.value,\n size = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.calculateBubbleValue)(pSize, modeSize, optSize, ratio);\n if (size !== undefined) {\n particle.bubble.radius = size;\n }\n };\n this._process = (particle, distMouse, timeSpent, data) => {\n const container = this.container,\n bubbleParam = data.bubbleObj.optValue,\n options = container.actualOptions,\n bubbleOptions = options.interactivity.modes.bubble;\n if (!bubbleOptions || bubbleParam === undefined) {\n return;\n }\n const bubbleDuration = bubbleOptions.duration,\n bubbleDistance = container.retina.bubbleModeDistance,\n particlesParam = data.particlesObj.optValue,\n pObjBubble = data.bubbleObj.value,\n pObj = data.particlesObj.value ?? defaultBubbleValue,\n type = data.type;\n if (!bubbleDistance || bubbleDistance < minDistance || bubbleParam === particlesParam) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n if (container.bubble.durationEnd) {\n if (pObjBubble) {\n if (type === \"size\") {\n delete particle.bubble.radius;\n }\n if (type === \"opacity\") {\n delete particle.bubble.opacity;\n }\n }\n } else {\n if (distMouse <= bubbleDistance) {\n const obj = pObjBubble ?? pObj;\n if (obj !== bubbleParam) {\n const value = pObj - timeSpent * (pObj - bubbleParam) / bubbleDuration;\n if (type === \"size\") {\n particle.bubble.radius = value;\n }\n if (type === \"opacity\") {\n particle.bubble.opacity = value;\n }\n }\n } else {\n if (type === \"size\") {\n delete particle.bubble.radius;\n }\n if (type === \"opacity\") {\n delete particle.bubble.opacity;\n }\n }\n }\n };\n this._singleSelectorHover = (delta, selector, div) => {\n const container = this.container,\n selectors = document.querySelectorAll(selector),\n bubble = container.actualOptions.interactivity.modes.bubble;\n if (!bubble || !selectors.length) {\n return;\n }\n selectors.forEach(item => {\n const elem = item,\n pxRatio = container.retina.pixelRatio,\n pos = {\n x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,\n y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio\n },\n repulseRadius = elem.offsetWidth * half * pxRatio,\n area = div.type === \"circle\" ? new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(pos.x, pos.y, repulseRadius) : new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),\n query = container.particles.quadTree.query(area, p => this.isEnabled(p));\n for (const particle of query) {\n if (!area.contains(particle.getPosition())) {\n continue;\n }\n particle.bubble.inRange = true;\n const divs = bubble.divs,\n divBubble = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divMode)(divs, elem);\n if (!particle.bubble.div || particle.bubble.div !== elem) {\n this.clear(particle, delta, true);\n particle.bubble.div = elem;\n }\n this._hoverBubbleSize(particle, defaultRatio, divBubble);\n this._hoverBubbleOpacity(particle, defaultRatio, divBubble);\n this._hoverBubbleColor(particle, defaultRatio, divBubble);\n }\n });\n };\n if (!container.bubble) {\n container.bubble = {};\n }\n this.handleClickMode = mode => {\n if (mode !== bubbleMode) {\n return;\n }\n if (!container.bubble) {\n container.bubble = {};\n }\n container.bubble.clicking = true;\n };\n }\n clear(particle, delta, force) {\n if (particle.bubble.inRange && !force) {\n return;\n }\n delete particle.bubble.div;\n delete particle.bubble.opacity;\n delete particle.bubble.radius;\n delete particle.bubble.color;\n }\n init() {\n const container = this.container,\n bubble = container.actualOptions.interactivity.modes.bubble;\n if (!bubble) {\n return;\n }\n container.retina.bubbleModeDistance = bubble.distance * container.retina.pixelRatio;\n if (bubble.size !== undefined) {\n container.retina.bubbleModeSize = bubble.size * container.retina.pixelRatio;\n }\n }\n interact(delta) {\n const options = this.container.actualOptions,\n events = options.interactivity.events,\n onHover = events.onHover,\n onClick = events.onClick,\n hoverEnabled = onHover.enable,\n hoverMode = onHover.mode,\n clickEnabled = onClick.enable,\n clickMode = onClick.mode,\n divs = events.onDiv;\n if (hoverEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, hoverMode)) {\n this._hoverBubble();\n } else if (clickEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, clickMode)) {\n this._clickBubble();\n } else {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divModeExecute)(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));\n }\n }\n isEnabled(particle) {\n const container = this.container,\n options = container.actualOptions,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? options.interactivity).events,\n {\n onClick,\n onDiv,\n onHover\n } = events,\n divBubble = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isDivModeEnabled)(bubbleMode, onDiv);\n if (!(divBubble || onHover.enable && !!mouse.position || onClick.enable && mouse.clickPosition)) {\n return false;\n }\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, onHover.mode) || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(bubbleMode, onClick.mode) || divBubble;\n }\n loadModeOptions(options, ...sources) {\n if (!options.bubble) {\n options.bubble = new _Options_Classes_Bubble_js__WEBPACK_IMPORTED_MODULE_2__.Bubble();\n }\n for (const source of sources) {\n options.bubble.load(source?.bubble);\n }\n }\n reset(particle) {\n particle.bubble.inRange = false;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-bubble/./dist/browser/Bubbler.js?");
|
|
27
27
|
|
|
28
28
|
/***/ }),
|
|
29
29
|
|
package/esm/Bubbler.js
CHANGED
|
@@ -240,7 +240,7 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
240
240
|
container.retina.bubbleModeSize = bubble.size * container.retina.pixelRatio;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
|
|
243
|
+
interact(delta) {
|
|
244
244
|
const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
|
|
245
245
|
if (hoverEnabled && isInArray(bubbleMode, hoverMode)) {
|
|
246
246
|
this._hoverBubble();
|
|
@@ -251,7 +251,6 @@ export class Bubbler extends ExternalInteractorBase {
|
|
|
251
251
|
else {
|
|
252
252
|
divModeExecute(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
|
|
253
253
|
}
|
|
254
|
-
await Promise.resolve();
|
|
255
254
|
}
|
|
256
255
|
isEnabled(particle) {
|
|
257
256
|
const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, { onClick, onDiv, onHover } = events, divBubble = isDivModeEnabled(bubbleMode, onDiv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-bubble",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "tsParticles bubble external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"./package.json": "./package.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "^3.
|
|
90
|
+
"@tsparticles/engine": "^3.3.0"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
-
<title>@tsparticles/interaction-external-bubble [
|
|
6
|
+
<title>@tsparticles/interaction-external-bubble [27 Feb 2024 at 12:14]</title>
|
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
|
|
8
8
|
|
|
9
9
|
<script>
|
|
@@ -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
|
-
* v3.
|
|
7
|
+
* v3.3.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -240,7 +240,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
240
240
|
/******/ var scripts = document.getElementsByTagName("script");
|
|
241
241
|
/******/ if(scripts.length) {
|
|
242
242
|
/******/ var i = scripts.length - 1;
|
|
243
|
-
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
|
|
243
|
+
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
244
244
|
/******/ }
|
|
245
245
|
/******/ }
|
|
246
246
|
/******/ }
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.external.bubble.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{var t,r,o={
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{var t,r,o={510:(e,t,r)=>{r.d(t,{Z:()=>a});var o=r(303),i=r(567),n=r(807);class a extends i.u{load(e){super.load(e),e&&(this.divs=(0,o.executeOnSingleOrMultiple)(e.divs,(e=>{const t=new n.C;return t.load(e),t})))}}},567:(e,t,r)=>{r.d(t,{u:()=>i});var o=r(303);class i{constructor(){this.distance=200,this.duration=.4,this.mix=!1}load(e){if(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){const t=(0,o.isArray)(this.color)?void 0:this.color;this.color=(0,o.executeOnSingleOrMultiple)(e.color,(e=>o.OptionsColor.create(t,e)))}void 0!==e.size&&(this.size=e.size)}}}},807:(e,t,r)=>{r.d(t,{C:()=>i});var o=r(567);class i extends o.u{constructor(){super(),this.selectors=[]}load(e){super.load(e),e&&void 0!==e.selectors&&(this.selectors=e.selectors)}}},303:t=>{t.exports=e}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,n),r.exports}n.m=o,n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((t,r)=>(n.f[r](e,t),t)),[])),n.u=e=>e+".min.js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/interaction-external-bubble:",n.l=(e,o,i,a)=>{if(t[e])t[e].push(o);else{var s,l;if(void 0!==i)for(var c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var d=c[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==r+i){s=d;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,n.nc&&s.setAttribute("nonce",n.nc),s.setAttribute("data-webpack",r+i),s.src=e),t[e]=[o];var p=(r,o)=>{s.onerror=s.onload=null,clearTimeout(b);var i=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),i&&i.forEach((e=>e(o))),r)return r(o)},b=setTimeout(p.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=p.bind(null,s.onerror),s.onload=p.bind(null,s.onload),l&&document.head.appendChild(s)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={108:0};n.f.j=(t,r)=>{var o=n.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var i=new Promise(((r,i)=>o=e[t]=[r,i]));r.push(o[2]=i);var a=n.p+n.u(t),s=new Error;n.l(a,(r=>{if(n.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",s.name="ChunkLoadError",s.type=i,s.request=a,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,i,a=r[0],s=r[1],l=r[2],c=0;if(a.some((t=>0!==e[t]))){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);if(l)l(n)}for(t&&t(r);c<a.length;c++)i=a[c],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunk_tsparticles_interaction_external_bubble=this.webpackChunk_tsparticles_interaction_external_bubble||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};return(()=>{n.r(a),n.d(a,{Bubble:()=>r.Z,BubbleBase:()=>e.u,BubbleDiv:()=>t.C,loadExternalBubbleInteraction:()=>o});var e=n(567),t=n(807),r=n(510);async function o(e,t=!0){await e.addInteractor("externalBubble",(async e=>{const{Bubbler:t}=await n.e(201).then(n.bind(n,201));return new t(e)}),t)}})(),a})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Bubble External Interaction v3.
|
|
1
|
+
/*! tsParticles Bubble External Interaction v3.3.0 by Matteo Bruni */
|
package/types/Bubbler.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare class Bubbler extends ExternalInteractorBase<BubbleContainer> {
|
|
|
5
5
|
constructor(container: BubbleContainer);
|
|
6
6
|
clear(particle: Particle, delta: IDelta, force?: boolean): void;
|
|
7
7
|
init(): void;
|
|
8
|
-
interact(delta: IDelta):
|
|
8
|
+
interact(delta: IDelta): void;
|
|
9
9
|
isEnabled(particle?: Particle): boolean;
|
|
10
10
|
loadModeOptions(options: Modes & BubbleMode, ...sources: RecursivePartial<(IModes & IBubbleMode) | undefined>[]): void;
|
|
11
11
|
reset(particle: Particle): void;
|
package/umd/Bubbler.js
CHANGED
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
container.retina.bubbleModeSize = bubble.size * container.retina.pixelRatio;
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
interact(delta) {
|
|
256
256
|
const options = this.container.actualOptions, events = options.interactivity.events, onHover = events.onHover, onClick = events.onClick, hoverEnabled = onHover.enable, hoverMode = onHover.mode, clickEnabled = onClick.enable, clickMode = onClick.mode, divs = events.onDiv;
|
|
257
257
|
if (hoverEnabled && (0, engine_1.isInArray)(bubbleMode, hoverMode)) {
|
|
258
258
|
this._hoverBubble();
|
|
@@ -263,7 +263,6 @@
|
|
|
263
263
|
else {
|
|
264
264
|
(0, engine_1.divModeExecute)(bubbleMode, divs, (selector, div) => this._singleSelectorHover(delta, selector, div));
|
|
265
265
|
}
|
|
266
|
-
await Promise.resolve();
|
|
267
266
|
}
|
|
268
267
|
isEnabled(particle) {
|
|
269
268
|
const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, { onClick, onDiv, onHover } = events, divBubble = (0, engine_1.isDivModeEnabled)(bubbleMode, onDiv);
|
package/582.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 582.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_interaction_external_bubble=this.webpackChunk_tsparticles_interaction_external_bubble||[]).push([[582],{582:(e,i,t)=>{t.d(i,{Bubbler:()=>a});var o=t(533),b=t(585);function l(e,i,t,b){if(i>=t){const l=e+(i-t)*b;return(0,o.clamp)(l,e,i)}if(i<t){const l=e-(t-i)*b;return(0,o.clamp)(l,i,e)}}const n="bubble";class a extends o.ExternalInteractorBase{constructor(e){super(e),this._clickBubble=()=>{const e=this.container,i=e.actualOptions,t=e.interactivity.mouse.clickPosition,b=i.interactivity.modes.bubble;if(!b||!t)return;e.bubble||(e.bubble={});const l=e.retina.bubbleModeDistance;if(!l||l<0)return;const n=e.particles.quadTree.queryCircle(t,l,(e=>this.isEnabled(e))),{bubble:a}=e;for(const i of n){if(!a.clicking)continue;i.bubble.inRange=!a.durationEnd;const n=i.getPosition(),s=(0,o.getDistance)(n,t),r=((new Date).getTime()-(e.interactivity.mouse.clickTime??0))/o.millisecondsToSeconds;r>b.duration&&(a.durationEnd=!0),r>2*b.duration&&(a.clicking=!1,a.durationEnd=!1);const c={bubbleObj:{optValue:e.retina.bubbleModeSize,value:i.bubble.radius},particlesObj:{optValue:(0,o.getRangeMax)(i.options.size.value)*e.retina.pixelRatio,value:i.size.value},type:"size"};this._process(i,s,r,c);const u={bubbleObj:{optValue:b.opacity,value:i.bubble.opacity},particlesObj:{optValue:(0,o.getRangeMax)(i.options.opacity.value),value:i.opacity?.value??1},type:"opacity"};this._process(i,s,r,u),!a.durationEnd&&s<=l?this._hoverBubbleColor(i,s):delete i.bubble.color}},this._hoverBubble=()=>{const e=this.container,i=e.interactivity.mouse.position,t=e.retina.bubbleModeDistance;if(!t||t<0||!i)return;const b=e.particles.quadTree.queryCircle(i,t,(e=>this.isEnabled(e)));for(const l of b){l.bubble.inRange=!0;const b=l.getPosition(),n=(0,o.getDistance)(b,i),a=1-n/t;n<=t?a>=0&&e.interactivity.status===o.mouseMoveEvent&&(this._hoverBubbleSize(l,a),this._hoverBubbleOpacity(l,a),this._hoverBubbleColor(l,a)):this.reset(l),e.interactivity.status===o.mouseLeaveEvent&&this.reset(l)}},this._hoverBubbleColor=(e,i,t)=>{const b=this.container.actualOptions,l=t??b.interactivity.modes.bubble;if(l){if(!e.bubble.finalColor){const i=l.color;if(!i)return;const t=(0,o.itemFromSingleOrMultiple)(i);e.bubble.finalColor=(0,o.rangeColorToHsl)(t)}if(e.bubble.finalColor)if(l.mix){e.bubble.color=void 0;const t=e.getFillColor();e.bubble.color=t?(0,o.rgbToHsl)((0,o.colorMix)(t,e.bubble.finalColor,1-i,i)):e.bubble.finalColor}else e.bubble.color=e.bubble.finalColor}},this._hoverBubbleOpacity=(e,i,t)=>{const b=this.container.actualOptions,n=t?.opacity??b.interactivity.modes.bubble?.opacity;if(!n)return;const a=e.options.opacity.value,s=l(e.opacity?.value??1,n,(0,o.getRangeMax)(a),i);void 0!==s&&(e.bubble.opacity=s)},this._hoverBubbleSize=(e,i,t)=>{const b=this.container,n=t?.size?t.size*b.retina.pixelRatio:b.retina.bubbleModeSize;if(void 0===n)return;const a=(0,o.getRangeMax)(e.options.size.value)*b.retina.pixelRatio,s=l(e.size.value,n,a,i);void 0!==s&&(e.bubble.radius=s)},this._process=(e,i,t,o)=>{const b=this.container,l=o.bubbleObj.optValue,n=b.actualOptions.interactivity.modes.bubble;if(!n||void 0===l)return;const a=n.duration,s=b.retina.bubbleModeDistance,r=o.particlesObj.optValue,c=o.bubbleObj.value,u=o.particlesObj.value??0,d=o.type;if(s&&!(s<0)&&l!==r)if(b.bubble||(b.bubble={}),b.bubble.durationEnd)c&&("size"===d&&delete e.bubble.radius,"opacity"===d&&delete e.bubble.opacity);else if(i<=s){if((c??u)!==l){const i=u-t*(u-l)/a;"size"===d&&(e.bubble.radius=i),"opacity"===d&&(e.bubble.opacity=i)}}else"size"===d&&delete e.bubble.radius,"opacity"===d&&delete e.bubble.opacity},this._singleSelectorHover=(e,i,t)=>{const b=this.container,l=document.querySelectorAll(i),n=b.actualOptions.interactivity.modes.bubble;n&&l.length&&l.forEach((i=>{const l=i,a=b.retina.pixelRatio,s={x:(l.offsetLeft+.5*l.offsetWidth)*a,y:(l.offsetTop+.5*l.offsetHeight)*a},r=.5*l.offsetWidth*a,c="circle"===t.type?new o.Circle(s.x,s.y,r):new o.Rectangle(l.offsetLeft*a,l.offsetTop*a,l.offsetWidth*a,l.offsetHeight*a),u=b.particles.quadTree.query(c,(e=>this.isEnabled(e)));for(const i of u){if(!c.contains(i.getPosition()))continue;i.bubble.inRange=!0;const t=n.divs,b=(0,o.divMode)(t,l);i.bubble.div&&i.bubble.div===l||(this.clear(i,e,!0),i.bubble.div=l),this._hoverBubbleSize(i,1,b),this._hoverBubbleOpacity(i,1,b),this._hoverBubbleColor(i,1,b)}}))},e.bubble||(e.bubble={}),this.handleClickMode=i=>{i===n&&(e.bubble||(e.bubble={}),e.bubble.clicking=!0)}}clear(e,i,t){e.bubble.inRange&&!t||(delete e.bubble.div,delete e.bubble.opacity,delete e.bubble.radius,delete e.bubble.color)}init(){const e=this.container,i=e.actualOptions.interactivity.modes.bubble;i&&(e.retina.bubbleModeDistance=i.distance*e.retina.pixelRatio,void 0!==i.size&&(e.retina.bubbleModeSize=i.size*e.retina.pixelRatio))}async interact(e){const i=this.container.actualOptions.interactivity.events,t=i.onHover,b=i.onClick,l=t.enable,a=t.mode,s=b.enable,r=b.mode,c=i.onDiv;l&&(0,o.isInArray)(n,a)?this._hoverBubble():s&&(0,o.isInArray)(n,r)?this._clickBubble():(0,o.divModeExecute)(n,c,((i,t)=>this._singleSelectorHover(e,i,t))),await Promise.resolve()}isEnabled(e){const i=this.container,t=i.actualOptions,b=i.interactivity.mouse,l=(e?.interactivity??t.interactivity).events,{onClick:a,onDiv:s,onHover:r}=l,c=(0,o.isDivModeEnabled)(n,s);return!!(c||r.enable&&b.position||a.enable&&b.clickPosition)&&((0,o.isInArray)(n,r.mode)||(0,o.isInArray)(n,a.mode)||c)}loadModeOptions(e,...i){e.bubble||(e.bubble=new b.x);for(const t of i)e.bubble.load(t?.bubble)}reset(e){e.bubble.inRange=!1}}}}]);
|
package/582.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Bubble External Interaction v3.2.2 by Matteo Bruni */
|