New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tsparticles/interaction-particles-links

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/interaction-particles-links - npm Package Compare versions

Comparing version 3.8.0 to 3.8.1

2

browser/index.js
import { loadLinksInteraction } from "./interaction.js";
import { loadLinksPlugin } from "./plugin.js";
export async function loadParticlesLinksInteraction(engine, refresh = true) {
engine.checkVersion("3.8.0");
engine.checkVersion("3.8.1");
await loadLinksInteraction(engine, refresh);

@@ -6,0 +6,0 @@ await loadLinksPlugin(engine, refresh);

@@ -21,3 +21,3 @@ "use strict";

async function loadParticlesLinksInteraction(engine, refresh = true) {
engine.checkVersion("3.8.0");
engine.checkVersion("3.8.1");
await (0, interaction_js_1.loadLinksInteraction)(engine, refresh);

@@ -24,0 +24,0 @@ await (0, plugin_js_1.loadLinksPlugin)(engine, refresh);

import { loadLinksInteraction } from "./interaction.js";
import { loadLinksPlugin } from "./plugin.js";
export async function loadParticlesLinksInteraction(engine, refresh = true) {
engine.checkVersion("3.8.0");
engine.checkVersion("3.8.1");
await loadLinksInteraction(engine, refresh);

@@ -6,0 +6,0 @@ await loadLinksPlugin(engine, refresh);

{
"name": "@tsparticles/interaction-particles-links",
"version": "3.8.0",
"version": "3.8.1",
"description": "tsParticles links particles interaction",

@@ -90,3 +90,3 @@ "homepage": "https://particles.js.org",

"dependencies": {
"@tsparticles/engine": "3.8.0"
"@tsparticles/engine": "3.8.1"
},

@@ -93,0 +93,0 @@ "publishConfig": {

@@ -7,3 +7,3 @@ /*!

* How to use? : Check the GitHub README
* v3.8.0
* v3.8.1
*/

@@ -118,3 +118,3 @@ /*

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 engine.checkVersion(\"3.8.0\");\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?");
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 engine.checkVersion(\"3.8.1\");\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?");

@@ -121,0 +121,0 @@ /***/ }),

/*! For license information please see tsparticles.interaction.particles.links.min.js.LICENSE.txt */
!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={};e.r(s),e.d(s,{Links:()=>c,LinksShadow:()=>a,LinksTriangle:()=>l,loadParticlesLinksInteraction:()=>f});var o=e(303);class r extends o.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(i){if(super.intersects(i))return!0;const t=i,n=i,e={x:i.position.x-this.canvasSize.width,y:i.position.y-this.canvasSize.height};if(void 0!==n.radius){const i=new o.Circle(e.x,e.y,2*n.radius);return super.intersects(i)}if(void 0!==t.size){const i=new o.Rectangle(e.x,e.y,2*t.size.width,2*t.size.height);return super.intersects(i)}return!1}}class a{constructor(){this.blur=5,this.color=new o.OptionsColor,this.color.value="#000",this.enable=!1}load(i){(0,o.isNull)(i)||(void 0!==i.blur&&(this.blur=i.blur),this.color=o.OptionsColor.create(this.color,i.color),void 0!==i.enable&&(this.enable=i.enable))}}class l{constructor(){this.enable=!1,this.frequency=1}load(i){(0,o.isNull)(i)||(void 0!==i.color&&(this.color=o.OptionsColor.create(this.color,i.color)),void 0!==i.enable&&(this.enable=i.enable),void 0!==i.frequency&&(this.frequency=i.frequency),void 0!==i.opacity&&(this.opacity=i.opacity))}}class c{constructor(){this.blink=!1,this.color=new o.OptionsColor,this.color.value="#fff",this.consent=!1,this.distance=100,this.enable=!1,this.frequency=1,this.opacity=1,this.shadow=new a,this.triangles=new l,this.width=1,this.warp=!1}load(i){(0,o.isNull)(i)||(void 0!==i.id&&(this.id=i.id),void 0!==i.blink&&(this.blink=i.blink),this.color=o.OptionsColor.create(this.color,i.color),void 0!==i.consent&&(this.consent=i.consent),void 0!==i.distance&&(this.distance=i.distance),void 0!==i.enable&&(this.enable=i.enable),void 0!==i.frequency&&(this.frequency=i.frequency),void 0!==i.opacity&&(this.opacity=i.opacity),this.shadow.load(i.shadow),this.triangles.load(i.triangles),void 0!==i.width&&(this.width=i.width),void 0!==i.warp&&(this.warp=i.warp))}}const d=0,h=0;function p(i,t,n,e,s){const{dx:r,dy:a,distance:l}=(0,o.getDistances)(i,t);if(!s||l<=n)return l;const c={x:Math.abs(r),y:Math.abs(a)},d=Math.min(c.x,e.width-c.x),h=Math.min(c.y,e.height-c.y);return Math.sqrt(d**2+h**2)}class u extends o.ParticlesInteractorBase{constructor(i,t){super(i),this._setColor=i=>{if(!i.options.links)return;const t=this._linkContainer,n=i.options.links;let e=void 0===n.id?t.particles.linksColor:t.particles.linksColors.get(n.id);if(e)return;const s=n.color;e=(0,o.getLinkRandomColor)(this._engine,s,n.blink,n.consent),void 0===n.id?t.particles.linksColor=e:t.particles.linksColors.set(n.id,e)},this._linkContainer=i,this._engine=t}clear(){}init(){this._linkContainer.particles.linksColor=void 0,this._linkContainer.particles.linksColors=new Map}interact(i){if(!i.options.links)return;i.links=[];const t=i.getPosition(),n=this.container,e=n.canvas.size;if(t.x<d||t.y<h||t.x>e.width||t.y>e.height)return;const s=i.options.links,a=s.opacity,l=i.retina.linksDistance??0,c=s.warp;let u;u=c?new r(t.x,t.y,l,e):new o.Circle(t.x,t.y,l);const g=n.particles.quadTree.query(u);for(const n of g){const o=n.options.links;if(i===n||!o?.enable||s.id!==o.id||n.spawning||n.destroyed||!n.links||i.links.some((i=>i.destination===n))||n.links.some((t=>t.destination===i)))continue;const r=n.getPosition();if(r.x<d||r.y<h||r.x>e.width||r.y>e.height)continue;const u=p(t,r,l,e,c&&o.warp);if(u>l)continue;const g=(1-u/l)*a;this._setColor(i),i.links.push({destination:n,opacity:g})}}isEnabled(i){return!!i.options.links?.enable}loadParticlesOptions(i,...t){i.links||(i.links=new c);for(const n of t)i.links.load(n?.links)}reset(){}}function g(i,t){const n=((e=i.map((i=>i.id))).sort(((i,t)=>i-t)),e.join("_"));var e;let s=t.get(n);return void 0===s&&(s=(0,o.getRandom)(),t.set(n,s)),s}class y{constructor(i,t){this._drawLinkLine=(i,t)=>{const n=i.options.links;if(!n?.enable)return;const e=this._container,s=e.actualOptions,r=t.destination,a=i.getPosition(),l=r.getPosition();let c=t.opacity;e.canvas.draw((t=>{let d;const h=i.options.twinkle?.lines;if(h?.enable){const i=h.frequency,t=(0,o.rangeColorToRgb)(this._engine,h.color);(0,o.getRandom)()<i&&t&&(d=t,c=(0,o.getRangeValue)(h.opacity))}if(!d){const t=void 0!==n.id?e.particles.linksColors.get(n.id):e.particles.linksColor;d=(0,o.getLinkColor)(i,r,t)}if(!d)return;const p=i.retina.linksWidth??0,u=i.retina.linksDistance??0,{backgroundMask:g}=s;!function(i){let t=!1;const{begin:n,end:e,engine:s,maxDistance:r,context:a,canvasSize:l,width:c,backgroundMask:d,colorLine:h,opacity:p,links:u}=i;if((0,o.getDistance)(n,e)<=r)(0,o.drawLine)(a,n,e),t=!0;else if(u.warp){let i,s;const c={x:e.x-l.width,y:e.y},d=(0,o.getDistances)(n,c);if(d.distance<=r){const t=n.y-d.dy/d.dx*n.x;i={x:0,y:t},s={x:l.width,y:t}}else{const t={x:e.x,y:e.y-l.height},a=(0,o.getDistances)(n,t);if(a.distance<=r){const t=-(n.y-a.dy/a.dx*n.x)/(a.dy/a.dx);i={x:t,y:0},s={x:t,y:l.height}}else{const t={x:e.x-l.width,y:e.y-l.height},a=(0,o.getDistances)(n,t);if(a.distance<=r){const t=n.y-a.dy/a.dx*n.x;i={x:-t/(a.dy/a.dx),y:t},s={x:i.x+l.width,y:i.y+l.height}}}}i&&s&&((0,o.drawLine)(a,n,i),(0,o.drawLine)(a,e,s),t=!0)}if(!t)return;a.lineWidth=c,d.enable&&(a.globalCompositeOperation=d.composite),a.strokeStyle=(0,o.getStyleFromRgb)(h,p);const{shadow:g}=u;if(g.enable){const i=(0,o.rangeColorToRgb)(s,g.color);i&&(a.shadowBlur=g.blur,a.shadowColor=(0,o.getStyleFromRgb)(i))}a.stroke()}({context:t,width:p,begin:a,end:l,engine:this._engine,maxDistance:u,canvasSize:e.canvas.size,links:n,backgroundMask:g,colorLine:d,opacity:c})}))},this._drawLinkTriangle=(i,t,n)=>{const e=i.options.links;if(!e?.enable)return;const s=e.triangles;if(!s.enable)return;const r=this._container,a=r.actualOptions,l=t.destination,c=n.destination,d=s.opacity??.5*(t.opacity+n.opacity);d<=0||r.canvas.draw((t=>{const n=i.getPosition(),h=l.getPosition(),p=c.getPosition(),u=i.retina.linksDistance??0;if((0,o.getDistance)(n,h)>u||(0,o.getDistance)(p,h)>u||(0,o.getDistance)(p,n)>u)return;let g=(0,o.rangeColorToRgb)(this._engine,s.color);if(!g){const t=void 0!==e.id?r.particles.linksColors.get(e.id):r.particles.linksColor;g=(0,o.getLinkColor)(i,l,t)}g&&function(i){const{context:t,pos1:n,pos2:e,pos3:s,backgroundMask:r,colorTriangle:a,opacityTriangle:l}=i;!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()}(t,n,e,s),r.enable&&(t.globalCompositeOperation=r.composite),t.fillStyle=(0,o.getStyleFromRgb)(a,l),t.fill()}({context:t,pos1:n,pos2:h,pos3:p,backgroundMask:a.backgroundMask,colorTriangle:g,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)=>g([i,t],this._freqs.links),this._getTriangleFrequency=(i,t,n)=>g([i,t,n],this._freqs.triangles),this._container=i,this._engine=t,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 k{constructor(i){this.id="links",this._engine=i}getPlugin(i){return Promise.resolve(new y(i,this._engine))}loadOptions(){}needsPlugin(){return!0}}async function f(i,t=!0){i.checkVersion("3.8.0"),await async function(i,t=!0){await i.addInteractor("particlesLinks",(async t=>Promise.resolve(new u(t,i))),t)}(i,t),await async function(i,t=!0){const n=new k(i);await i.addPlugin(n,t)}(i,t)}return s})()));
!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={};e.r(s),e.d(s,{Links:()=>c,LinksShadow:()=>a,LinksTriangle:()=>l,loadParticlesLinksInteraction:()=>f});var o=e(303);class r extends o.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(i){if(super.intersects(i))return!0;const t=i,n=i,e={x:i.position.x-this.canvasSize.width,y:i.position.y-this.canvasSize.height};if(void 0!==n.radius){const i=new o.Circle(e.x,e.y,2*n.radius);return super.intersects(i)}if(void 0!==t.size){const i=new o.Rectangle(e.x,e.y,2*t.size.width,2*t.size.height);return super.intersects(i)}return!1}}class a{constructor(){this.blur=5,this.color=new o.OptionsColor,this.color.value="#000",this.enable=!1}load(i){(0,o.isNull)(i)||(void 0!==i.blur&&(this.blur=i.blur),this.color=o.OptionsColor.create(this.color,i.color),void 0!==i.enable&&(this.enable=i.enable))}}class l{constructor(){this.enable=!1,this.frequency=1}load(i){(0,o.isNull)(i)||(void 0!==i.color&&(this.color=o.OptionsColor.create(this.color,i.color)),void 0!==i.enable&&(this.enable=i.enable),void 0!==i.frequency&&(this.frequency=i.frequency),void 0!==i.opacity&&(this.opacity=i.opacity))}}class c{constructor(){this.blink=!1,this.color=new o.OptionsColor,this.color.value="#fff",this.consent=!1,this.distance=100,this.enable=!1,this.frequency=1,this.opacity=1,this.shadow=new a,this.triangles=new l,this.width=1,this.warp=!1}load(i){(0,o.isNull)(i)||(void 0!==i.id&&(this.id=i.id),void 0!==i.blink&&(this.blink=i.blink),this.color=o.OptionsColor.create(this.color,i.color),void 0!==i.consent&&(this.consent=i.consent),void 0!==i.distance&&(this.distance=i.distance),void 0!==i.enable&&(this.enable=i.enable),void 0!==i.frequency&&(this.frequency=i.frequency),void 0!==i.opacity&&(this.opacity=i.opacity),this.shadow.load(i.shadow),this.triangles.load(i.triangles),void 0!==i.width&&(this.width=i.width),void 0!==i.warp&&(this.warp=i.warp))}}const d=0,h=0;function p(i,t,n,e,s){const{dx:r,dy:a,distance:l}=(0,o.getDistances)(i,t);if(!s||l<=n)return l;const c={x:Math.abs(r),y:Math.abs(a)},d=Math.min(c.x,e.width-c.x),h=Math.min(c.y,e.height-c.y);return Math.sqrt(d**2+h**2)}class u extends o.ParticlesInteractorBase{constructor(i,t){super(i),this._setColor=i=>{if(!i.options.links)return;const t=this._linkContainer,n=i.options.links;let e=void 0===n.id?t.particles.linksColor:t.particles.linksColors.get(n.id);if(e)return;const s=n.color;e=(0,o.getLinkRandomColor)(this._engine,s,n.blink,n.consent),void 0===n.id?t.particles.linksColor=e:t.particles.linksColors.set(n.id,e)},this._linkContainer=i,this._engine=t}clear(){}init(){this._linkContainer.particles.linksColor=void 0,this._linkContainer.particles.linksColors=new Map}interact(i){if(!i.options.links)return;i.links=[];const t=i.getPosition(),n=this.container,e=n.canvas.size;if(t.x<d||t.y<h||t.x>e.width||t.y>e.height)return;const s=i.options.links,a=s.opacity,l=i.retina.linksDistance??0,c=s.warp;let u;u=c?new r(t.x,t.y,l,e):new o.Circle(t.x,t.y,l);const g=n.particles.quadTree.query(u);for(const n of g){const o=n.options.links;if(i===n||!o?.enable||s.id!==o.id||n.spawning||n.destroyed||!n.links||i.links.some((i=>i.destination===n))||n.links.some((t=>t.destination===i)))continue;const r=n.getPosition();if(r.x<d||r.y<h||r.x>e.width||r.y>e.height)continue;const u=p(t,r,l,e,c&&o.warp);if(u>l)continue;const g=(1-u/l)*a;this._setColor(i),i.links.push({destination:n,opacity:g})}}isEnabled(i){return!!i.options.links?.enable}loadParticlesOptions(i,...t){i.links||(i.links=new c);for(const n of t)i.links.load(n?.links)}reset(){}}function g(i,t){const n=((e=i.map((i=>i.id))).sort(((i,t)=>i-t)),e.join("_"));var e;let s=t.get(n);return void 0===s&&(s=(0,o.getRandom)(),t.set(n,s)),s}class y{constructor(i,t){this._drawLinkLine=(i,t)=>{const n=i.options.links;if(!n?.enable)return;const e=this._container,s=e.actualOptions,r=t.destination,a=i.getPosition(),l=r.getPosition();let c=t.opacity;e.canvas.draw((t=>{let d;const h=i.options.twinkle?.lines;if(h?.enable){const i=h.frequency,t=(0,o.rangeColorToRgb)(this._engine,h.color);(0,o.getRandom)()<i&&t&&(d=t,c=(0,o.getRangeValue)(h.opacity))}if(!d){const t=void 0!==n.id?e.particles.linksColors.get(n.id):e.particles.linksColor;d=(0,o.getLinkColor)(i,r,t)}if(!d)return;const p=i.retina.linksWidth??0,u=i.retina.linksDistance??0,{backgroundMask:g}=s;!function(i){let t=!1;const{begin:n,end:e,engine:s,maxDistance:r,context:a,canvasSize:l,width:c,backgroundMask:d,colorLine:h,opacity:p,links:u}=i;if((0,o.getDistance)(n,e)<=r)(0,o.drawLine)(a,n,e),t=!0;else if(u.warp){let i,s;const c={x:e.x-l.width,y:e.y},d=(0,o.getDistances)(n,c);if(d.distance<=r){const t=n.y-d.dy/d.dx*n.x;i={x:0,y:t},s={x:l.width,y:t}}else{const t={x:e.x,y:e.y-l.height},a=(0,o.getDistances)(n,t);if(a.distance<=r){const t=-(n.y-a.dy/a.dx*n.x)/(a.dy/a.dx);i={x:t,y:0},s={x:t,y:l.height}}else{const t={x:e.x-l.width,y:e.y-l.height},a=(0,o.getDistances)(n,t);if(a.distance<=r){const t=n.y-a.dy/a.dx*n.x;i={x:-t/(a.dy/a.dx),y:t},s={x:i.x+l.width,y:i.y+l.height}}}}i&&s&&((0,o.drawLine)(a,n,i),(0,o.drawLine)(a,e,s),t=!0)}if(!t)return;a.lineWidth=c,d.enable&&(a.globalCompositeOperation=d.composite),a.strokeStyle=(0,o.getStyleFromRgb)(h,p);const{shadow:g}=u;if(g.enable){const i=(0,o.rangeColorToRgb)(s,g.color);i&&(a.shadowBlur=g.blur,a.shadowColor=(0,o.getStyleFromRgb)(i))}a.stroke()}({context:t,width:p,begin:a,end:l,engine:this._engine,maxDistance:u,canvasSize:e.canvas.size,links:n,backgroundMask:g,colorLine:d,opacity:c})}))},this._drawLinkTriangle=(i,t,n)=>{const e=i.options.links;if(!e?.enable)return;const s=e.triangles;if(!s.enable)return;const r=this._container,a=r.actualOptions,l=t.destination,c=n.destination,d=s.opacity??.5*(t.opacity+n.opacity);d<=0||r.canvas.draw((t=>{const n=i.getPosition(),h=l.getPosition(),p=c.getPosition(),u=i.retina.linksDistance??0;if((0,o.getDistance)(n,h)>u||(0,o.getDistance)(p,h)>u||(0,o.getDistance)(p,n)>u)return;let g=(0,o.rangeColorToRgb)(this._engine,s.color);if(!g){const t=void 0!==e.id?r.particles.linksColors.get(e.id):r.particles.linksColor;g=(0,o.getLinkColor)(i,l,t)}g&&function(i){const{context:t,pos1:n,pos2:e,pos3:s,backgroundMask:r,colorTriangle:a,opacityTriangle:l}=i;!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()}(t,n,e,s),r.enable&&(t.globalCompositeOperation=r.composite),t.fillStyle=(0,o.getStyleFromRgb)(a,l),t.fill()}({context:t,pos1:n,pos2:h,pos3:p,backgroundMask:a.backgroundMask,colorTriangle:g,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)=>g([i,t],this._freqs.links),this._getTriangleFrequency=(i,t,n)=>g([i,t,n],this._freqs.triangles),this._container=i,this._engine=t,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 k{constructor(i){this.id="links",this._engine=i}getPlugin(i){return Promise.resolve(new y(i,this._engine))}loadOptions(){}needsPlugin(){return!0}}async function f(i,t=!0){i.checkVersion("3.8.1"),await async function(i,t=!0){await i.addInteractor("particlesLinks",(async t=>Promise.resolve(new u(t,i))),t)}(i,t),await async function(i,t=!0){const n=new k(i);await i.addPlugin(n,t)}(i,t)}return s})()));

@@ -1,1 +0,1 @@

/*! tsParticles Links Particles Interaction v3.8.0 by Matteo Bruni */
/*! tsParticles Links Particles Interaction v3.8.1 by Matteo Bruni */

@@ -30,3 +30,3 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

async function loadParticlesLinksInteraction(engine, refresh = true) {
engine.checkVersion("3.8.0");
engine.checkVersion("3.8.1");
await (0, interaction_js_1.loadLinksInteraction)(engine, refresh);

@@ -33,0 +33,0 @@ await (0, plugin_js_1.loadLinksPlugin)(engine, refresh);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc