@tsparticles/interaction-particles-links 3.0.0-beta.0 → 3.0.0-beta.2
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/README.md +1 -1
- package/browser/LinkInstance.js +1 -1
- package/browser/Linker.js +2 -2
- package/browser/Options/Classes/Links.js +2 -2
- package/browser/index.js +8 -8
- package/browser/interaction.js +1 -1
- package/browser/package.json +1 -0
- package/browser/plugin.js +1 -1
- package/cjs/LinkInstance.js +5 -5
- package/cjs/Linker.js +4 -4
- package/cjs/Options/Classes/Links.js +4 -4
- package/cjs/index.js +10 -10
- package/cjs/interaction.js +2 -2
- package/cjs/package.json +1 -0
- package/cjs/plugin.js +2 -2
- package/esm/LinkInstance.js +1 -1
- package/esm/Linker.js +2 -2
- package/esm/Options/Classes/Links.js +2 -2
- package/esm/index.js +8 -8
- package/esm/interaction.js +1 -1
- package/esm/package.json +1 -0
- package/esm/plugin.js +1 -1
- package/package.json +18 -6
- package/report.html +23 -5
- package/tsparticles.interaction.particles.links.js +1 -1
- package/tsparticles.interaction.particles.links.min.js.LICENSE.txt +1 -1
- package/types/Interfaces.d.ts +1 -1
- package/types/LinkInstance.d.ts +1 -1
- package/types/Linker.d.ts +1 -1
- package/types/Options/Classes/Links.d.ts +3 -3
- package/types/Options/Classes/LinksShadow.d.ts +1 -1
- package/types/Options/Classes/LinksTriangle.d.ts +1 -1
- package/types/Options/Interfaces/ILinks.d.ts +2 -2
- package/types/Types.d.ts +3 -3
- package/types/Utils.d.ts +1 -1
- package/types/index.d.ts +6 -6
- package/umd/LinkInstance.js +6 -6
- package/umd/Linker.js +5 -5
- package/umd/Options/Classes/Links.js +5 -5
- package/umd/index.js +11 -11
- package/umd/interaction.js +3 -3
- package/umd/plugin.js +3 -3
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/@tsparticles/interaction-particles-links)
|
|
7
7
|
[](https://www.npmjs.com/package/@tsparticles/interaction-particles-links) [](https://github.com/sponsors/matteobruni)
|
|
8
8
|
|
|
9
|
-
[tsParticles](https://github.com/
|
|
9
|
+
[tsParticles](https://github.com/tsparticles/tsparticles) interaction plugin for links effect between particles.
|
|
10
10
|
|
|
11
11
|
## How to use it
|
|
12
12
|
|
package/browser/LinkInstance.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDistance, getLinkColor, getRandom, getRangeValue, rangeColorToRgb, } from "@tsparticles/engine";
|
|
2
|
-
import { drawLinkLine, drawLinkTriangle, setLinkFrequency } from "./Utils";
|
|
2
|
+
import { drawLinkLine, drawLinkTriangle, setLinkFrequency } from "./Utils.js";
|
|
3
3
|
export class LinkInstance {
|
|
4
4
|
constructor(container) {
|
|
5
5
|
this.container = container;
|
package/browser/Linker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Circle, ParticlesInteractorBase, getDistances, getLinkRandomColor, } from "@tsparticles/engine";
|
|
2
|
-
import { CircleWarp } from "./CircleWarp";
|
|
3
|
-
import { Links } from "./Options/Classes/Links";
|
|
2
|
+
import { CircleWarp } from "./CircleWarp.js";
|
|
3
|
+
import { Links } from "./Options/Classes/Links.js";
|
|
4
4
|
function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
|
|
5
5
|
const { dx, dy, distance } = getDistances(pos1, pos2);
|
|
6
6
|
if (!warp || distance <= optDistance) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OptionsColor } from "@tsparticles/engine";
|
|
2
|
-
import { LinksShadow } from "./LinksShadow";
|
|
3
|
-
import { LinksTriangle } from "./LinksTriangle";
|
|
2
|
+
import { LinksShadow } from "./LinksShadow.js";
|
|
3
|
+
import { LinksTriangle } from "./LinksTriangle.js";
|
|
4
4
|
export class Links {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.blink = false;
|
package/browser/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { loadLinksInteraction } from "./interaction";
|
|
2
|
-
import { loadLinksPlugin } from "./plugin";
|
|
1
|
+
import { loadLinksInteraction } from "./interaction.js";
|
|
2
|
+
import { loadLinksPlugin } from "./plugin.js";
|
|
3
3
|
export async function loadParticlesLinksInteraction(engine, refresh = true) {
|
|
4
4
|
await loadLinksInteraction(engine, refresh);
|
|
5
5
|
await loadLinksPlugin(engine, refresh);
|
|
6
6
|
}
|
|
7
|
-
export * from "./Options/Classes/Links";
|
|
8
|
-
export * from "./Options/Classes/LinksShadow";
|
|
9
|
-
export * from "./Options/Classes/LinksTriangle";
|
|
10
|
-
export * from "./Options/Interfaces/ILinks";
|
|
11
|
-
export * from "./Options/Interfaces/ILinksShadow";
|
|
12
|
-
export * from "./Options/Interfaces/ILinksTriangle";
|
|
7
|
+
export * from "./Options/Classes/Links.js";
|
|
8
|
+
export * from "./Options/Classes/LinksShadow.js";
|
|
9
|
+
export * from "./Options/Classes/LinksTriangle.js";
|
|
10
|
+
export * from "./Options/Interfaces/ILinks.js";
|
|
11
|
+
export * from "./Options/Interfaces/ILinksShadow.js";
|
|
12
|
+
export * from "./Options/Interfaces/ILinksTriangle.js";
|
package/browser/interaction.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
package/browser/plugin.js
CHANGED
package/cjs/LinkInstance.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LinkInstance = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
const
|
|
5
|
+
const Utils_js_1 = require("./Utils.js");
|
|
6
6
|
class LinkInstance {
|
|
7
7
|
constructor(container) {
|
|
8
8
|
this.container = container;
|
|
@@ -33,7 +33,7 @@ class LinkInstance {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
const width = p1.retina.linksWidth ?? 0, maxDistance = p1.retina.linksDistance ?? 0, { backgroundMask } = options;
|
|
36
|
-
(0,
|
|
36
|
+
(0, Utils_js_1.drawLinkLine)({
|
|
37
37
|
context: ctx,
|
|
38
38
|
width,
|
|
39
39
|
begin: pos1,
|
|
@@ -77,7 +77,7 @@ class LinkInstance {
|
|
|
77
77
|
if (!colorTriangle) {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
(0,
|
|
80
|
+
(0, Utils_js_1.drawLinkTriangle)({
|
|
81
81
|
context: ctx,
|
|
82
82
|
pos1,
|
|
83
83
|
pos2,
|
|
@@ -111,10 +111,10 @@ class LinkInstance {
|
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
this._getLinkFrequency = (p1, p2) => {
|
|
114
|
-
return (0,
|
|
114
|
+
return (0, Utils_js_1.setLinkFrequency)([p1, p2], this._freqs.links);
|
|
115
115
|
};
|
|
116
116
|
this._getTriangleFrequency = (p1, p2, p3) => {
|
|
117
|
-
return (0,
|
|
117
|
+
return (0, Utils_js_1.setLinkFrequency)([p1, p2, p3], this._freqs.triangles);
|
|
118
118
|
};
|
|
119
119
|
this._freqs = {
|
|
120
120
|
links: new Map(),
|
package/cjs/Linker.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Linker = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const CircleWarp_js_1 = require("./CircleWarp.js");
|
|
6
|
+
const Links_js_1 = require("./Options/Classes/Links.js");
|
|
7
7
|
function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
|
|
8
8
|
const { dx, dy, distance } = (0, engine_1.getDistances)(pos1, pos2);
|
|
9
9
|
if (!warp || distance <= optDistance) {
|
|
@@ -59,7 +59,7 @@ class Linker extends engine_1.ParticlesInteractorBase {
|
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
const linkOpt1 = p1.options.links, optOpacity = linkOpt1.opacity, optDistance = p1.retina.linksDistance ?? 0, warp = linkOpt1.warp, range = warp
|
|
62
|
-
? new
|
|
62
|
+
? new CircleWarp_js_1.CircleWarp(pos1.x, pos1.y, optDistance, canvasSize)
|
|
63
63
|
: new engine_1.Circle(pos1.x, pos1.y, optDistance), query = container.particles.quadTree.query(range);
|
|
64
64
|
for (const p2 of query) {
|
|
65
65
|
const linkOpt2 = p2.options.links;
|
|
@@ -94,7 +94,7 @@ class Linker extends engine_1.ParticlesInteractorBase {
|
|
|
94
94
|
}
|
|
95
95
|
loadParticlesOptions(options, ...sources) {
|
|
96
96
|
if (!options.links) {
|
|
97
|
-
options.links = new
|
|
97
|
+
options.links = new Links_js_1.Links();
|
|
98
98
|
}
|
|
99
99
|
for (const source of sources) {
|
|
100
100
|
options.links.load(source?.links ?? source?.lineLinked ?? source?.line_linked);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Links = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const LinksShadow_js_1 = require("./LinksShadow.js");
|
|
6
|
+
const LinksTriangle_js_1 = require("./LinksTriangle.js");
|
|
7
7
|
class Links {
|
|
8
8
|
constructor() {
|
|
9
9
|
this.blink = false;
|
|
@@ -14,8 +14,8 @@ class Links {
|
|
|
14
14
|
this.enable = false;
|
|
15
15
|
this.frequency = 1;
|
|
16
16
|
this.opacity = 1;
|
|
17
|
-
this.shadow = new
|
|
18
|
-
this.triangles = new
|
|
17
|
+
this.shadow = new LinksShadow_js_1.LinksShadow();
|
|
18
|
+
this.triangles = new LinksTriangle_js_1.LinksTriangle();
|
|
19
19
|
this.width = 1;
|
|
20
20
|
this.warp = false;
|
|
21
21
|
}
|
package/cjs/index.js
CHANGED
|
@@ -15,16 +15,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.loadParticlesLinksInteraction = void 0;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
18
|
+
const interaction_js_1 = require("./interaction.js");
|
|
19
|
+
const plugin_js_1 = require("./plugin.js");
|
|
20
20
|
async function loadParticlesLinksInteraction(engine, refresh = true) {
|
|
21
|
-
await (0,
|
|
22
|
-
await (0,
|
|
21
|
+
await (0, interaction_js_1.loadLinksInteraction)(engine, refresh);
|
|
22
|
+
await (0, plugin_js_1.loadLinksPlugin)(engine, refresh);
|
|
23
23
|
}
|
|
24
24
|
exports.loadParticlesLinksInteraction = loadParticlesLinksInteraction;
|
|
25
|
-
__exportStar(require("./Options/Classes/Links"), exports);
|
|
26
|
-
__exportStar(require("./Options/Classes/LinksShadow"), exports);
|
|
27
|
-
__exportStar(require("./Options/Classes/LinksTriangle"), exports);
|
|
28
|
-
__exportStar(require("./Options/Interfaces/ILinks"), exports);
|
|
29
|
-
__exportStar(require("./Options/Interfaces/ILinksShadow"), exports);
|
|
30
|
-
__exportStar(require("./Options/Interfaces/ILinksTriangle"), exports);
|
|
25
|
+
__exportStar(require("./Options/Classes/Links.js"), exports);
|
|
26
|
+
__exportStar(require("./Options/Classes/LinksShadow.js"), exports);
|
|
27
|
+
__exportStar(require("./Options/Classes/LinksTriangle.js"), exports);
|
|
28
|
+
__exportStar(require("./Options/Interfaces/ILinks.js"), exports);
|
|
29
|
+
__exportStar(require("./Options/Interfaces/ILinksShadow.js"), exports);
|
|
30
|
+
__exportStar(require("./Options/Interfaces/ILinksTriangle.js"), exports);
|
package/cjs/interaction.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadLinksInteraction = void 0;
|
|
4
|
-
const
|
|
4
|
+
const Linker_js_1 = require("./Linker.js");
|
|
5
5
|
async function loadLinksInteraction(engine, refresh = true) {
|
|
6
|
-
await engine.addInteractor("particlesLinks", (container) => new
|
|
6
|
+
await engine.addInteractor("particlesLinks", (container) => new Linker_js_1.Linker(container), refresh);
|
|
7
7
|
}
|
|
8
8
|
exports.loadLinksInteraction = loadLinksInteraction;
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commonjs" }
|
package/cjs/plugin.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadLinksPlugin = void 0;
|
|
4
|
-
const
|
|
4
|
+
const LinkInstance_js_1 = require("./LinkInstance.js");
|
|
5
5
|
class LinksPlugin {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.id = "links";
|
|
8
8
|
}
|
|
9
9
|
getPlugin(container) {
|
|
10
|
-
return new
|
|
10
|
+
return new LinkInstance_js_1.LinkInstance(container);
|
|
11
11
|
}
|
|
12
12
|
loadOptions() {
|
|
13
13
|
}
|
package/esm/LinkInstance.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDistance, getLinkColor, getRandom, getRangeValue, rangeColorToRgb, } from "@tsparticles/engine";
|
|
2
|
-
import { drawLinkLine, drawLinkTriangle, setLinkFrequency } from "./Utils";
|
|
2
|
+
import { drawLinkLine, drawLinkTriangle, setLinkFrequency } from "./Utils.js";
|
|
3
3
|
export class LinkInstance {
|
|
4
4
|
constructor(container) {
|
|
5
5
|
this.container = container;
|
package/esm/Linker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Circle, ParticlesInteractorBase, getDistances, getLinkRandomColor, } from "@tsparticles/engine";
|
|
2
|
-
import { CircleWarp } from "./CircleWarp";
|
|
3
|
-
import { Links } from "./Options/Classes/Links";
|
|
2
|
+
import { CircleWarp } from "./CircleWarp.js";
|
|
3
|
+
import { Links } from "./Options/Classes/Links.js";
|
|
4
4
|
function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
|
|
5
5
|
const { dx, dy, distance } = getDistances(pos1, pos2);
|
|
6
6
|
if (!warp || distance <= optDistance) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OptionsColor } from "@tsparticles/engine";
|
|
2
|
-
import { LinksShadow } from "./LinksShadow";
|
|
3
|
-
import { LinksTriangle } from "./LinksTriangle";
|
|
2
|
+
import { LinksShadow } from "./LinksShadow.js";
|
|
3
|
+
import { LinksTriangle } from "./LinksTriangle.js";
|
|
4
4
|
export class Links {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.blink = false;
|
package/esm/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { loadLinksInteraction } from "./interaction";
|
|
2
|
-
import { loadLinksPlugin } from "./plugin";
|
|
1
|
+
import { loadLinksInteraction } from "./interaction.js";
|
|
2
|
+
import { loadLinksPlugin } from "./plugin.js";
|
|
3
3
|
export async function loadParticlesLinksInteraction(engine, refresh = true) {
|
|
4
4
|
await loadLinksInteraction(engine, refresh);
|
|
5
5
|
await loadLinksPlugin(engine, refresh);
|
|
6
6
|
}
|
|
7
|
-
export * from "./Options/Classes/Links";
|
|
8
|
-
export * from "./Options/Classes/LinksShadow";
|
|
9
|
-
export * from "./Options/Classes/LinksTriangle";
|
|
10
|
-
export * from "./Options/Interfaces/ILinks";
|
|
11
|
-
export * from "./Options/Interfaces/ILinksShadow";
|
|
12
|
-
export * from "./Options/Interfaces/ILinksTriangle";
|
|
7
|
+
export * from "./Options/Classes/Links.js";
|
|
8
|
+
export * from "./Options/Classes/LinksShadow.js";
|
|
9
|
+
export * from "./Options/Classes/LinksTriangle.js";
|
|
10
|
+
export * from "./Options/Interfaces/ILinks.js";
|
|
11
|
+
export * from "./Options/Interfaces/ILinksShadow.js";
|
|
12
|
+
export * from "./Options/Interfaces/ILinksTriangle.js";
|
package/esm/interaction.js
CHANGED
package/esm/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "module" }
|
package/esm/plugin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-particles-links",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.2",
|
|
4
4
|
"description": "tsParticles links particles interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/
|
|
8
|
+
"url": "git+https://github.com/tsparticles/tsparticles.git",
|
|
9
9
|
"directory": "interactions/particles/links"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
|
@@ -66,16 +66,28 @@
|
|
|
66
66
|
"author": "Matteo Bruni <matteo.bruni@me.com>",
|
|
67
67
|
"license": "MIT",
|
|
68
68
|
"bugs": {
|
|
69
|
-
"url": "https://github.com/
|
|
69
|
+
"url": "https://github.com/tsparticles/tsparticles/issues"
|
|
70
70
|
},
|
|
71
|
-
"
|
|
71
|
+
"sideEffects": false,
|
|
72
72
|
"jsdelivr": "tsparticles.interaction.particles.links.min.js",
|
|
73
73
|
"unpkg": "tsparticles.interaction.particles.links.min.js",
|
|
74
|
+
"browser": "browser/index.js",
|
|
75
|
+
"main": "cjs/index.js",
|
|
74
76
|
"module": "esm/index.js",
|
|
75
77
|
"types": "types/index.d.ts",
|
|
76
|
-
"
|
|
78
|
+
"exports": {
|
|
79
|
+
".": {
|
|
80
|
+
"types": "./types/index.d.ts",
|
|
81
|
+
"browser": "./browser/index.js",
|
|
82
|
+
"import": "./esm/index.js",
|
|
83
|
+
"require": "./cjs/index.js",
|
|
84
|
+
"umd": "./umd/index.js",
|
|
85
|
+
"default": "./cjs/index.js"
|
|
86
|
+
},
|
|
87
|
+
"./package.json": "./package.json"
|
|
88
|
+
},
|
|
77
89
|
"dependencies": {
|
|
78
|
-
"@tsparticles/engine": "^3.0.0-beta.
|
|
90
|
+
"@tsparticles/engine": "^3.0.0-beta.2"
|
|
79
91
|
},
|
|
80
92
|
"publishConfig": {
|
|
81
93
|
"access": "public"
|