@tsparticles/interaction-particles-links 3.0.0-alpha.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/LICENSE +21 -0
- package/README.md +69 -0
- package/browser/CircleWarp.js +50 -0
- package/browser/ILink.js +1 -0
- package/browser/LinkContainer.js +1 -0
- package/browser/LinkInstance.js +143 -0
- package/browser/LinkParticle.js +1 -0
- package/browser/Linker.js +119 -0
- package/browser/Options/Classes/Links.js +54 -0
- package/browser/Options/Classes/LinksShadow.js +21 -0
- package/browser/Options/Classes/LinksTriangle.js +24 -0
- package/browser/Options/Classes/ParticlesLinkOptions.js +1 -0
- package/browser/Options/Interfaces/ILinks.js +1 -0
- package/browser/Options/Interfaces/ILinksShadow.js +1 -0
- package/browser/Options/Interfaces/ILinksTriangle.js +1 -0
- package/browser/Options/Interfaces/IParticlesLinkOptions.js +1 -0
- package/browser/Utils.js +77 -0
- package/browser/index.js +12 -0
- package/browser/interaction.js +4 -0
- package/browser/plugin.js +18 -0
- package/cjs/CircleWarp.js +54 -0
- package/cjs/ILink.js +2 -0
- package/cjs/LinkContainer.js +2 -0
- package/cjs/LinkInstance.js +158 -0
- package/cjs/LinkParticle.js +2 -0
- package/cjs/Linker.js +134 -0
- package/cjs/Options/Classes/Links.js +58 -0
- package/cjs/Options/Classes/LinksShadow.js +25 -0
- package/cjs/Options/Classes/LinksTriangle.js +28 -0
- package/cjs/Options/Classes/ParticlesLinkOptions.js +2 -0
- package/cjs/Options/Interfaces/ILinks.js +2 -0
- package/cjs/Options/Interfaces/ILinksShadow.js +2 -0
- package/cjs/Options/Interfaces/ILinksTriangle.js +2 -0
- package/cjs/Options/Interfaces/IParticlesLinkOptions.js +2 -0
- package/cjs/Utils.js +82 -0
- package/cjs/index.js +41 -0
- package/cjs/interaction.js +19 -0
- package/cjs/plugin.js +33 -0
- package/esm/CircleWarp.js +50 -0
- package/esm/ILink.js +1 -0
- package/esm/LinkContainer.js +1 -0
- package/esm/LinkInstance.js +143 -0
- package/esm/LinkParticle.js +1 -0
- package/esm/Linker.js +119 -0
- package/esm/Options/Classes/Links.js +54 -0
- package/esm/Options/Classes/LinksShadow.js +21 -0
- package/esm/Options/Classes/LinksTriangle.js +24 -0
- package/esm/Options/Classes/ParticlesLinkOptions.js +1 -0
- package/esm/Options/Interfaces/ILinks.js +1 -0
- package/esm/Options/Interfaces/ILinksShadow.js +1 -0
- package/esm/Options/Interfaces/ILinksTriangle.js +1 -0
- package/esm/Options/Interfaces/IParticlesLinkOptions.js +1 -0
- package/esm/Utils.js +77 -0
- package/esm/index.js +12 -0
- package/esm/interaction.js +4 -0
- package/esm/plugin.js +18 -0
- package/package.json +82 -0
- package/report.html +39 -0
- package/tsparticles.interaction.particles.links.js +658 -0
- package/tsparticles.interaction.particles.links.min.js +2 -0
- package/tsparticles.interaction.particles.links.min.js.LICENSE.txt +8 -0
- package/types/CircleWarp.d.ts +8 -0
- package/types/ILink.d.ts +9 -0
- package/types/LinkContainer.d.ts +7 -0
- package/types/LinkInstance.d.ts +17 -0
- package/types/LinkParticle.d.ts +11 -0
- package/types/Linker.d.ts +17 -0
- package/types/Options/Classes/Links.d.ts +21 -0
- package/types/Options/Classes/LinksShadow.d.ts +10 -0
- package/types/Options/Classes/LinksTriangle.d.ts +11 -0
- package/types/Options/Classes/ParticlesLinkOptions.d.ts +5 -0
- package/types/Options/Interfaces/ILinks.d.ts +17 -0
- package/types/Options/Interfaces/ILinksShadow.d.ts +6 -0
- package/types/Options/Interfaces/ILinksTriangle.d.ts +7 -0
- package/types/Options/Interfaces/IParticlesLinkOptions.d.ts +7 -0
- package/types/Utils.d.ts +4 -0
- package/types/index.d.ts +8 -0
- package/types/interaction.d.ts +2 -0
- package/types/plugin.d.ts +2 -0
- package/umd/CircleWarp.js +64 -0
- package/umd/ILink.js +12 -0
- package/umd/LinkContainer.js +12 -0
- package/umd/LinkInstance.js +157 -0
- package/umd/LinkParticle.js +12 -0
- package/umd/Linker.js +133 -0
- package/umd/Options/Classes/Links.js +68 -0
- package/umd/Options/Classes/LinksShadow.js +35 -0
- package/umd/Options/Classes/LinksTriangle.js +38 -0
- package/umd/Options/Classes/ParticlesLinkOptions.js +12 -0
- package/umd/Options/Interfaces/ILinks.js +12 -0
- package/umd/Options/Interfaces/ILinksShadow.js +12 -0
- package/umd/Options/Interfaces/ILinksTriangle.js +12 -0
- package/umd/Options/Interfaces/IParticlesLinkOptions.js +12 -0
- package/umd/Utils.js +92 -0
- package/umd/index.js +40 -0
- package/umd/interaction.js +18 -0
- package/umd/plugin.js +32 -0
|
@@ -0,0 +1,35 @@
|
|
|
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", "@tsparticles/engine"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.LinksShadow = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
class LinksShadow {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.blur = 5;
|
|
17
|
+
this.color = new engine_1.OptionsColor();
|
|
18
|
+
this.color.value = "#000";
|
|
19
|
+
this.enable = false;
|
|
20
|
+
}
|
|
21
|
+
load(data) {
|
|
22
|
+
if (!data) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (data.blur !== undefined) {
|
|
26
|
+
this.blur = data.blur;
|
|
27
|
+
}
|
|
28
|
+
this.color = engine_1.OptionsColor.create(this.color, data.color);
|
|
29
|
+
if (data.enable !== undefined) {
|
|
30
|
+
this.enable = data.enable;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.LinksShadow = LinksShadow;
|
|
35
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
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", "@tsparticles/engine"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.LinksTriangle = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
class LinksTriangle {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.enable = false;
|
|
17
|
+
this.frequency = 1;
|
|
18
|
+
}
|
|
19
|
+
load(data) {
|
|
20
|
+
if (!data) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (data.color !== undefined) {
|
|
24
|
+
this.color = engine_1.OptionsColor.create(this.color, data.color);
|
|
25
|
+
}
|
|
26
|
+
if (data.enable !== undefined) {
|
|
27
|
+
this.enable = data.enable;
|
|
28
|
+
}
|
|
29
|
+
if (data.frequency !== undefined) {
|
|
30
|
+
this.frequency = data.frequency;
|
|
31
|
+
}
|
|
32
|
+
if (data.opacity !== undefined) {
|
|
33
|
+
this.opacity = data.opacity;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.LinksTriangle = LinksTriangle;
|
|
38
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
});
|
package/umd/Utils.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
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", "@tsparticles/engine"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.drawLinkTriangle = exports.drawLinkLine = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
function drawLinkLine(context, width, begin, end, maxDistance, canvasSize, warp, backgroundMask, composite, colorLine, opacity, shadow) {
|
|
15
|
+
let drawn = false;
|
|
16
|
+
if ((0, engine_1.getDistance)(begin, end) <= maxDistance) {
|
|
17
|
+
(0, engine_1.drawLine)(context, begin, end);
|
|
18
|
+
drawn = true;
|
|
19
|
+
}
|
|
20
|
+
else if (warp) {
|
|
21
|
+
let pi1;
|
|
22
|
+
let pi2;
|
|
23
|
+
const endNE = {
|
|
24
|
+
x: end.x - canvasSize.width,
|
|
25
|
+
y: end.y,
|
|
26
|
+
};
|
|
27
|
+
const d1 = (0, engine_1.getDistances)(begin, endNE);
|
|
28
|
+
if (d1.distance <= maxDistance) {
|
|
29
|
+
const yi = begin.y - (d1.dy / d1.dx) * begin.x;
|
|
30
|
+
pi1 = { x: 0, y: yi };
|
|
31
|
+
pi2 = { x: canvasSize.width, y: yi };
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const endSW = {
|
|
35
|
+
x: end.x,
|
|
36
|
+
y: end.y - canvasSize.height,
|
|
37
|
+
};
|
|
38
|
+
const d2 = (0, engine_1.getDistances)(begin, endSW);
|
|
39
|
+
if (d2.distance <= maxDistance) {
|
|
40
|
+
const yi = begin.y - (d2.dy / d2.dx) * begin.x;
|
|
41
|
+
const xi = -yi / (d2.dy / d2.dx);
|
|
42
|
+
pi1 = { x: xi, y: 0 };
|
|
43
|
+
pi2 = { x: xi, y: canvasSize.height };
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const endSE = {
|
|
47
|
+
x: end.x - canvasSize.width,
|
|
48
|
+
y: end.y - canvasSize.height,
|
|
49
|
+
};
|
|
50
|
+
const d3 = (0, engine_1.getDistances)(begin, endSE);
|
|
51
|
+
if (d3.distance <= maxDistance) {
|
|
52
|
+
const yi = begin.y - (d3.dy / d3.dx) * begin.x;
|
|
53
|
+
const xi = -yi / (d3.dy / d3.dx);
|
|
54
|
+
pi1 = { x: xi, y: yi };
|
|
55
|
+
pi2 = { x: pi1.x + canvasSize.width, y: pi1.y + canvasSize.height };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (pi1 && pi2) {
|
|
60
|
+
(0, engine_1.drawLine)(context, begin, pi1);
|
|
61
|
+
(0, engine_1.drawLine)(context, end, pi2);
|
|
62
|
+
drawn = true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (!drawn) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
context.lineWidth = width;
|
|
69
|
+
if (backgroundMask) {
|
|
70
|
+
context.globalCompositeOperation = composite;
|
|
71
|
+
}
|
|
72
|
+
context.strokeStyle = (0, engine_1.getStyleFromRgb)(colorLine, opacity);
|
|
73
|
+
if (shadow.enable) {
|
|
74
|
+
const shadowColor = (0, engine_1.rangeColorToRgb)(shadow.color);
|
|
75
|
+
if (shadowColor) {
|
|
76
|
+
context.shadowBlur = shadow.blur;
|
|
77
|
+
context.shadowColor = (0, engine_1.getStyleFromRgb)(shadowColor);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
context.stroke();
|
|
81
|
+
}
|
|
82
|
+
exports.drawLinkLine = drawLinkLine;
|
|
83
|
+
function drawLinkTriangle(context, pos1, pos2, pos3, backgroundMask, composite, colorTriangle, opacityTriangle) {
|
|
84
|
+
(0, engine_1.drawTriangle)(context, pos1, pos2, pos3);
|
|
85
|
+
if (backgroundMask) {
|
|
86
|
+
context.globalCompositeOperation = composite;
|
|
87
|
+
}
|
|
88
|
+
context.fillStyle = (0, engine_1.getStyleFromRgb)(colorTriangle, opacityTriangle);
|
|
89
|
+
context.fill();
|
|
90
|
+
}
|
|
91
|
+
exports.drawLinkTriangle = drawLinkTriangle;
|
|
92
|
+
});
|
package/umd/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
13
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
14
|
+
};
|
|
15
|
+
(function (factory) {
|
|
16
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
17
|
+
var v = factory(require, exports);
|
|
18
|
+
if (v !== undefined) module.exports = v;
|
|
19
|
+
}
|
|
20
|
+
else if (typeof define === "function" && define.amd) {
|
|
21
|
+
define(["require", "exports", "./interaction", "./plugin", "./Options/Classes/Links", "./Options/Classes/LinksShadow", "./Options/Classes/LinksTriangle", "./Options/Interfaces/ILinks", "./Options/Interfaces/ILinksShadow", "./Options/Interfaces/ILinksTriangle"], factory);
|
|
22
|
+
}
|
|
23
|
+
})(function (require, exports) {
|
|
24
|
+
"use strict";
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.loadParticlesLinksInteraction = void 0;
|
|
27
|
+
const interaction_1 = require("./interaction");
|
|
28
|
+
const plugin_1 = require("./plugin");
|
|
29
|
+
async function loadParticlesLinksInteraction(engine) {
|
|
30
|
+
await (0, interaction_1.loadInteraction)(engine);
|
|
31
|
+
await (0, plugin_1.loadPlugin)(engine);
|
|
32
|
+
}
|
|
33
|
+
exports.loadParticlesLinksInteraction = loadParticlesLinksInteraction;
|
|
34
|
+
__exportStar(require("./Options/Classes/Links"), exports);
|
|
35
|
+
__exportStar(require("./Options/Classes/LinksShadow"), exports);
|
|
36
|
+
__exportStar(require("./Options/Classes/LinksTriangle"), exports);
|
|
37
|
+
__exportStar(require("./Options/Interfaces/ILinks"), exports);
|
|
38
|
+
__exportStar(require("./Options/Interfaces/ILinksShadow"), exports);
|
|
39
|
+
__exportStar(require("./Options/Interfaces/ILinksTriangle"), exports);
|
|
40
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
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", "./Linker"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadInteraction = void 0;
|
|
13
|
+
const Linker_1 = require("./Linker");
|
|
14
|
+
async function loadInteraction(engine) {
|
|
15
|
+
await engine.addInteractor("particlesLinks", (container) => new Linker_1.Linker(container));
|
|
16
|
+
}
|
|
17
|
+
exports.loadInteraction = loadInteraction;
|
|
18
|
+
});
|
package/umd/plugin.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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", "./LinkInstance"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadPlugin = void 0;
|
|
13
|
+
const LinkInstance_1 = require("./LinkInstance");
|
|
14
|
+
class LinksPlugin {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.id = "links";
|
|
17
|
+
}
|
|
18
|
+
getPlugin(container) {
|
|
19
|
+
return new LinkInstance_1.LinkInstance(container);
|
|
20
|
+
}
|
|
21
|
+
loadOptions() {
|
|
22
|
+
}
|
|
23
|
+
needsPlugin() {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function loadPlugin(engine) {
|
|
28
|
+
const plugin = new LinksPlugin();
|
|
29
|
+
await engine.addPlugin(plugin);
|
|
30
|
+
}
|
|
31
|
+
exports.loadPlugin = loadPlugin;
|
|
32
|
+
});
|