@tsparticles/interaction-particles-links 3.2.2 → 3.4.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/browser/LinkInstance.js +6 -7
- package/browser/Linker.js +5 -5
- package/browser/LinksPlugin.js +3 -3
- package/browser/Utils.js +1 -1
- package/browser/index.js +2 -1
- package/browser/interaction.js +2 -2
- package/browser/plugin.js +2 -1
- package/cjs/LinkInstance.js +6 -7
- package/cjs/Linker.js +6 -29
- package/cjs/LinksPlugin.js +3 -26
- package/cjs/Utils.js +1 -1
- package/cjs/index.js +4 -15
- package/cjs/interaction.js +2 -25
- package/cjs/plugin.js +2 -24
- package/esm/LinkInstance.js +6 -7
- package/esm/Linker.js +5 -5
- package/esm/LinksPlugin.js +3 -3
- package/esm/Utils.js +1 -1
- package/esm/index.js +2 -1
- package/esm/interaction.js +2 -2
- package/esm/plugin.js +2 -1
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.interaction.particles.links.js +72 -200
- package/tsparticles.interaction.particles.links.min.js +1 -1
- package/tsparticles.interaction.particles.links.min.js.LICENSE.txt +1 -1
- package/types/LinkInstance.d.ts +1 -1
- package/types/Linker.d.ts +1 -1
- package/types/LinksPlugin.d.ts +1 -1
- package/umd/LinkInstance.js +6 -7
- package/umd/Linker.js +7 -31
- package/umd/LinksPlugin.js +4 -28
- package/umd/Utils.js +1 -1
- package/umd/index.js +5 -17
- package/umd/interaction.js +3 -27
- package/umd/plugin.js +3 -26
- package/292.min.js +0 -2
- package/292.min.js.LICENSE.txt +0 -1
- package/356.min.js +0 -2
- package/356.min.js.LICENSE.txt +0 -1
- package/45.min.js +0 -2
- package/45.min.js.LICENSE.txt +0 -1
- package/806.min.js +0 -2
- package/806.min.js.LICENSE.txt +0 -1
- package/838.min.js +0 -2
- package/838.min.js.LICENSE.txt +0 -1
- package/97.min.js +0 -2
- package/97.min.js.LICENSE.txt +0 -1
- package/dist_browser_CircleWarp_js.js +0 -30
- package/dist_browser_LinkInstance_js.js +0 -40
- package/dist_browser_Linker_js.js +0 -30
- package/dist_browser_LinksPlugin_js.js +0 -30
- package/dist_browser_interaction_js.js +0 -30
- package/dist_browser_plugin_js.js +0 -30
|
@@ -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.4.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,6 +28,46 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
+
/***/ "./dist/browser/CircleWarp.js":
|
|
32
|
+
/*!************************************!*\
|
|
33
|
+
!*** ./dist/browser/CircleWarp.js ***!
|
|
34
|
+
\************************************/
|
|
35
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
|
+
|
|
37
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CircleWarp: () => (/* binding */ CircleWarp)\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\nconst double = 2;\nclass CircleWarp extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle {\n constructor(x, y, radius, canvasSize) {\n super(x, y, radius);\n this.canvasSize = canvasSize;\n this.canvasSize = {\n ...canvasSize\n };\n }\n contains(point) {\n const {\n width,\n height\n } = this.canvasSize,\n {\n x,\n y\n } = point;\n return super.contains(point) || super.contains({\n x: x - width,\n y\n }) || super.contains({\n x: x - width,\n y: y - height\n }) || super.contains({\n x,\n y: y - height\n });\n }\n intersects(range) {\n if (super.intersects(range)) {\n return true;\n }\n const rect = range,\n circle = range,\n newPos = {\n x: range.position.x - this.canvasSize.width,\n y: range.position.y - this.canvasSize.height\n };\n if (circle.radius !== undefined) {\n const biggerCircle = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(newPos.x, newPos.y, circle.radius * double);\n return super.intersects(biggerCircle);\n } else if (rect.size !== undefined) {\n const rectSW = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Rectangle(newPos.x, newPos.y, rect.size.width * double, rect.size.height * double);\n return super.intersects(rectSW);\n }\n return false;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-links/./dist/browser/CircleWarp.js?");
|
|
38
|
+
|
|
39
|
+
/***/ }),
|
|
40
|
+
|
|
41
|
+
/***/ "./dist/browser/LinkInstance.js":
|
|
42
|
+
/*!**************************************!*\
|
|
43
|
+
!*** ./dist/browser/LinkInstance.js ***!
|
|
44
|
+
\**************************************/
|
|
45
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
46
|
+
|
|
47
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LinkInstance: () => (/* binding */ LinkInstance)\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 _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\nconst minOpacity = 0,\n minWidth = 0,\n minDistance = 0,\n half = 0.5,\n maxFrequency = 1;\nclass LinkInstance {\n constructor(container) {\n this.container = container;\n this._drawLinkLine = (p1, link) => {\n const p1LinksOptions = p1.options.links;\n if (!p1LinksOptions?.enable) {\n return;\n }\n const container = this.container,\n options = container.actualOptions,\n p2 = link.destination,\n pos1 = p1.getPosition(),\n pos2 = p2.getPosition();\n let opacity = link.opacity;\n container.canvas.draw(ctx => {\n let colorLine;\n const twinkle = p1.options.twinkle?.lines;\n if (twinkle?.enable) {\n const twinkleFreq = twinkle.frequency,\n twinkleRgb = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToRgb)(twinkle.color),\n twinkling = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() < twinkleFreq;\n if (twinkling && twinkleRgb) {\n colorLine = twinkleRgb;\n opacity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(twinkle.opacity);\n }\n }\n if (!colorLine) {\n const linkColor = p1LinksOptions.id !== undefined ? container.particles.linksColors.get(p1LinksOptions.id) : container.particles.linksColor;\n colorLine = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLinkColor)(p1, p2, linkColor);\n }\n if (!colorLine) {\n return;\n }\n const width = p1.retina.linksWidth ?? minWidth,\n maxDistance = p1.retina.linksDistance ?? minDistance,\n {\n backgroundMask\n } = options;\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawLinkLine)({\n context: ctx,\n width,\n begin: pos1,\n end: pos2,\n maxDistance,\n canvasSize: container.canvas.size,\n links: p1LinksOptions,\n backgroundMask: backgroundMask,\n colorLine,\n opacity\n });\n });\n };\n this._drawLinkTriangle = (p1, link1, link2) => {\n const linksOptions = p1.options.links;\n if (!linksOptions?.enable) {\n return;\n }\n const triangleOptions = linksOptions.triangles;\n if (!triangleOptions.enable) {\n return;\n }\n const container = this.container,\n options = container.actualOptions,\n p2 = link1.destination,\n p3 = link2.destination,\n opacityTriangle = triangleOptions.opacity ?? (link1.opacity + link2.opacity) * half;\n if (opacityTriangle <= minOpacity) {\n return;\n }\n container.canvas.draw(ctx => {\n const pos1 = p1.getPosition(),\n pos2 = p2.getPosition(),\n pos3 = p3.getPosition(),\n linksDistance = p1.retina.linksDistance ?? minDistance;\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos1, pos2) > linksDistance || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos3, pos2) > linksDistance || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos3, pos1) > linksDistance) {\n return;\n }\n let colorTriangle = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToRgb)(triangleOptions.color);\n if (!colorTriangle) {\n const linkColor = linksOptions.id !== undefined ? container.particles.linksColors.get(linksOptions.id) : container.particles.linksColor;\n colorTriangle = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLinkColor)(p1, p2, linkColor);\n }\n if (!colorTriangle) {\n return;\n }\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawLinkTriangle)({\n context: ctx,\n pos1,\n pos2,\n pos3,\n backgroundMask: options.backgroundMask,\n colorTriangle,\n opacityTriangle\n });\n });\n };\n this._drawTriangles = (options, p1, link, p1Links) => {\n const p2 = link.destination;\n if (!(options.links?.triangles.enable && p2.options.links?.triangles.enable)) {\n return;\n }\n const vertices = p2.links?.filter(t => {\n const linkFreq = this._getLinkFrequency(p2, t.destination),\n minCount = 0;\n return p2.options.links && linkFreq <= p2.options.links.frequency && p1Links.findIndex(l => l.destination === t.destination) >= minCount;\n });\n if (!vertices?.length) {\n return;\n }\n for (const vertex of vertices) {\n const p3 = vertex.destination,\n triangleFreq = this._getTriangleFrequency(p1, p2, p3);\n if (triangleFreq > options.links.triangles.frequency) {\n continue;\n }\n this._drawLinkTriangle(p1, link, vertex);\n }\n };\n this._getLinkFrequency = (p1, p2) => {\n return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.setLinkFrequency)([p1, p2], this._freqs.links);\n };\n this._getTriangleFrequency = (p1, p2, p3) => {\n return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.setLinkFrequency)([p1, p2, p3], this._freqs.triangles);\n };\n this._freqs = {\n links: new Map(),\n triangles: new Map()\n };\n }\n drawParticle(context, particle) {\n const {\n links,\n options\n } = particle;\n if (!links?.length) {\n return;\n }\n const p1Links = links.filter(l => options.links && (options.links.frequency >= maxFrequency || this._getLinkFrequency(particle, l.destination) <= options.links.frequency));\n for (const link of p1Links) {\n this._drawTriangles(options, particle, link, p1Links);\n if (link.opacity > minOpacity && (particle.retina.linksWidth ?? minWidth) > minWidth) {\n this._drawLinkLine(particle, link);\n }\n }\n }\n async init() {\n this._freqs.links = new Map();\n this._freqs.triangles = new Map();\n await Promise.resolve();\n }\n particleCreated(particle) {\n particle.links = [];\n if (!particle.options.links) {\n return;\n }\n const ratio = this.container.retina.pixelRatio,\n {\n retina\n } = particle,\n {\n distance,\n width\n } = particle.options.links;\n retina.linksDistance = distance * ratio;\n retina.linksWidth = width * ratio;\n }\n particleDestroyed(particle) {\n particle.links = [];\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-links/./dist/browser/LinkInstance.js?");
|
|
48
|
+
|
|
49
|
+
/***/ }),
|
|
50
|
+
|
|
51
|
+
/***/ "./dist/browser/Linker.js":
|
|
52
|
+
/*!********************************!*\
|
|
53
|
+
!*** ./dist/browser/Linker.js ***!
|
|
54
|
+
\********************************/
|
|
55
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
56
|
+
|
|
57
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Linker: () => (/* binding */ Linker)\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 _CircleWarp_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CircleWarp.js */ \"./dist/browser/CircleWarp.js\");\n/* harmony import */ var _Options_Classes_Links_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Links.js */ \"./dist/browser/Options/Classes/Links.js\");\n\n\n\nconst squarePower = 2,\n opacityOffset = 1,\n origin = {\n x: 0,\n y: 0\n },\n minDistance = 0;\nfunction getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {\n const {\n dx,\n dy,\n distance\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(pos1, pos2);\n if (!warp || distance <= optDistance) {\n return distance;\n }\n const absDiffs = {\n x: Math.abs(dx),\n y: Math.abs(dy)\n },\n warpDistances = {\n x: Math.min(absDiffs.x, canvasSize.width - absDiffs.x),\n y: Math.min(absDiffs.y, canvasSize.height - absDiffs.y)\n };\n return Math.sqrt(warpDistances.x ** squarePower + warpDistances.y ** squarePower);\n}\nclass Linker extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ParticlesInteractorBase {\n constructor(container) {\n super(container);\n this._setColor = p1 => {\n if (!p1.options.links) {\n return;\n }\n const container = this.linkContainer,\n linksOptions = p1.options.links;\n let linkColor = linksOptions.id === undefined ? container.particles.linksColor : container.particles.linksColors.get(linksOptions.id);\n if (linkColor) {\n return;\n }\n const optColor = linksOptions.color;\n linkColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLinkRandomColor)(optColor, linksOptions.blink, linksOptions.consent);\n if (linksOptions.id === undefined) {\n container.particles.linksColor = linkColor;\n } else {\n container.particles.linksColors.set(linksOptions.id, linkColor);\n }\n };\n this.linkContainer = container;\n }\n clear() {}\n init() {\n this.linkContainer.particles.linksColor = undefined;\n this.linkContainer.particles.linksColors = new Map();\n }\n interact(p1) {\n if (!p1.options.links) {\n return;\n }\n p1.links = [];\n const pos1 = p1.getPosition(),\n container = this.container,\n canvasSize = container.canvas.size;\n if (pos1.x < origin.x || pos1.y < origin.y || pos1.x > canvasSize.width || pos1.y > canvasSize.height) {\n return;\n }\n const linkOpt1 = p1.options.links,\n optOpacity = linkOpt1.opacity,\n optDistance = p1.retina.linksDistance ?? minDistance,\n warp = linkOpt1.warp;\n let range;\n if (warp) {\n range = new _CircleWarp_js__WEBPACK_IMPORTED_MODULE_1__.CircleWarp(pos1.x, pos1.y, optDistance, canvasSize);\n } else {\n range = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(pos1.x, pos1.y, optDistance);\n }\n const query = container.particles.quadTree.query(range);\n for (const p2 of query) {\n const linkOpt2 = p2.options.links;\n if (p1 === p2 || !linkOpt2?.enable || linkOpt1.id !== linkOpt2.id || p2.spawning || p2.destroyed || !p2.links || p1.links.some(t => t.destination === p2) || p2.links.some(t => t.destination === p1)) {\n continue;\n }\n const pos2 = p2.getPosition();\n if (pos2.x < origin.x || pos2.y < origin.y || pos2.x > canvasSize.width || pos2.y > canvasSize.height) {\n continue;\n }\n const distance = getLinkDistance(pos1, pos2, optDistance, canvasSize, warp && linkOpt2.warp);\n if (distance > optDistance) {\n continue;\n }\n const opacityLine = (opacityOffset - distance / optDistance) * optOpacity;\n this._setColor(p1);\n p1.links.push({\n destination: p2,\n opacity: opacityLine\n });\n }\n }\n isEnabled(particle) {\n return !!particle.options.links?.enable;\n }\n loadParticlesOptions(options, ...sources) {\n if (!options.links) {\n options.links = new _Options_Classes_Links_js__WEBPACK_IMPORTED_MODULE_2__.Links();\n }\n for (const source of sources) {\n options.links.load(source?.links);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-links/./dist/browser/Linker.js?");
|
|
58
|
+
|
|
59
|
+
/***/ }),
|
|
60
|
+
|
|
61
|
+
/***/ "./dist/browser/LinksPlugin.js":
|
|
62
|
+
/*!*************************************!*\
|
|
63
|
+
!*** ./dist/browser/LinksPlugin.js ***!
|
|
64
|
+
\*************************************/
|
|
65
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66
|
+
|
|
67
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LinksPlugin: () => (/* binding */ LinksPlugin)\n/* harmony export */ });\n/* harmony import */ var _LinkInstance_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LinkInstance.js */ \"./dist/browser/LinkInstance.js\");\n\nclass LinksPlugin {\n constructor() {\n this.id = \"links\";\n }\n getPlugin(container) {\n return Promise.resolve(new _LinkInstance_js__WEBPACK_IMPORTED_MODULE_0__.LinkInstance(container));\n }\n loadOptions() {}\n needsPlugin() {\n return true;\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-links/./dist/browser/LinksPlugin.js?");
|
|
68
|
+
|
|
69
|
+
/***/ }),
|
|
70
|
+
|
|
31
71
|
/***/ "./dist/browser/Options/Classes/Links.js":
|
|
32
72
|
/*!***********************************************!*\
|
|
33
73
|
!*** ./dist/browser/Options/Classes/Links.js ***!
|
|
@@ -58,13 +98,43 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
58
98
|
|
|
59
99
|
/***/ }),
|
|
60
100
|
|
|
101
|
+
/***/ "./dist/browser/Utils.js":
|
|
102
|
+
/*!*******************************!*\
|
|
103
|
+
!*** ./dist/browser/Utils.js ***!
|
|
104
|
+
\*******************************/
|
|
105
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
106
|
+
|
|
107
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawLinkLine: () => (/* binding */ drawLinkLine),\n/* harmony export */ drawLinkTriangle: () => (/* binding */ drawLinkTriangle),\n/* harmony export */ drawTriangle: () => (/* binding */ drawTriangle),\n/* harmony export */ getLinkKey: () => (/* binding */ getLinkKey),\n/* harmony export */ setLinkFrequency: () => (/* binding */ setLinkFrequency)\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\nfunction drawTriangle(context, p1, p2, p3) {\n context.beginPath();\n context.moveTo(p1.x, p1.y);\n context.lineTo(p2.x, p2.y);\n context.lineTo(p3.x, p3.y);\n context.closePath();\n}\nfunction drawLinkLine(params) {\n let drawn = false;\n const {\n begin,\n end,\n maxDistance,\n context,\n canvasSize,\n width,\n backgroundMask,\n colorLine,\n opacity,\n links\n } = params;\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(begin, end) <= maxDistance) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.drawLine)(context, begin, end);\n drawn = true;\n } else if (links.warp) {\n let pi1;\n let pi2;\n const endNE = {\n x: end.x - canvasSize.width,\n y: end.y\n };\n const d1 = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(begin, endNE);\n if (d1.distance <= maxDistance) {\n const yi = begin.y - d1.dy / d1.dx * begin.x;\n pi1 = {\n x: 0,\n y: yi\n };\n pi2 = {\n x: canvasSize.width,\n y: yi\n };\n } else {\n const endSW = {\n x: end.x,\n y: end.y - canvasSize.height\n };\n const d2 = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(begin, endSW);\n if (d2.distance <= maxDistance) {\n const yi = begin.y - d2.dy / d2.dx * begin.x;\n const xi = -yi / (d2.dy / d2.dx);\n pi1 = {\n x: xi,\n y: 0\n };\n pi2 = {\n x: xi,\n y: canvasSize.height\n };\n } else {\n const endSE = {\n x: end.x - canvasSize.width,\n y: end.y - canvasSize.height\n };\n const d3 = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(begin, endSE);\n if (d3.distance <= maxDistance) {\n const yi = begin.y - d3.dy / d3.dx * begin.x;\n const xi = -yi / (d3.dy / d3.dx);\n pi1 = {\n x: xi,\n y: yi\n };\n pi2 = {\n x: pi1.x + canvasSize.width,\n y: pi1.y + canvasSize.height\n };\n }\n }\n }\n if (pi1 && pi2) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.drawLine)(context, begin, pi1);\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.drawLine)(context, end, pi2);\n drawn = true;\n }\n }\n if (!drawn) {\n return;\n }\n context.lineWidth = width;\n if (backgroundMask.enable) {\n context.globalCompositeOperation = backgroundMask.composite;\n }\n context.strokeStyle = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(colorLine, opacity);\n const {\n shadow\n } = links;\n if (shadow.enable) {\n const shadowColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToRgb)(shadow.color);\n if (shadowColor) {\n context.shadowBlur = shadow.blur;\n context.shadowColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(shadowColor);\n }\n }\n context.stroke();\n}\nfunction drawLinkTriangle(params) {\n const {\n context,\n pos1,\n pos2,\n pos3,\n backgroundMask,\n colorTriangle,\n opacityTriangle\n } = params;\n drawTriangle(context, pos1, pos2, pos3);\n if (backgroundMask.enable) {\n context.globalCompositeOperation = backgroundMask.composite;\n }\n context.fillStyle = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(colorTriangle, opacityTriangle);\n context.fill();\n}\nfunction getLinkKey(ids) {\n ids.sort((a, b) => a - b);\n return ids.join(\"_\");\n}\nfunction setLinkFrequency(particles, dictionary) {\n const key = getLinkKey(particles.map(t => t.id));\n let res = dictionary.get(key);\n if (res === undefined) {\n res = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)();\n dictionary.set(key, res);\n }\n return res;\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-links/./dist/browser/Utils.js?");
|
|
108
|
+
|
|
109
|
+
/***/ }),
|
|
110
|
+
|
|
61
111
|
/***/ "./dist/browser/index.js":
|
|
62
112
|
/*!*******************************!*\
|
|
63
113
|
!*** ./dist/browser/index.js ***!
|
|
64
114
|
\*******************************/
|
|
65
115
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66
116
|
|
|
67
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Links: () => (/* reexport safe */
|
|
117
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Links: () => (/* reexport safe */ _Options_Classes_Links_js__WEBPACK_IMPORTED_MODULE_2__.Links),\n/* harmony export */ LinksShadow: () => (/* reexport safe */ _Options_Classes_LinksShadow_js__WEBPACK_IMPORTED_MODULE_3__.LinksShadow),\n/* harmony export */ LinksTriangle: () => (/* reexport safe */ _Options_Classes_LinksTriangle_js__WEBPACK_IMPORTED_MODULE_4__.LinksTriangle),\n/* harmony export */ loadParticlesLinksInteraction: () => (/* binding */ loadParticlesLinksInteraction)\n/* harmony export */ });\n/* harmony import */ var _interaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interaction.js */ \"./dist/browser/interaction.js\");\n/* harmony import */ var _plugin_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./plugin.js */ \"./dist/browser/plugin.js\");\n/* harmony import */ var _Options_Classes_Links_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Links.js */ \"./dist/browser/Options/Classes/Links.js\");\n/* harmony import */ var _Options_Classes_LinksShadow_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Options/Classes/LinksShadow.js */ \"./dist/browser/Options/Classes/LinksShadow.js\");\n/* harmony import */ var _Options_Classes_LinksTriangle_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Options/Classes/LinksTriangle.js */ \"./dist/browser/Options/Classes/LinksTriangle.js\");\n\n\nasync function loadParticlesLinksInteraction(engine, refresh = true) {\n await (0,_interaction_js__WEBPACK_IMPORTED_MODULE_0__.loadLinksInteraction)(engine, refresh);\n await (0,_plugin_js__WEBPACK_IMPORTED_MODULE_1__.loadLinksPlugin)(engine, refresh);\n}\n\n\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-links/./dist/browser/index.js?");
|
|
118
|
+
|
|
119
|
+
/***/ }),
|
|
120
|
+
|
|
121
|
+
/***/ "./dist/browser/interaction.js":
|
|
122
|
+
/*!*************************************!*\
|
|
123
|
+
!*** ./dist/browser/interaction.js ***!
|
|
124
|
+
\*************************************/
|
|
125
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
126
|
+
|
|
127
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadLinksInteraction: () => (/* binding */ loadLinksInteraction)\n/* harmony export */ });\n/* harmony import */ var _Linker_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Linker.js */ \"./dist/browser/Linker.js\");\n\nasync function loadLinksInteraction(engine, refresh = true) {\n await engine.addInteractor(\"particlesLinks\", async container => {\n return Promise.resolve(new _Linker_js__WEBPACK_IMPORTED_MODULE_0__.Linker(container));\n }, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-links/./dist/browser/interaction.js?");
|
|
128
|
+
|
|
129
|
+
/***/ }),
|
|
130
|
+
|
|
131
|
+
/***/ "./dist/browser/plugin.js":
|
|
132
|
+
/*!********************************!*\
|
|
133
|
+
!*** ./dist/browser/plugin.js ***!
|
|
134
|
+
\********************************/
|
|
135
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
136
|
+
|
|
137
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadLinksPlugin: () => (/* binding */ loadLinksPlugin)\n/* harmony export */ });\n/* harmony import */ var _LinksPlugin_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LinksPlugin.js */ \"./dist/browser/LinksPlugin.js\");\n\nasync function loadLinksPlugin(engine, refresh = true) {\n const plugin = new _LinksPlugin_js__WEBPACK_IMPORTED_MODULE_0__.LinksPlugin();\n await engine.addPlugin(plugin, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-particles-links/./dist/browser/plugin.js?");
|
|
68
138
|
|
|
69
139
|
/***/ }),
|
|
70
140
|
|
|
@@ -104,9 +174,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
104
174
|
/******/ return module.exports;
|
|
105
175
|
/******/ }
|
|
106
176
|
/******/
|
|
107
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
108
|
-
/******/ __webpack_require__.m = __webpack_modules__;
|
|
109
|
-
/******/
|
|
110
177
|
/************************************************************************/
|
|
111
178
|
/******/ /* webpack/runtime/compat get default export */
|
|
112
179
|
/******/ (() => {
|
|
@@ -132,91 +199,11 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
132
199
|
/******/ };
|
|
133
200
|
/******/ })();
|
|
134
201
|
/******/
|
|
135
|
-
/******/ /* webpack/runtime/ensure chunk */
|
|
136
|
-
/******/ (() => {
|
|
137
|
-
/******/ __webpack_require__.f = {};
|
|
138
|
-
/******/ // This file contains only the entry chunk.
|
|
139
|
-
/******/ // The chunk loading function for additional chunks
|
|
140
|
-
/******/ __webpack_require__.e = (chunkId) => {
|
|
141
|
-
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
142
|
-
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
143
|
-
/******/ return promises;
|
|
144
|
-
/******/ }, []));
|
|
145
|
-
/******/ };
|
|
146
|
-
/******/ })();
|
|
147
|
-
/******/
|
|
148
|
-
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
149
|
-
/******/ (() => {
|
|
150
|
-
/******/ // This function allow to reference async chunks
|
|
151
|
-
/******/ __webpack_require__.u = (chunkId) => {
|
|
152
|
-
/******/ // return url for filenames based on template
|
|
153
|
-
/******/ return "" + chunkId + ".js";
|
|
154
|
-
/******/ };
|
|
155
|
-
/******/ })();
|
|
156
|
-
/******/
|
|
157
|
-
/******/ /* webpack/runtime/global */
|
|
158
|
-
/******/ (() => {
|
|
159
|
-
/******/ __webpack_require__.g = (function() {
|
|
160
|
-
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
161
|
-
/******/ try {
|
|
162
|
-
/******/ return this || new Function('return this')();
|
|
163
|
-
/******/ } catch (e) {
|
|
164
|
-
/******/ if (typeof window === 'object') return window;
|
|
165
|
-
/******/ }
|
|
166
|
-
/******/ })();
|
|
167
|
-
/******/ })();
|
|
168
|
-
/******/
|
|
169
202
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
170
203
|
/******/ (() => {
|
|
171
204
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
172
205
|
/******/ })();
|
|
173
206
|
/******/
|
|
174
|
-
/******/ /* webpack/runtime/load script */
|
|
175
|
-
/******/ (() => {
|
|
176
|
-
/******/ var inProgress = {};
|
|
177
|
-
/******/ var dataWebpackPrefix = "@tsparticles/interaction-particles-links:";
|
|
178
|
-
/******/ // loadScript function to load a script via script tag
|
|
179
|
-
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
180
|
-
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
181
|
-
/******/ var script, needAttach;
|
|
182
|
-
/******/ if(key !== undefined) {
|
|
183
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
184
|
-
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
185
|
-
/******/ var s = scripts[i];
|
|
186
|
-
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
187
|
-
/******/ }
|
|
188
|
-
/******/ }
|
|
189
|
-
/******/ if(!script) {
|
|
190
|
-
/******/ needAttach = true;
|
|
191
|
-
/******/ script = document.createElement('script');
|
|
192
|
-
/******/
|
|
193
|
-
/******/ script.charset = 'utf-8';
|
|
194
|
-
/******/ script.timeout = 120;
|
|
195
|
-
/******/ if (__webpack_require__.nc) {
|
|
196
|
-
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
197
|
-
/******/ }
|
|
198
|
-
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
199
|
-
/******/
|
|
200
|
-
/******/ script.src = url;
|
|
201
|
-
/******/ }
|
|
202
|
-
/******/ inProgress[url] = [done];
|
|
203
|
-
/******/ var onScriptComplete = (prev, event) => {
|
|
204
|
-
/******/ // avoid mem leaks in IE.
|
|
205
|
-
/******/ script.onerror = script.onload = null;
|
|
206
|
-
/******/ clearTimeout(timeout);
|
|
207
|
-
/******/ var doneFns = inProgress[url];
|
|
208
|
-
/******/ delete inProgress[url];
|
|
209
|
-
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
210
|
-
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
211
|
-
/******/ if(prev) return prev(event);
|
|
212
|
-
/******/ }
|
|
213
|
-
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
214
|
-
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
215
|
-
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
216
|
-
/******/ needAttach && document.head.appendChild(script);
|
|
217
|
-
/******/ };
|
|
218
|
-
/******/ })();
|
|
219
|
-
/******/
|
|
220
207
|
/******/ /* webpack/runtime/make namespace object */
|
|
221
208
|
/******/ (() => {
|
|
222
209
|
/******/ // define __esModule on exports
|
|
@@ -228,121 +215,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
228
215
|
/******/ };
|
|
229
216
|
/******/ })();
|
|
230
217
|
/******/
|
|
231
|
-
/******/ /* webpack/runtime/publicPath */
|
|
232
|
-
/******/ (() => {
|
|
233
|
-
/******/ var scriptUrl;
|
|
234
|
-
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
235
|
-
/******/ var document = __webpack_require__.g.document;
|
|
236
|
-
/******/ if (!scriptUrl && document) {
|
|
237
|
-
/******/ if (document.currentScript)
|
|
238
|
-
/******/ scriptUrl = document.currentScript.src;
|
|
239
|
-
/******/ if (!scriptUrl) {
|
|
240
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
241
|
-
/******/ if(scripts.length) {
|
|
242
|
-
/******/ var i = scripts.length - 1;
|
|
243
|
-
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
|
|
244
|
-
/******/ }
|
|
245
|
-
/******/ }
|
|
246
|
-
/******/ }
|
|
247
|
-
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
248
|
-
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
249
|
-
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
250
|
-
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
251
|
-
/******/ __webpack_require__.p = scriptUrl;
|
|
252
|
-
/******/ })();
|
|
253
|
-
/******/
|
|
254
|
-
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
255
|
-
/******/ (() => {
|
|
256
|
-
/******/ // no baseURI
|
|
257
|
-
/******/
|
|
258
|
-
/******/ // object to store loaded and loading chunks
|
|
259
|
-
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
260
|
-
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
261
|
-
/******/ var installedChunks = {
|
|
262
|
-
/******/ "tsparticles.interaction.particles.links": 0
|
|
263
|
-
/******/ };
|
|
264
|
-
/******/
|
|
265
|
-
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
266
|
-
/******/ // JSONP chunk loading for javascript
|
|
267
|
-
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
268
|
-
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
269
|
-
/******/
|
|
270
|
-
/******/ // a Promise means "currently loading".
|
|
271
|
-
/******/ if(installedChunkData) {
|
|
272
|
-
/******/ promises.push(installedChunkData[2]);
|
|
273
|
-
/******/ } else {
|
|
274
|
-
/******/ if(true) { // all chunks have JS
|
|
275
|
-
/******/ // setup Promise in chunk cache
|
|
276
|
-
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
277
|
-
/******/ promises.push(installedChunkData[2] = promise);
|
|
278
|
-
/******/
|
|
279
|
-
/******/ // start chunk loading
|
|
280
|
-
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
281
|
-
/******/ // create error before stack unwound to get useful stacktrace later
|
|
282
|
-
/******/ var error = new Error();
|
|
283
|
-
/******/ var loadingEnded = (event) => {
|
|
284
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
285
|
-
/******/ installedChunkData = installedChunks[chunkId];
|
|
286
|
-
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
287
|
-
/******/ if(installedChunkData) {
|
|
288
|
-
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
289
|
-
/******/ var realSrc = event && event.target && event.target.src;
|
|
290
|
-
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
291
|
-
/******/ error.name = 'ChunkLoadError';
|
|
292
|
-
/******/ error.type = errorType;
|
|
293
|
-
/******/ error.request = realSrc;
|
|
294
|
-
/******/ installedChunkData[1](error);
|
|
295
|
-
/******/ }
|
|
296
|
-
/******/ }
|
|
297
|
-
/******/ };
|
|
298
|
-
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
299
|
-
/******/ }
|
|
300
|
-
/******/ }
|
|
301
|
-
/******/ }
|
|
302
|
-
/******/ };
|
|
303
|
-
/******/
|
|
304
|
-
/******/ // no prefetching
|
|
305
|
-
/******/
|
|
306
|
-
/******/ // no preloaded
|
|
307
|
-
/******/
|
|
308
|
-
/******/ // no HMR
|
|
309
|
-
/******/
|
|
310
|
-
/******/ // no HMR manifest
|
|
311
|
-
/******/
|
|
312
|
-
/******/ // no on chunks loaded
|
|
313
|
-
/******/
|
|
314
|
-
/******/ // install a JSONP callback for chunk loading
|
|
315
|
-
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
316
|
-
/******/ var chunkIds = data[0];
|
|
317
|
-
/******/ var moreModules = data[1];
|
|
318
|
-
/******/ var runtime = data[2];
|
|
319
|
-
/******/ // add "moreModules" to the modules object,
|
|
320
|
-
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
321
|
-
/******/ var moduleId, chunkId, i = 0;
|
|
322
|
-
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
323
|
-
/******/ for(moduleId in moreModules) {
|
|
324
|
-
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
325
|
-
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
326
|
-
/******/ }
|
|
327
|
-
/******/ }
|
|
328
|
-
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
329
|
-
/******/ }
|
|
330
|
-
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
331
|
-
/******/ for(;i < chunkIds.length; i++) {
|
|
332
|
-
/******/ chunkId = chunkIds[i];
|
|
333
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
334
|
-
/******/ installedChunks[chunkId][0]();
|
|
335
|
-
/******/ }
|
|
336
|
-
/******/ installedChunks[chunkId] = 0;
|
|
337
|
-
/******/ }
|
|
338
|
-
/******/
|
|
339
|
-
/******/ }
|
|
340
|
-
/******/
|
|
341
|
-
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_interaction_particles_links"] = this["webpackChunk_tsparticles_interaction_particles_links"] || [];
|
|
342
|
-
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
343
|
-
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
344
|
-
/******/ })();
|
|
345
|
-
/******/
|
|
346
218
|
/************************************************************************/
|
|
347
219
|
/******/
|
|
348
220
|
/******/ // startup
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.particles.links.min.js.LICENSE.txt */
|
|
2
|
-
!function(
|
|
2
|
+
!function(i,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 n="object"==typeof exports?t(require("@tsparticles/engine")):t(i.window);for(var e in n)("object"==typeof exports?exports:i)[e]=n[e]}}(this,(i=>(()=>{var t={303:t=>{t.exports=i}},n={};function e(i){var s=n[i];if(void 0!==s)return s.exports;var o=n[i]={exports:{}};return t[i](o,o.exports,e),o.exports}e.d=(i,t)=>{for(var n in t)e.o(t,n)&&!e.o(i,n)&&Object.defineProperty(i,n,{enumerable:!0,get:t[n]})},e.o=(i,t)=>Object.prototype.hasOwnProperty.call(i,t),e.r=i=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var s={};return(()=>{e.r(s),e.d(s,{Links:()=>r,LinksShadow:()=>n,LinksTriangle:()=>o,loadParticlesLinksInteraction:()=>y});var i=e(303);class t extends i.Circle{constructor(i,t,n,e){super(i,t,n),this.canvasSize=e,this.canvasSize={...e}}contains(i){const{width:t,height:n}=this.canvasSize,{x:e,y:s}=i;return super.contains(i)||super.contains({x:e-t,y:s})||super.contains({x:e-t,y:s-n})||super.contains({x:e,y:s-n})}intersects(t){if(super.intersects(t))return!0;const n=t,e=t,s={x:t.position.x-this.canvasSize.width,y:t.position.y-this.canvasSize.height};if(void 0!==e.radius){const t=new i.Circle(s.x,s.y,2*e.radius);return super.intersects(t)}if(void 0!==n.size){const t=new i.Rectangle(s.x,s.y,2*n.size.width,2*n.size.height);return super.intersects(t)}return!1}}class n{constructor(){this.blur=5,this.color=new i.OptionsColor,this.color.value="#000",this.enable=!1}load(t){t&&(void 0!==t.blur&&(this.blur=t.blur),this.color=i.OptionsColor.create(this.color,t.color),void 0!==t.enable&&(this.enable=t.enable))}}class o{constructor(){this.enable=!1,this.frequency=1}load(t){t&&(void 0!==t.color&&(this.color=i.OptionsColor.create(this.color,t.color)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.frequency&&(this.frequency=t.frequency),void 0!==t.opacity&&(this.opacity=t.opacity))}}class r{constructor(){this.blink=!1,this.color=new i.OptionsColor,this.color.value="#fff",this.consent=!1,this.distance=100,this.enable=!1,this.frequency=1,this.opacity=1,this.shadow=new n,this.triangles=new o,this.width=1,this.warp=!1}load(t){t&&(void 0!==t.id&&(this.id=t.id),void 0!==t.blink&&(this.blink=t.blink),this.color=i.OptionsColor.create(this.color,t.color),void 0!==t.consent&&(this.consent=t.consent),void 0!==t.distance&&(this.distance=t.distance),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.frequency&&(this.frequency=t.frequency),void 0!==t.opacity&&(this.opacity=t.opacity),this.shadow.load(t.shadow),this.triangles.load(t.triangles),void 0!==t.width&&(this.width=t.width),void 0!==t.warp&&(this.warp=t.warp))}}const a=0,l=0;function c(t,n,e,s,o){const{dx:r,dy:a,distance:l}=(0,i.getDistances)(t,n);if(!o||l<=e)return l;const c={x:Math.abs(r),y:Math.abs(a)},d=Math.min(c.x,s.width-c.x),h=Math.min(c.y,s.height-c.y);return Math.sqrt(d**2+h**2)}class d extends i.ParticlesInteractorBase{constructor(t){super(t),this._setColor=t=>{if(!t.options.links)return;const n=this.linkContainer,e=t.options.links;let s=void 0===e.id?n.particles.linksColor:n.particles.linksColors.get(e.id);if(s)return;const o=e.color;s=(0,i.getLinkRandomColor)(o,e.blink,e.consent),void 0===e.id?n.particles.linksColor=s:n.particles.linksColors.set(e.id,s)},this.linkContainer=t}clear(){}init(){this.linkContainer.particles.linksColor=void 0,this.linkContainer.particles.linksColors=new Map}interact(n){if(!n.options.links)return;n.links=[];const e=n.getPosition(),s=this.container,o=s.canvas.size;if(e.x<a||e.y<l||e.x>o.width||e.y>o.height)return;const r=n.options.links,d=r.opacity,h=n.retina.linksDistance??0,p=r.warp;let u;u=p?new t(e.x,e.y,h,o):new i.Circle(e.x,e.y,h);const y=s.particles.quadTree.query(u);for(const i of y){const t=i.options.links;if(n===i||!t?.enable||r.id!==t.id||i.spawning||i.destroyed||!i.links||n.links.some((t=>t.destination===i))||i.links.some((i=>i.destination===n)))continue;const s=i.getPosition();if(s.x<a||s.y<l||s.x>o.width||s.y>o.height)continue;const u=c(e,s,h,o,p&&t.warp);if(u>h)continue;const y=(1-u/h)*d;this._setColor(n),n.links.push({destination:i,opacity:y})}}isEnabled(i){return!!i.options.links?.enable}loadParticlesOptions(i,...t){i.links||(i.links=new r);for(const n of t)i.links.load(n?.links)}reset(){}}function h(t,n){const e=((s=t.map((i=>i.id))).sort(((i,t)=>i-t)),s.join("_"));var s;let o=n.get(e);return void 0===o&&(o=(0,i.getRandom)(),n.set(e,o)),o}class p{constructor(t){this.container=t,this._drawLinkLine=(t,n)=>{const e=t.options.links;if(!e?.enable)return;const s=this.container,o=s.actualOptions,r=n.destination,a=t.getPosition(),l=r.getPosition();let c=n.opacity;s.canvas.draw((n=>{let d;const h=t.options.twinkle?.lines;if(h?.enable){const t=h.frequency,n=(0,i.rangeColorToRgb)(h.color);(0,i.getRandom)()<t&&n&&(d=n,c=(0,i.getRangeValue)(h.opacity))}if(!d){const n=void 0!==e.id?s.particles.linksColors.get(e.id):s.particles.linksColor;d=(0,i.getLinkColor)(t,r,n)}if(!d)return;const p=t.retina.linksWidth??0,u=t.retina.linksDistance??0,{backgroundMask:y}=o;!function(t){let n=!1;const{begin:e,end:s,maxDistance:o,context:r,canvasSize:a,width:l,backgroundMask:c,colorLine:d,opacity:h,links:p}=t;if((0,i.getDistance)(e,s)<=o)(0,i.drawLine)(r,e,s),n=!0;else if(p.warp){let t,l;const c={x:s.x-a.width,y:s.y},d=(0,i.getDistances)(e,c);if(d.distance<=o){const i=e.y-d.dy/d.dx*e.x;t={x:0,y:i},l={x:a.width,y:i}}else{const n={x:s.x,y:s.y-a.height},r=(0,i.getDistances)(e,n);if(r.distance<=o){const i=-(e.y-r.dy/r.dx*e.x)/(r.dy/r.dx);t={x:i,y:0},l={x:i,y:a.height}}else{const n={x:s.x-a.width,y:s.y-a.height},r=(0,i.getDistances)(e,n);if(r.distance<=o){const i=e.y-r.dy/r.dx*e.x;t={x:-i/(r.dy/r.dx),y:i},l={x:t.x+a.width,y:t.y+a.height}}}}t&&l&&((0,i.drawLine)(r,e,t),(0,i.drawLine)(r,s,l),n=!0)}if(!n)return;r.lineWidth=l,c.enable&&(r.globalCompositeOperation=c.composite),r.strokeStyle=(0,i.getStyleFromRgb)(d,h);const{shadow:u}=p;if(u.enable){const t=(0,i.rangeColorToRgb)(u.color);t&&(r.shadowBlur=u.blur,r.shadowColor=(0,i.getStyleFromRgb)(t))}r.stroke()}({context:n,width:p,begin:a,end:l,maxDistance:u,canvasSize:s.canvas.size,links:e,backgroundMask:y,colorLine:d,opacity:c})}))},this._drawLinkTriangle=(t,n,e)=>{const s=t.options.links;if(!s?.enable)return;const o=s.triangles;if(!o.enable)return;const r=this.container,a=r.actualOptions,l=n.destination,c=e.destination,d=o.opacity??.5*(n.opacity+e.opacity);d<=0||r.canvas.draw((n=>{const e=t.getPosition(),h=l.getPosition(),p=c.getPosition(),u=t.retina.linksDistance??0;if((0,i.getDistance)(e,h)>u||(0,i.getDistance)(p,h)>u||(0,i.getDistance)(p,e)>u)return;let y=(0,i.rangeColorToRgb)(o.color);if(!y){const n=void 0!==s.id?r.particles.linksColors.get(s.id):r.particles.linksColor;y=(0,i.getLinkColor)(t,l,n)}y&&function(t){const{context:n,pos1:e,pos2:s,pos3:o,backgroundMask:r,colorTriangle:a,opacityTriangle:l}=t;!function(i,t,n,e){i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(n.x,n.y),i.lineTo(e.x,e.y),i.closePath()}(n,e,s,o),r.enable&&(n.globalCompositeOperation=r.composite),n.fillStyle=(0,i.getStyleFromRgb)(a,l),n.fill()}({context:n,pos1:e,pos2:h,pos3:p,backgroundMask:a.backgroundMask,colorTriangle:y,opacityTriangle:d})}))},this._drawTriangles=(i,t,n,e)=>{const s=n.destination;if(!i.links?.triangles.enable||!s.options.links?.triangles.enable)return;const o=s.links?.filter((i=>{const t=this._getLinkFrequency(s,i.destination);return s.options.links&&t<=s.options.links.frequency&&e.findIndex((t=>t.destination===i.destination))>=0}));if(o?.length)for(const e of o){const o=e.destination;this._getTriangleFrequency(t,s,o)>i.links.triangles.frequency||this._drawLinkTriangle(t,n,e)}},this._getLinkFrequency=(i,t)=>h([i,t],this._freqs.links),this._getTriangleFrequency=(i,t,n)=>h([i,t,n],this._freqs.triangles),this._freqs={links:new Map,triangles:new Map}}drawParticle(i,t){const{links:n,options:e}=t;if(!n?.length)return;const s=n.filter((i=>e.links&&(e.links.frequency>=1||this._getLinkFrequency(t,i.destination)<=e.links.frequency)));for(const i of s)this._drawTriangles(e,t,i,s),i.opacity>0&&(t.retina.linksWidth??0)>0&&this._drawLinkLine(t,i)}async init(){this._freqs.links=new Map,this._freqs.triangles=new Map,await Promise.resolve()}particleCreated(i){if(i.links=[],!i.options.links)return;const t=this.container.retina.pixelRatio,{retina:n}=i,{distance:e,width:s}=i.options.links;n.linksDistance=e*t,n.linksWidth=s*t}particleDestroyed(i){i.links=[]}}class u{constructor(){this.id="links"}getPlugin(i){return Promise.resolve(new p(i))}loadOptions(){}needsPlugin(){return!0}}async function y(i,t=!0){await async function(i,t=!0){await i.addInteractor("particlesLinks",(async i=>Promise.resolve(new d(i))),t)}(i,t),await async function(i,t=!0){const n=new u;await i.addPlugin(n,t)}(i,t)}})(),s})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Links Particles Interaction v3.
|
|
1
|
+
/*! tsParticles Links Particles Interaction v3.4.0 by Matteo Bruni */
|
package/types/LinkInstance.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare class LinkInstance implements IContainerPlugin {
|
|
|
4
4
|
private readonly container;
|
|
5
5
|
private readonly _freqs;
|
|
6
6
|
constructor(container: LinkContainer);
|
|
7
|
-
drawParticle(context: CanvasRenderingContext2D, particle: LinkParticle):
|
|
7
|
+
drawParticle(context: CanvasRenderingContext2D, particle: LinkParticle): void;
|
|
8
8
|
init(): Promise<void>;
|
|
9
9
|
particleCreated(particle: LinkParticle): void;
|
|
10
10
|
particleDestroyed(particle: LinkParticle): void;
|
package/types/Linker.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare class Linker extends ParticlesInteractorBase {
|
|
|
5
5
|
constructor(container: LinkContainer);
|
|
6
6
|
clear(): void;
|
|
7
7
|
init(): void;
|
|
8
|
-
interact(p1: LinkParticle):
|
|
8
|
+
interact(p1: LinkParticle): void;
|
|
9
9
|
isEnabled(particle: LinkParticle): boolean;
|
|
10
10
|
loadParticlesOptions(options: ParticlesLinkOptions, ...sources: (RecursivePartial<IParticlesLinkOptions> | undefined)[]): void;
|
|
11
11
|
reset(): void;
|
package/types/LinksPlugin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IPlugin } from "@tsparticles/engine";
|
|
2
2
|
import type { LinkContainer } from "./Types.js";
|
|
3
|
-
import
|
|
3
|
+
import { LinkInstance } from "./LinkInstance.js";
|
|
4
4
|
export declare class LinksPlugin implements IPlugin {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
constructor();
|
package/umd/LinkInstance.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
const container = this.container, options = container.actualOptions, p2 = link.destination, pos1 = p1.getPosition(), pos2 = p2.getPosition();
|
|
25
25
|
let opacity = link.opacity;
|
|
26
|
-
container.canvas.draw(
|
|
26
|
+
container.canvas.draw(ctx => {
|
|
27
27
|
let colorLine;
|
|
28
28
|
const twinkle = p1.options.twinkle?.lines;
|
|
29
29
|
if (twinkle?.enable) {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
if (opacityTriangle <= minOpacity) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
container.canvas.draw(
|
|
73
|
+
container.canvas.draw(ctx => {
|
|
74
74
|
const pos1 = p1.getPosition(), pos2 = p2.getPosition(), pos3 = p3.getPosition(), linksDistance = p1.retina.linksDistance ?? minDistance;
|
|
75
75
|
if ((0, engine_1.getDistance)(pos1, pos2) > linksDistance ||
|
|
76
76
|
(0, engine_1.getDistance)(pos3, pos2) > linksDistance ||
|
|
@@ -103,11 +103,11 @@
|
|
|
103
103
|
if (!(options.links?.triangles.enable && p2.options.links?.triangles.enable)) {
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
const vertices = p2.links?.filter(
|
|
106
|
+
const vertices = p2.links?.filter(t => {
|
|
107
107
|
const linkFreq = this._getLinkFrequency(p2, t.destination), minCount = 0;
|
|
108
108
|
return (p2.options.links &&
|
|
109
109
|
linkFreq <= p2.options.links.frequency &&
|
|
110
|
-
p1Links.findIndex(
|
|
110
|
+
p1Links.findIndex(l => l.destination === t.destination) >= minCount);
|
|
111
111
|
});
|
|
112
112
|
if (!vertices?.length) {
|
|
113
113
|
return;
|
|
@@ -131,12 +131,12 @@
|
|
|
131
131
|
triangles: new Map(),
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
drawParticle(context, particle) {
|
|
135
135
|
const { links, options } = particle;
|
|
136
136
|
if (!links?.length) {
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
const p1Links = links.filter(
|
|
139
|
+
const p1Links = links.filter(l => options.links &&
|
|
140
140
|
(options.links.frequency >= maxFrequency ||
|
|
141
141
|
this._getLinkFrequency(particle, l.destination) <= options.links.frequency));
|
|
142
142
|
for (const link of p1Links) {
|
|
@@ -145,7 +145,6 @@
|
|
|
145
145
|
this._drawLinkLine(particle, link);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
await Promise.resolve();
|
|
149
148
|
}
|
|
150
149
|
async init() {
|
|
151
150
|
this._freqs.links = new Map();
|
package/umd/Linker.js
CHANGED
|
@@ -1,40 +1,17 @@
|
|
|
1
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
-
if (k2 === undefined) k2 = k;
|
|
3
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
-
}
|
|
7
|
-
Object.defineProperty(o, k2, desc);
|
|
8
|
-
}) : (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
o[k2] = m[k];
|
|
11
|
-
}));
|
|
12
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
-
}) : function(o, v) {
|
|
15
|
-
o["default"] = v;
|
|
16
|
-
});
|
|
17
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
|
-
if (mod && mod.__esModule) return mod;
|
|
19
|
-
var result = {};
|
|
20
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
-
__setModuleDefault(result, mod);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
1
|
(function (factory) {
|
|
25
2
|
if (typeof module === "object" && typeof module.exports === "object") {
|
|
26
3
|
var v = factory(require, exports);
|
|
27
4
|
if (v !== undefined) module.exports = v;
|
|
28
5
|
}
|
|
29
6
|
else if (typeof define === "function" && define.amd) {
|
|
30
|
-
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Links.js"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "./CircleWarp.js", "./Options/Classes/Links.js"], factory);
|
|
31
8
|
}
|
|
32
9
|
})(function (require, exports) {
|
|
33
10
|
"use strict";
|
|
34
|
-
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
35
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
12
|
exports.Linker = void 0;
|
|
37
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const CircleWarp_js_1 = require("./CircleWarp.js");
|
|
38
15
|
const Links_js_1 = require("./Options/Classes/Links.js");
|
|
39
16
|
const squarePower = 2, opacityOffset = 1, origin = {
|
|
40
17
|
x: 0,
|
|
@@ -57,7 +34,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
57
34
|
class Linker extends engine_1.ParticlesInteractorBase {
|
|
58
35
|
constructor(container) {
|
|
59
36
|
super(container);
|
|
60
|
-
this._setColor =
|
|
37
|
+
this._setColor = p1 => {
|
|
61
38
|
if (!p1.options.links) {
|
|
62
39
|
return;
|
|
63
40
|
}
|
|
@@ -85,7 +62,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
85
62
|
this.linkContainer.particles.linksColor = undefined;
|
|
86
63
|
this.linkContainer.particles.linksColors = new Map();
|
|
87
64
|
}
|
|
88
|
-
|
|
65
|
+
interact(p1) {
|
|
89
66
|
if (!p1.options.links) {
|
|
90
67
|
return;
|
|
91
68
|
}
|
|
@@ -97,8 +74,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
97
74
|
const linkOpt1 = p1.options.links, optOpacity = linkOpt1.opacity, optDistance = p1.retina.linksDistance ?? minDistance, warp = linkOpt1.warp;
|
|
98
75
|
let range;
|
|
99
76
|
if (warp) {
|
|
100
|
-
|
|
101
|
-
range = new CircleWarp(pos1.x, pos1.y, optDistance, canvasSize);
|
|
77
|
+
range = new CircleWarp_js_1.CircleWarp(pos1.x, pos1.y, optDistance, canvasSize);
|
|
102
78
|
}
|
|
103
79
|
else {
|
|
104
80
|
range = new engine_1.Circle(pos1.x, pos1.y, optDistance);
|
|
@@ -112,8 +88,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
112
88
|
p2.spawning ||
|
|
113
89
|
p2.destroyed ||
|
|
114
90
|
!p2.links ||
|
|
115
|
-
p1.links.some(
|
|
116
|
-
p2.links.some(
|
|
91
|
+
p1.links.some(t => t.destination === p2) ||
|
|
92
|
+
p2.links.some(t => t.destination === p1)) {
|
|
117
93
|
continue;
|
|
118
94
|
}
|
|
119
95
|
const pos2 = p2.getPosition();
|