@tsparticles/interaction-particles-links 3.0.0-alpha.1 → 3.0.0-beta.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/README.md +25 -19
- package/browser/CircleWarp.js +7 -23
- package/browser/LinkInstance.js +121 -114
- package/browser/Linker.js +37 -54
- package/browser/Options/Classes/Links.js +1 -1
- package/browser/Utils.js +24 -8
- package/browser/index.js +5 -5
- package/browser/interaction.js +2 -2
- package/browser/plugin.js +2 -2
- package/cjs/CircleWarp.js +7 -23
- package/cjs/LinkInstance.js +123 -127
- package/cjs/Linker.js +66 -94
- package/cjs/Options/Classes/Links.js +1 -1
- package/cjs/Utils.js +26 -8
- package/cjs/index.js +3 -14
- package/cjs/interaction.js +4 -15
- package/cjs/plugin.js +5 -16
- package/esm/CircleWarp.js +7 -23
- package/esm/LinkInstance.js +121 -114
- package/esm/Linker.js +37 -54
- package/esm/Options/Classes/Links.js +1 -1
- package/esm/Utils.js +24 -8
- package/esm/index.js +5 -5
- package/esm/interaction.js +2 -2
- package/esm/plugin.js +2 -2
- package/package.json +6 -5
- package/report.html +4 -4
- package/tsparticles.interaction.particles.links.js +244 -204
- package/tsparticles.interaction.particles.links.min.js +1 -1
- package/tsparticles.interaction.particles.links.min.js.LICENSE.txt +1 -8
- package/types/CircleWarp.d.ts +1 -2
- package/types/Interfaces.d.ts +22 -0
- package/types/LinkInstance.d.ts +7 -8
- package/types/Linker.d.ts +3 -7
- package/types/Options/Classes/Links.d.ts +1 -2
- package/types/Options/Classes/LinksShadow.d.ts +1 -2
- package/types/Options/Classes/LinksTriangle.d.ts +1 -2
- package/types/Types.d.ts +47 -0
- package/types/Utils.d.ts +5 -4
- package/types/index.d.ts +1 -1
- package/types/interaction.d.ts +1 -1
- package/types/plugin.d.ts +1 -1
- package/umd/CircleWarp.js +7 -23
- package/umd/LinkInstance.js +121 -114
- package/umd/Linker.js +36 -53
- package/umd/Options/Classes/Links.js +2 -2
- package/umd/Utils.js +26 -8
- package/umd/index.js +3 -3
- package/umd/interaction.js +4 -4
- package/umd/plugin.js +4 -4
- package/browser/Options/Interfaces/IParticlesLinkOptions.js +0 -1
- package/cjs/LinkParticle.js +0 -2
- package/cjs/Options/Classes/ParticlesLinkOptions.js +0 -2
- package/cjs/Options/Interfaces/IParticlesLinkOptions.js +0 -2
- package/esm/ILink.js +0 -1
- package/esm/LinkContainer.js +0 -1
- package/esm/LinkParticle.js +0 -1
- package/esm/Options/Classes/ParticlesLinkOptions.js +0 -1
- package/esm/Options/Interfaces/IParticlesLinkOptions.js +0 -1
- package/types/ILink.d.ts +0 -9
- package/types/LinkContainer.d.ts +0 -7
- package/types/LinkParticle.d.ts +0 -11
- package/types/Options/Classes/ParticlesLinkOptions.d.ts +0 -5
- package/types/Options/Interfaces/IParticlesLinkOptions.d.ts +0 -7
- package/umd/LinkParticle.js +0 -12
- package/umd/Options/Classes/ParticlesLinkOptions.js +0 -12
- package/umd/Options/Interfaces/IParticlesLinkOptions.js +0 -12
- /package/browser/{ILink.js → Interfaces.js} +0 -0
- /package/browser/{LinkContainer.js → Types.js} +0 -0
- /package/cjs/{ILink.js → Interfaces.js} +0 -0
- /package/cjs/{LinkContainer.js → Types.js} +0 -0
- /package/{browser/LinkParticle.js → esm/Interfaces.js} +0 -0
- /package/{browser/Options/Classes/ParticlesLinkOptions.js → esm/Types.js} +0 -0
- /package/umd/{ILink.js → Interfaces.js} +0 -0
- /package/umd/{LinkContainer.js → Types.js} +0 -0
package/umd/Utils.js
CHANGED
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.drawLinkTriangle = exports.drawLinkLine = void 0;
|
|
12
|
+
exports.setLinkFrequency = exports.getLinkKey = exports.drawLinkTriangle = exports.drawLinkLine = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
function drawLinkLine(
|
|
14
|
+
function drawLinkLine(params) {
|
|
15
15
|
let drawn = false;
|
|
16
|
+
const { begin, end, maxDistance, context, canvasSize, width, backgroundMask, colorLine, opacity, links } = params;
|
|
16
17
|
if ((0, engine_1.getDistance)(begin, end) <= maxDistance) {
|
|
17
18
|
(0, engine_1.drawLine)(context, begin, end);
|
|
18
19
|
drawn = true;
|
|
19
20
|
}
|
|
20
|
-
else if (warp) {
|
|
21
|
+
else if (links.warp) {
|
|
21
22
|
let pi1;
|
|
22
23
|
let pi2;
|
|
23
24
|
const endNE = {
|
|
@@ -66,10 +67,11 @@
|
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
68
69
|
context.lineWidth = width;
|
|
69
|
-
if (backgroundMask) {
|
|
70
|
-
context.globalCompositeOperation = composite;
|
|
70
|
+
if (backgroundMask.enable) {
|
|
71
|
+
context.globalCompositeOperation = backgroundMask.composite;
|
|
71
72
|
}
|
|
72
73
|
context.strokeStyle = (0, engine_1.getStyleFromRgb)(colorLine, opacity);
|
|
74
|
+
const { shadow } = links;
|
|
73
75
|
if (shadow.enable) {
|
|
74
76
|
const shadowColor = (0, engine_1.rangeColorToRgb)(shadow.color);
|
|
75
77
|
if (shadowColor) {
|
|
@@ -80,13 +82,29 @@
|
|
|
80
82
|
context.stroke();
|
|
81
83
|
}
|
|
82
84
|
exports.drawLinkLine = drawLinkLine;
|
|
83
|
-
function drawLinkTriangle(
|
|
85
|
+
function drawLinkTriangle(params) {
|
|
86
|
+
const { context, pos1, pos2, pos3, backgroundMask, colorTriangle, opacityTriangle } = params;
|
|
84
87
|
(0, engine_1.drawTriangle)(context, pos1, pos2, pos3);
|
|
85
|
-
if (backgroundMask) {
|
|
86
|
-
context.globalCompositeOperation = composite;
|
|
88
|
+
if (backgroundMask.enable) {
|
|
89
|
+
context.globalCompositeOperation = backgroundMask.composite;
|
|
87
90
|
}
|
|
88
91
|
context.fillStyle = (0, engine_1.getStyleFromRgb)(colorTriangle, opacityTriangle);
|
|
89
92
|
context.fill();
|
|
90
93
|
}
|
|
91
94
|
exports.drawLinkTriangle = drawLinkTriangle;
|
|
95
|
+
function getLinkKey(ids) {
|
|
96
|
+
ids.sort((a, b) => a - b);
|
|
97
|
+
return ids.join("_");
|
|
98
|
+
}
|
|
99
|
+
exports.getLinkKey = getLinkKey;
|
|
100
|
+
function setLinkFrequency(particles, dictionary) {
|
|
101
|
+
const key = getLinkKey(particles.map((t) => t.id));
|
|
102
|
+
let res = dictionary.get(key);
|
|
103
|
+
if (res === undefined) {
|
|
104
|
+
res = (0, engine_1.getRandom)();
|
|
105
|
+
dictionary.set(key, res);
|
|
106
|
+
}
|
|
107
|
+
return res;
|
|
108
|
+
}
|
|
109
|
+
exports.setLinkFrequency = setLinkFrequency;
|
|
92
110
|
});
|
package/umd/index.js
CHANGED
|
@@ -26,9 +26,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
exports.loadParticlesLinksInteraction = void 0;
|
|
27
27
|
const interaction_1 = require("./interaction");
|
|
28
28
|
const plugin_1 = require("./plugin");
|
|
29
|
-
async function loadParticlesLinksInteraction(engine) {
|
|
30
|
-
await (0, interaction_1.
|
|
31
|
-
await (0, plugin_1.
|
|
29
|
+
async function loadParticlesLinksInteraction(engine, refresh = true) {
|
|
30
|
+
await (0, interaction_1.loadLinksInteraction)(engine, refresh);
|
|
31
|
+
await (0, plugin_1.loadLinksPlugin)(engine, refresh);
|
|
32
32
|
}
|
|
33
33
|
exports.loadParticlesLinksInteraction = loadParticlesLinksInteraction;
|
|
34
34
|
__exportStar(require("./Options/Classes/Links"), exports);
|
package/umd/interaction.js
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.loadLinksInteraction = void 0;
|
|
13
13
|
const Linker_1 = require("./Linker");
|
|
14
|
-
async function
|
|
15
|
-
await engine.addInteractor("particlesLinks", (container) => new Linker_1.Linker(container));
|
|
14
|
+
async function loadLinksInteraction(engine, refresh = true) {
|
|
15
|
+
await engine.addInteractor("particlesLinks", (container) => new Linker_1.Linker(container), refresh);
|
|
16
16
|
}
|
|
17
|
-
exports.
|
|
17
|
+
exports.loadLinksInteraction = loadLinksInteraction;
|
|
18
18
|
});
|
package/umd/plugin.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.loadLinksPlugin = void 0;
|
|
13
13
|
const LinkInstance_1 = require("./LinkInstance");
|
|
14
14
|
class LinksPlugin {
|
|
15
15
|
constructor() {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
async function
|
|
27
|
+
async function loadLinksPlugin(engine, refresh = true) {
|
|
28
28
|
const plugin = new LinksPlugin();
|
|
29
|
-
await engine.addPlugin(plugin);
|
|
29
|
+
await engine.addPlugin(plugin, refresh);
|
|
30
30
|
}
|
|
31
|
-
exports.
|
|
31
|
+
exports.loadLinksPlugin = loadLinksPlugin;
|
|
32
32
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/cjs/LinkParticle.js
DELETED
package/esm/ILink.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/LinkContainer.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/LinkParticle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/types/ILink.d.ts
DELETED
package/types/LinkContainer.d.ts
DELETED
package/types/LinkParticle.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ILink } from "./ILink";
|
|
2
|
-
import type { Particle } from "@tsparticles/engine";
|
|
3
|
-
import type { ParticlesLinkOptions } from "./Options/Classes/ParticlesLinkOptions";
|
|
4
|
-
export type LinkParticle = Particle & {
|
|
5
|
-
links?: ILink[];
|
|
6
|
-
options: ParticlesLinkOptions;
|
|
7
|
-
retina: {
|
|
8
|
-
linksDistance?: number;
|
|
9
|
-
linksWidth?: number;
|
|
10
|
-
};
|
|
11
|
-
};
|
package/umd/LinkParticle.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|