tsparticles-interaction-external-bubble
Advanced tools
Comparing version 2.0.0-alpha.3 to 2.0.0-alpha.4
@@ -1,3 +0,3 @@ | ||
import type { Container, Particle } from "tsparticles-core"; | ||
import { ExternalInteractorBase } from "tsparticles-core"; | ||
import type { Container, Particle } from "tsparticles-engine"; | ||
import { ExternalInteractorBase } from "tsparticles-engine"; | ||
export declare class Bubbler extends ExternalInteractorBase { | ||
@@ -4,0 +4,0 @@ constructor(container: Container); |
@@ -1,2 +0,3 @@ | ||
import { Circle, clamp, colorToHsl, Constants, divMode, divModeExecute, getDistance, isDivModeEnabled, isInArray, itemFromArray, Rectangle, ExternalInteractorBase, } from "tsparticles-core"; | ||
import { Circle, clamp, colorToHsl, Constants, divMode, divModeExecute, getDistance, isDivModeEnabled, isInArray, itemFromArray, Rectangle, ClickMode, DivMode, DivType, HoverMode, ExternalInteractorBase, } from "tsparticles-engine"; | ||
import { ProcessBubbleType } from "./ProcessBubbleType"; | ||
const calculateBubbleValue = (particleValue, modeValue, optionsValue, ratio) => { | ||
@@ -14,3 +15,3 @@ if (modeValue > optionsValue) { | ||
constructor(container) { | ||
super(container, "bubble"); | ||
super(container); | ||
} | ||
@@ -23,3 +24,3 @@ isEnabled() { | ||
const divs = events.onDiv; | ||
const divBubble = isDivModeEnabled("bubble", divs); | ||
const divBubble = isDivModeEnabled(DivMode.bubble, divs); | ||
if (!(divBubble || (events.onHover.enable && mouse.position) || (events.onClick.enable && mouse.clickPosition))) { | ||
@@ -30,3 +31,3 @@ return false; | ||
const clickMode = events.onClick.mode; | ||
return isInArray("bubble", hoverMode) || isInArray("bubble", clickMode) || divBubble; | ||
return isInArray(HoverMode.bubble, hoverMode) || isInArray(ClickMode.bubble, clickMode) || divBubble; | ||
} | ||
@@ -51,10 +52,10 @@ reset(particle, force) { | ||
const divs = events.onDiv; | ||
if (hoverEnabled && isInArray("bubble", hoverMode)) { | ||
if (hoverEnabled && isInArray(HoverMode.bubble, hoverMode)) { | ||
this.hoverBubble(); | ||
} | ||
else if (clickEnabled && isInArray("bubble", clickMode)) { | ||
else if (clickEnabled && isInArray(ClickMode.bubble, clickMode)) { | ||
this.clickBubble(); | ||
} | ||
else { | ||
divModeExecute("bubble", divs, (selector, div) => this.singleSelectorHover(selector, div)); | ||
divModeExecute(DivMode.bubble, divs, (selector, div) => this.singleSelectorHover(selector, div)); | ||
} | ||
@@ -76,3 +77,3 @@ } | ||
const repulseRadius = (elem.offsetWidth / 2) * pxRatio; | ||
const area = div.type === "circle" | ||
const area = div.type === DivType.circle | ||
? new Circle(pos.x, pos.y, repulseRadius) | ||
@@ -117,6 +118,6 @@ : new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio); | ||
const value = pObj - (timeSpent * (pObj - bubbleParam)) / bubbleDuration; | ||
if (type === "size") { | ||
if (type === ProcessBubbleType.size) { | ||
particle.bubble.radius = value; | ||
} | ||
if (type === "opacity") { | ||
if (type === ProcessBubbleType.opacity) { | ||
particle.bubble.opacity = value; | ||
@@ -127,6 +128,6 @@ } | ||
else { | ||
if (type === "size") { | ||
if (type === ProcessBubbleType.size) { | ||
delete particle.bubble.radius; | ||
} | ||
if (type === "opacity") { | ||
if (type === ProcessBubbleType.opacity) { | ||
delete particle.bubble.opacity; | ||
@@ -137,6 +138,6 @@ } | ||
else if (pObjBubble) { | ||
if (type === "size") { | ||
if (type === ProcessBubbleType.size) { | ||
delete particle.bubble.radius; | ||
} | ||
if (type === "opacity") { | ||
if (type === ProcessBubbleType.opacity) { | ||
delete particle.bubble.opacity; | ||
@@ -182,3 +183,3 @@ } | ||
}, | ||
type: "size", | ||
type: ProcessBubbleType.size, | ||
}; | ||
@@ -197,3 +198,3 @@ this.process(particle, distMouse, timeSpent, sizeData); | ||
}, | ||
type: "opacity", | ||
type: ProcessBubbleType.opacity, | ||
}; | ||
@@ -244,3 +245,4 @@ this.process(particle, distMouse, timeSpent, opacityData); | ||
const container = this.container; | ||
const modeSize = (divBubble === null || divBubble === void 0 ? void 0 : divBubble.size) ? divBubble.size * container.retina.pixelRatio | ||
const modeSize = (divBubble === null || divBubble === void 0 ? void 0 : divBubble.size) | ||
? divBubble.size * container.retina.pixelRatio | ||
: container.retina.bubbleModeSize; | ||
@@ -247,0 +249,0 @@ if (modeSize === undefined) { |
@@ -1,2 +0,2 @@ | ||
import { loadInteraction } from "./interaction"; | ||
export { loadInteraction }; | ||
import type { Main } from "tsparticles-engine"; | ||
export declare function loadExternalBubbleInteraction(tsParticles: Main): void; |
@@ -1,4 +0,4 @@ | ||
import { loadInteraction } from "./interaction"; | ||
import { tsParticles } from "tsparticles-core"; | ||
loadInteraction(tsParticles); | ||
export { loadInteraction }; | ||
import { Bubbler } from "./Bubbler"; | ||
export function loadExternalBubbleInteraction(tsParticles) { | ||
tsParticles.addInteractor("externalBubble", (container) => new Bubbler(container)); | ||
} |
{ | ||
"name": "tsparticles-interaction-external-bubble", | ||
"version": "2.0.0-alpha.3", | ||
"version": "2.0.0-alpha.4", | ||
"description": "tsParticles Bubble external interaction", | ||
@@ -41,11 +41,11 @@ "homepage": "https://particles.js.org/", | ||
}, | ||
"main": "interaction.js", | ||
"main": "index.js", | ||
"jsdelivr": "tsparticles.interaction.external.bubble.min.js", | ||
"unpkg": "tsparticles.interaction.external.bubble.min.js", | ||
"browser": "interaction.js", | ||
"module": "interaction.js", | ||
"types": "interaction.d.ts", | ||
"browser": "index.js", | ||
"module": "index.js", | ||
"types": "index.d.ts", | ||
"dependencies": { | ||
"tsparticles-core": "^2.0.0-alpha.0" | ||
"tsparticles-engine": "^2.0.0-alpha.4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
export declare const enum ProcessBubbleType { | ||
export declare enum ProcessBubbleType { | ||
color = "color", | ||
@@ -3,0 +3,0 @@ opacity = "opacity", |
@@ -1,1 +0,6 @@ | ||
export {}; | ||
export var ProcessBubbleType; | ||
(function (ProcessBubbleType) { | ||
ProcessBubbleType["color"] = "color"; | ||
ProcessBubbleType["opacity"] = "opacity"; | ||
ProcessBubbleType["size"] = "size"; | ||
})(ProcessBubbleType || (ProcessBubbleType = {})); |
@@ -7,14 +7,14 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v2.0.0-alpha.3 | ||
* v2.0.0-alpha.4 | ||
*/ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(require("tsparticles-core")); | ||
module.exports = factory(require("tsparticles-engine")); | ||
else if(typeof define === 'function' && define.amd) | ||
define(["tsparticles-core"], factory); | ||
define(["tsparticles-engine"], factory); | ||
else { | ||
var a = typeof exports === 'object' ? factory(require("tsparticles-core")) : factory(root["window"]); | ||
var a = typeof exports === 'object' ? factory(require("tsparticles-engine")) : factory(root["window"]); | ||
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; | ||
} | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE__646__) { | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE__414__) { | ||
return /******/ (() => { // webpackBootstrap | ||
@@ -24,5 +24,67 @@ /******/ "use strict"; | ||
/***/ 269: | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
/***/ 414: | ||
/***/ ((module) => { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE__414__; | ||
/***/ }) | ||
/******/ }); | ||
/************************************************************************/ | ||
/******/ // The module cache | ||
/******/ var __webpack_module_cache__ = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ // Check if module is in cache | ||
/******/ if(__webpack_module_cache__[moduleId]) { | ||
/******/ return __webpack_module_cache__[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = __webpack_module_cache__[moduleId] = { | ||
/******/ // no module.id needed | ||
/******/ // no module.loaded needed | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/************************************************************************/ | ||
/******/ /* webpack/runtime/define property getters */ | ||
/******/ (() => { | ||
/******/ // define getter functions for harmony exports | ||
/******/ __webpack_require__.d = (exports, definition) => { | ||
/******/ for(var key in definition) { | ||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | ||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | ||
/******/ } | ||
/******/ } | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/hasOwnProperty shorthand */ | ||
/******/ (() => { | ||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/make namespace object */ | ||
/******/ (() => { | ||
/******/ // define __esModule on exports | ||
/******/ __webpack_require__.r = (exports) => { | ||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/******/ } | ||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/************************************************************************/ | ||
var __webpack_exports__ = {}; | ||
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. | ||
(() => { | ||
// ESM COMPAT FLAG | ||
@@ -33,23 +95,32 @@ __webpack_require__.r(__webpack_exports__); | ||
__webpack_require__.d(__webpack_exports__, { | ||
"loadInteraction": () => /* reexport */ loadInteraction | ||
"loadExternalBubbleInteraction": () => (/* binding */ loadExternalBubbleInteraction) | ||
}); | ||
// EXTERNAL MODULE: external {"commonjs":"tsparticles-core","commonjs2":"tsparticles-core","amd":"tsparticles-core","root":"window"} | ||
var external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_ = __webpack_require__(646); | ||
// EXTERNAL MODULE: external {"commonjs":"tsparticles-engine","commonjs2":"tsparticles-engine","amd":"tsparticles-engine","root":"window"} | ||
var external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_ = __webpack_require__(414); | ||
;// CONCATENATED MODULE: ./dist/ProcessBubbleType.js | ||
var ProcessBubbleType; | ||
(function (ProcessBubbleType) { | ||
ProcessBubbleType["color"] = "color"; | ||
ProcessBubbleType["opacity"] = "opacity"; | ||
ProcessBubbleType["size"] = "size"; | ||
})(ProcessBubbleType || (ProcessBubbleType = {})); | ||
;// CONCATENATED MODULE: ./dist/Bubbler.js | ||
const calculateBubbleValue = (particleValue, modeValue, optionsValue, ratio) => { | ||
if (modeValue > optionsValue) { | ||
const size = particleValue + (modeValue - optionsValue) * ratio; | ||
return (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.clamp)(size, particleValue, modeValue); | ||
return (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.clamp)(size, particleValue, modeValue); | ||
} else if (modeValue < optionsValue) { | ||
const size = particleValue - (optionsValue - modeValue) * ratio; | ||
return (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.clamp)(size, modeValue, particleValue); | ||
return (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.clamp)(size, modeValue, particleValue); | ||
} | ||
}; | ||
class Bubbler extends external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.ExternalInteractorBase { | ||
class Bubbler extends external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ExternalInteractorBase { | ||
constructor(container) { | ||
super(container, "bubble"); | ||
super(container); | ||
} | ||
@@ -63,3 +134,3 @@ | ||
const divs = events.onDiv; | ||
const divBubble = (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.isDivModeEnabled)("bubble", divs); | ||
const divBubble = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isDivModeEnabled)(external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.DivMode.bubble, divs); | ||
@@ -72,3 +143,3 @@ if (!(divBubble || events.onHover.enable && mouse.position || events.onClick.enable && mouse.clickPosition)) { | ||
const clickMode = events.onClick.mode; | ||
return (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.isInArray)("bubble", hoverMode) || (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.isInArray)("bubble", clickMode) || divBubble; | ||
return (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isInArray)(external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.HoverMode.bubble, hoverMode) || (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isInArray)(external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ClickMode.bubble, clickMode) || divBubble; | ||
} | ||
@@ -96,8 +167,8 @@ | ||
if (hoverEnabled && (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.isInArray)("bubble", hoverMode)) { | ||
if (hoverEnabled && (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isInArray)(external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.HoverMode.bubble, hoverMode)) { | ||
this.hoverBubble(); | ||
} else if (clickEnabled && (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.isInArray)("bubble", clickMode)) { | ||
} else if (clickEnabled && (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isInArray)(external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ClickMode.bubble, clickMode)) { | ||
this.clickBubble(); | ||
} else { | ||
(0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.divModeExecute)("bubble", divs, (selector, div) => this.singleSelectorHover(selector, div)); | ||
(0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.divModeExecute)(external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.DivMode.bubble, divs, (selector, div) => this.singleSelectorHover(selector, div)); | ||
} | ||
@@ -122,3 +193,3 @@ } | ||
const repulseRadius = elem.offsetWidth / 2 * pxRatio; | ||
const area = div.type === "circle" ? new external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.Circle(pos.x, pos.y, repulseRadius) : new external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio); | ||
const area = div.type === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.DivType.circle ? new external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.Circle(pos.x, pos.y, repulseRadius) : new external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio); | ||
const query = container.particles.quadTree.query(area); | ||
@@ -133,3 +204,3 @@ | ||
const divs = container.options.interactivity.modes.bubble.divs; | ||
const divBubble = (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.divMode)(divs, elem); | ||
const divBubble = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.divMode)(divs, elem); | ||
@@ -172,7 +243,7 @@ if (!particle.bubble.div || particle.bubble.div !== elem) { | ||
if (type === "size") { | ||
if (type === ProcessBubbleType.size) { | ||
particle.bubble.radius = value; | ||
} | ||
if (type === "opacity") { | ||
if (type === ProcessBubbleType.opacity) { | ||
particle.bubble.opacity = value; | ||
@@ -182,7 +253,7 @@ } | ||
} else { | ||
if (type === "size") { | ||
if (type === ProcessBubbleType.size) { | ||
delete particle.bubble.radius; | ||
} | ||
if (type === "opacity") { | ||
if (type === ProcessBubbleType.opacity) { | ||
delete particle.bubble.opacity; | ||
@@ -192,7 +263,7 @@ } | ||
} else if (pObjBubble) { | ||
if (type === "size") { | ||
if (type === ProcessBubbleType.size) { | ||
delete particle.bubble.radius; | ||
} | ||
if (type === "opacity") { | ||
if (type === ProcessBubbleType.opacity) { | ||
delete particle.bubble.opacity; | ||
@@ -223,3 +294,3 @@ } | ||
const pos = particle.getPosition(); | ||
const distMouse = (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.getDistance)(pos, mouseClickPos); | ||
const distMouse = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getDistance)(pos, mouseClickPos); | ||
const timeSpent = (new Date().getTime() - (container.interactivity.mouse.clickTime || 0)) / 1000; | ||
@@ -247,3 +318,3 @@ | ||
}, | ||
type: "size" | ||
type: ProcessBubbleType.size | ||
}; | ||
@@ -262,3 +333,3 @@ this.process(particle, distMouse, timeSpent, sizeData); | ||
}, | ||
type: "opacity" | ||
type: ProcessBubbleType.opacity | ||
}; | ||
@@ -293,7 +364,7 @@ this.process(particle, distMouse, timeSpent, opacityData); | ||
const pos = particle.getPosition(); | ||
const pointDistance = (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.getDistance)(pos, mousePos); | ||
const pointDistance = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getDistance)(pos, mousePos); | ||
const ratio = 1 - pointDistance / distance; | ||
if (pointDistance <= distance) { | ||
if (ratio >= 0 && container.interactivity.status === external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.Constants.mouseMoveEvent) { | ||
if (ratio >= 0 && container.interactivity.status === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.Constants.mouseMoveEvent) { | ||
this.hoverBubbleSize(particle, ratio); | ||
@@ -307,3 +378,3 @@ this.hoverBubbleOpacity(particle, ratio); | ||
if (container.interactivity.status === external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.Constants.mouseLeaveEvent) { | ||
if (container.interactivity.status === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.Constants.mouseLeaveEvent) { | ||
this.reset(particle); | ||
@@ -365,4 +436,4 @@ } | ||
const bubbleColor = modeColor instanceof Array ? (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.itemFromArray)(modeColor) : modeColor; | ||
particle.bubble.color = (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.colorToHsl)(bubbleColor); | ||
const bubbleColor = modeColor instanceof Array ? (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.itemFromArray)(modeColor) : modeColor; | ||
particle.bubble.color = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.colorToHsl)(bubbleColor); | ||
} | ||
@@ -372,83 +443,12 @@ } | ||
} | ||
;// CONCATENATED MODULE: ./dist/interaction.js | ||
;// CONCATENATED MODULE: ./dist/index.js | ||
function loadInteraction(tsParticles) { | ||
tsParticles.addInteractor(container => new Bubbler(container)); | ||
function loadExternalBubbleInteraction(tsParticles) { | ||
tsParticles.addInteractor("externalBubble", container => new Bubbler(container)); | ||
} | ||
;// CONCATENATED MODULE: ./dist/index.js | ||
})(); | ||
loadInteraction(external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.tsParticles); | ||
/***/ }), | ||
/***/ 646: | ||
/***/ ((module) => { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE__646__; | ||
/***/ }) | ||
/******/ }); | ||
/************************************************************************/ | ||
/******/ // The module cache | ||
/******/ var __webpack_module_cache__ = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ // Check if module is in cache | ||
/******/ if(__webpack_module_cache__[moduleId]) { | ||
/******/ return __webpack_module_cache__[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = __webpack_module_cache__[moduleId] = { | ||
/******/ // no module.id needed | ||
/******/ // no module.loaded needed | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/************************************************************************/ | ||
/******/ /* webpack/runtime/define property getters */ | ||
/******/ (() => { | ||
/******/ // define getter functions for harmony exports | ||
/******/ __webpack_require__.d = (exports, definition) => { | ||
/******/ for(var key in definition) { | ||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | ||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | ||
/******/ } | ||
/******/ } | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/hasOwnProperty shorthand */ | ||
/******/ (() => { | ||
/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/make namespace object */ | ||
/******/ (() => { | ||
/******/ // define __esModule on exports | ||
/******/ __webpack_require__.r = (exports) => { | ||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/******/ } | ||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/************************************************************************/ | ||
/******/ // module exports must be returned from runtime so entry inlining is disabled | ||
/******/ // startup | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(269); | ||
/******/ return __webpack_exports__; | ||
/******/ })() | ||
; | ||
}); |
@@ -1,2 +0,2 @@ | ||
/*! tsParticles Bubble External Interaction v2.0.0-alpha.3 by Matteo Bruni */ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("tsparticles-core"));else if("function"==typeof define&&define.amd)define(["tsparticles-core"],t);else{var i="object"==typeof exports?t(require("tsparticles-core")):t(e.window);for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}}(this,(function(e){return(()=>{"use strict";var t={269:(e,t,i)=>{i.r(t),i.d(t,{loadInteraction:()=>r});var o=i(646);const b=(e,t,i,b)=>{if(t>i){const n=e+(t-i)*b;return(0,o.clamp)(n,e,t)}if(t<i){const n=e-(i-t)*b;return(0,o.clamp)(n,t,e)}};class n extends o.ExternalInteractorBase{constructor(e){super(e,"bubble")}isEnabled(){const e=this.container,t=e.options,i=e.interactivity.mouse,b=t.interactivity.events,n=b.onDiv,r=(0,o.isDivModeEnabled)("bubble",n);if(!(r||b.onHover.enable&&i.position||b.onClick.enable&&i.clickPosition))return!1;const l=b.onHover.mode,s=b.onClick.mode;return(0,o.isInArray)("bubble",l)||(0,o.isInArray)("bubble",s)||r}reset(e,t){e.bubble.inRange&&!t||(delete e.bubble.div,delete e.bubble.opacity,delete e.bubble.radius,delete e.bubble.color)}interact(){const e=this.container.options.interactivity.events,t=e.onHover,i=e.onClick,b=t.enable,n=t.mode,r=i.enable,l=i.mode,s=e.onDiv;b&&(0,o.isInArray)("bubble",n)?this.hoverBubble():r&&(0,o.isInArray)("bubble",l)?this.clickBubble():(0,o.divModeExecute)("bubble",s,((e,t)=>this.singleSelectorHover(e,t)))}singleSelectorHover(e,t){const i=this.container,b=document.querySelectorAll(e);b.length&&b.forEach((e=>{const b=e,n=i.retina.pixelRatio,r={x:(b.offsetLeft+b.offsetWidth/2)*n,y:(b.offsetTop+b.offsetHeight/2)*n},l=b.offsetWidth/2*n,s="circle"===t.type?new o.Circle(r.x,r.y,l):new o.Rectangle(b.offsetLeft*n,b.offsetTop*n,b.offsetWidth*n,b.offsetHeight*n),a=i.particles.quadTree.query(s);for(const e of a){if(!s.contains(e.getPosition()))continue;e.bubble.inRange=!0;const t=i.options.interactivity.modes.bubble.divs,n=(0,o.divMode)(t,b);e.bubble.div&&e.bubble.div===b||(this.reset(e,!0),e.bubble.div=b),this.hoverBubbleSize(e,1,n),this.hoverBubbleOpacity(e,1,n),this.hoverBubbleColor(e,n)}}))}process(e,t,i,o){const b=this.container,n=o.bubbleObj.optValue;if(void 0===n)return;const r=b.options.interactivity.modes.bubble.duration,l=b.retina.bubbleModeDistance,s=o.particlesObj.optValue,a=o.bubbleObj.value,u=o.particlesObj.value||0,c=o.type;if(n!==s)if(b.bubble.durationEnd)a&&("size"===c&&delete e.bubble.radius,"opacity"===c&&delete e.bubble.opacity);else if(t<=l){if((null!=a?a:u)!==n){const t=u-i*(u-n)/r;"size"===c&&(e.bubble.radius=t),"opacity"===c&&(e.bubble.opacity=t)}}else"size"===c&&delete e.bubble.radius,"opacity"===c&&delete e.bubble.opacity}clickBubble(){const e=this.container,t=e.options,i=e.interactivity.mouse.clickPosition;if(void 0===i)return;const b=e.retina.bubbleModeDistance,n=e.particles.quadTree.queryCircle(i,b);for(const b of n){if(!e.bubble.clicking)continue;b.bubble.inRange=!e.bubble.durationEnd;const n=b.getPosition(),r=(0,o.getDistance)(n,i),l=((new Date).getTime()-(e.interactivity.mouse.clickTime||0))/1e3;l>t.interactivity.modes.bubble.duration&&(e.bubble.durationEnd=!0),l>2*t.interactivity.modes.bubble.duration&&(e.bubble.clicking=!1,e.bubble.durationEnd=!1);const s=b.options.size.value,a=("number"==typeof s?s:s.max)*e.retina.pixelRatio,u={bubbleObj:{optValue:e.retina.bubbleModeSize,value:b.bubble.radius},particlesObj:{optValue:a,value:b.size.value},type:"size"};this.process(b,r,l,u);const c=b.options.opacity.value,d=("number"==typeof c?c:c.max)*e.retina.pixelRatio,p={bubbleObj:{optValue:t.interactivity.modes.bubble.opacity,value:b.bubble.opacity},particlesObj:{optValue:d,value:b.opacity.value},type:"opacity"};this.process(b,r,l,p),e.bubble.durationEnd?delete b.bubble.color:r<=e.retina.bubbleModeDistance?this.hoverBubbleColor(b):delete b.bubble.color}}hoverBubble(){const e=this.container,t=e.interactivity.mouse.position;if(void 0===t)return;const i=e.retina.bubbleModeDistance,b=e.particles.quadTree.queryCircle(t,i);for(const n of b){n.bubble.inRange=!0;const b=n.getPosition(),r=(0,o.getDistance)(b,t),l=1-r/i;r<=i?l>=0&&e.interactivity.status===o.Constants.mouseMoveEvent&&(this.hoverBubbleSize(n,l),this.hoverBubbleOpacity(n,l),this.hoverBubbleColor(n)):this.reset(n),e.interactivity.status===o.Constants.mouseLeaveEvent&&this.reset(n)}}hoverBubbleSize(e,t,i){const o=this.container,n=(null==i?void 0:i.size)?i.size*o.retina.pixelRatio:o.retina.bubbleModeSize;if(void 0===n)return;const r=e.options.size.value,l=("number"==typeof r?r:r.max)*o.retina.pixelRatio,s=e.size.value,a=b(s,n,l,t);void 0!==a&&(e.bubble.radius=a)}hoverBubbleOpacity(e,t,i){var o;const n=this.container,r=n.options,l=null!==(o=null==i?void 0:i.opacity)&&void 0!==o?o:r.interactivity.modes.bubble.opacity;if(void 0===l)return;const s=e.options.opacity.value,a=("number"==typeof s?s:s.max)*n.retina.pixelRatio,u=e.opacity.value,c=b(u,l,a,t);void 0!==c&&(e.bubble.opacity=c)}hoverBubbleColor(e,t){var i;const b=this.container.options;if(void 0===e.bubble.color){const n=null!==(i=null==t?void 0:t.color)&&void 0!==i?i:b.interactivity.modes.bubble.color;if(void 0===n)return;const r=n instanceof Array?(0,o.itemFromArray)(n):n;e.bubble.color=(0,o.colorToHsl)(r)}}}function r(e){e.addInteractor((e=>new n(e)))}r(o.tsParticles)},646:t=>{t.exports=e}},i={};function o(e){if(i[e])return i[e].exports;var b=i[e]={exports:{}};return t[e](b,b.exports,o),b.exports}return o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o(269)})()})); | ||
/*! tsParticles Bubble External Interaction v2.0.0-alpha.4 by Matteo Bruni */ | ||
!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 i="object"==typeof exports?t(require("tsparticles-engine")):t(e.window);for(var o in i)("object"==typeof exports?exports:e)[o]=i[o]}}(this,(function(e){return(()=>{"use strict";var t={414:t=>{t.exports=e}},i={};function o(e){if(i[e])return i[e].exports;var n=i[e]={exports:{}};return t[e](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{loadExternalBubbleInteraction:()=>r});var e,t=o(414);!function(e){e.color="color",e.opacity="opacity",e.size="size"}(e||(e={}));const i=(e,i,o,n)=>{if(i>o){const b=e+(i-o)*n;return(0,t.clamp)(b,e,i)}if(i<o){const b=e-(o-i)*n;return(0,t.clamp)(b,i,e)}};class b extends t.ExternalInteractorBase{constructor(e){super(e)}isEnabled(){const e=this.container,i=e.options,o=e.interactivity.mouse,n=i.interactivity.events,b=n.onDiv,r=(0,t.isDivModeEnabled)(t.DivMode.bubble,b);if(!(r||n.onHover.enable&&o.position||n.onClick.enable&&o.clickPosition))return!1;const l=n.onHover.mode,s=n.onClick.mode;return(0,t.isInArray)(t.HoverMode.bubble,l)||(0,t.isInArray)(t.ClickMode.bubble,s)||r}reset(e,t){e.bubble.inRange&&!t||(delete e.bubble.div,delete e.bubble.opacity,delete e.bubble.radius,delete e.bubble.color)}interact(){const e=this.container.options.interactivity.events,i=e.onHover,o=e.onClick,n=i.enable,b=i.mode,r=o.enable,l=o.mode,s=e.onDiv;n&&(0,t.isInArray)(t.HoverMode.bubble,b)?this.hoverBubble():r&&(0,t.isInArray)(t.ClickMode.bubble,l)?this.clickBubble():(0,t.divModeExecute)(t.DivMode.bubble,s,((e,t)=>this.singleSelectorHover(e,t)))}singleSelectorHover(e,i){const o=this.container,n=document.querySelectorAll(e);n.length&&n.forEach((e=>{const n=e,b=o.retina.pixelRatio,r={x:(n.offsetLeft+n.offsetWidth/2)*b,y:(n.offsetTop+n.offsetHeight/2)*b},l=n.offsetWidth/2*b,s=i.type===t.DivType.circle?new t.Circle(r.x,r.y,l):new t.Rectangle(n.offsetLeft*b,n.offsetTop*b,n.offsetWidth*b,n.offsetHeight*b),a=o.particles.quadTree.query(s);for(const e of a){if(!s.contains(e.getPosition()))continue;e.bubble.inRange=!0;const i=o.options.interactivity.modes.bubble.divs,b=(0,t.divMode)(i,n);e.bubble.div&&e.bubble.div===n||(this.reset(e,!0),e.bubble.div=n),this.hoverBubbleSize(e,1,b),this.hoverBubbleOpacity(e,1,b),this.hoverBubbleColor(e,b)}}))}process(t,i,o,n){const b=this.container,r=n.bubbleObj.optValue;if(void 0===r)return;const l=b.options.interactivity.modes.bubble.duration,s=b.retina.bubbleModeDistance,a=n.particlesObj.optValue,u=n.bubbleObj.value,c=n.particlesObj.value||0,d=n.type;if(r!==a)if(b.bubble.durationEnd)u&&(d===e.size&&delete t.bubble.radius,d===e.opacity&&delete t.bubble.opacity);else if(i<=s){if((null!=u?u:c)!==r){const i=c-o*(c-r)/l;d===e.size&&(t.bubble.radius=i),d===e.opacity&&(t.bubble.opacity=i)}}else d===e.size&&delete t.bubble.radius,d===e.opacity&&delete t.bubble.opacity}clickBubble(){const i=this.container,o=i.options,n=i.interactivity.mouse.clickPosition;if(void 0===n)return;const b=i.retina.bubbleModeDistance,r=i.particles.quadTree.queryCircle(n,b);for(const b of r){if(!i.bubble.clicking)continue;b.bubble.inRange=!i.bubble.durationEnd;const r=b.getPosition(),l=(0,t.getDistance)(r,n),s=((new Date).getTime()-(i.interactivity.mouse.clickTime||0))/1e3;s>o.interactivity.modes.bubble.duration&&(i.bubble.durationEnd=!0),s>2*o.interactivity.modes.bubble.duration&&(i.bubble.clicking=!1,i.bubble.durationEnd=!1);const a=b.options.size.value,u=("number"==typeof a?a:a.max)*i.retina.pixelRatio,c={bubbleObj:{optValue:i.retina.bubbleModeSize,value:b.bubble.radius},particlesObj:{optValue:u,value:b.size.value},type:e.size};this.process(b,l,s,c);const d=b.options.opacity.value,p=("number"==typeof d?d:d.max)*i.retina.pixelRatio,v={bubbleObj:{optValue:o.interactivity.modes.bubble.opacity,value:b.bubble.opacity},particlesObj:{optValue:p,value:b.opacity.value},type:e.opacity};this.process(b,l,s,v),i.bubble.durationEnd?delete b.bubble.color:l<=i.retina.bubbleModeDistance?this.hoverBubbleColor(b):delete b.bubble.color}}hoverBubble(){const e=this.container,i=e.interactivity.mouse.position;if(void 0===i)return;const o=e.retina.bubbleModeDistance,n=e.particles.quadTree.queryCircle(i,o);for(const b of n){b.bubble.inRange=!0;const n=b.getPosition(),r=(0,t.getDistance)(n,i),l=1-r/o;r<=o?l>=0&&e.interactivity.status===t.Constants.mouseMoveEvent&&(this.hoverBubbleSize(b,l),this.hoverBubbleOpacity(b,l),this.hoverBubbleColor(b)):this.reset(b),e.interactivity.status===t.Constants.mouseLeaveEvent&&this.reset(b)}}hoverBubbleSize(e,t,o){const n=this.container,b=(null==o?void 0:o.size)?o.size*n.retina.pixelRatio:n.retina.bubbleModeSize;if(void 0===b)return;const r=e.options.size.value,l=("number"==typeof r?r:r.max)*n.retina.pixelRatio,s=e.size.value,a=i(s,b,l,t);void 0!==a&&(e.bubble.radius=a)}hoverBubbleOpacity(e,t,o){var n;const b=this.container,r=b.options,l=null!==(n=null==o?void 0:o.opacity)&&void 0!==n?n:r.interactivity.modes.bubble.opacity;if(void 0===l)return;const s=e.options.opacity.value,a=("number"==typeof s?s:s.max)*b.retina.pixelRatio,u=e.opacity.value,c=i(u,l,a,t);void 0!==c&&(e.bubble.opacity=c)}hoverBubbleColor(e,i){var o;const n=this.container.options;if(void 0===e.bubble.color){const b=null!==(o=null==i?void 0:i.color)&&void 0!==o?o:n.interactivity.modes.bubble.color;if(void 0===b)return;const r=b instanceof Array?(0,t.itemFromArray)(b):b;e.bubble.color=(0,t.colorToHsl)(r)}}}function r(e){e.addInteractor("externalBubble",(e=>new b(e)))}})(),n})()})); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
314552
697
13
+ Addedtsparticles-engine@2.12.0(transitive)
- Removedtsparticles-core@^2.0.0-alpha.0