@tsparticles/interaction-particles-links 4.5.1 → 4.5.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/browser/CircleWarp.js +14 -7
- package/browser/index.js +1 -1
- package/browser/index.lazy.js +1 -1
- package/cjs/CircleWarp.js +14 -7
- package/cjs/index.js +1 -1
- package/cjs/index.lazy.js +1 -1
- package/esm/CircleWarp.js +14 -7
- package/esm/index.js +1 -1
- package/esm/index.lazy.js +1 -1
- package/package.json +4 -4
- package/report.html +1 -1
- package/tsparticles.interaction.particles.links.js +16 -9
- package/tsparticles.interaction.particles.links.min.js +1 -1
- package/types/LinksPlugin.d.ts +1 -1
package/browser/CircleWarp.js
CHANGED
|
@@ -6,8 +6,9 @@ export class CircleWarp extends Circle {
|
|
|
6
6
|
this.#canvasSize = canvasSize;
|
|
7
7
|
}
|
|
8
8
|
contains(point) {
|
|
9
|
-
if (super.contains(point))
|
|
9
|
+
if (super.contains(point)) {
|
|
10
10
|
return true;
|
|
11
|
+
}
|
|
11
12
|
const { width, height } = this.#canvasSize, { x, y } = point;
|
|
12
13
|
return (super.contains({ x: x - width, y }) ||
|
|
13
14
|
super.contains({ x: x + width, y }) ||
|
|
@@ -19,8 +20,9 @@ export class CircleWarp extends Circle {
|
|
|
19
20
|
super.contains({ x: x + width, y: y - height }));
|
|
20
21
|
}
|
|
21
22
|
intersects(range) {
|
|
22
|
-
if (super.intersects(range))
|
|
23
|
+
if (super.intersects(range)) {
|
|
23
24
|
return true;
|
|
25
|
+
}
|
|
24
26
|
const { width, height } = this.#canvasSize, pos = range.position, shifts = [
|
|
25
27
|
{ x: -width, y: 0 },
|
|
26
28
|
{ x: width, y: 0 },
|
|
@@ -41,8 +43,9 @@ export class CircleWarp extends Circle {
|
|
|
41
43
|
const rect = range;
|
|
42
44
|
shiftedRange = new Rectangle(shiftedPos.x, shiftedPos.y, rect.size.width, rect.size.height);
|
|
43
45
|
}
|
|
44
|
-
if (super.intersects(shiftedRange))
|
|
46
|
+
if (super.intersects(shiftedRange)) {
|
|
45
47
|
return true;
|
|
48
|
+
}
|
|
46
49
|
}
|
|
47
50
|
return false;
|
|
48
51
|
}
|
|
@@ -52,14 +55,18 @@ export class CircleWarp extends Circle {
|
|
|
52
55
|
return grid.query(this);
|
|
53
56
|
}
|
|
54
57
|
const xShifts = [originPoint.x], yShifts = [originPoint.y];
|
|
55
|
-
if (crossesLeft)
|
|
58
|
+
if (crossesLeft) {
|
|
56
59
|
xShifts.push(width);
|
|
57
|
-
|
|
60
|
+
}
|
|
61
|
+
if (crossesRight) {
|
|
58
62
|
xShifts.push(-width);
|
|
59
|
-
|
|
63
|
+
}
|
|
64
|
+
if (crossesTop) {
|
|
60
65
|
yShifts.push(height);
|
|
61
|
-
|
|
66
|
+
}
|
|
67
|
+
if (crossesBottom) {
|
|
62
68
|
yShifts.push(-height);
|
|
69
|
+
}
|
|
63
70
|
const particles = new Set();
|
|
64
71
|
for (const dx of xShifts) {
|
|
65
72
|
for (const dy of yShifts) {
|
package/browser/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
import { Linker } from "./Linker.js";
|
|
3
3
|
import { LinksPlugin } from "./LinksPlugin.js";
|
|
4
4
|
export async function loadParticlesLinksInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.5.
|
|
5
|
+
engine.checkVersion("4.5.2");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
const pluginManager = e.pluginManager;
|
|
8
8
|
ensureInteractivityPluginLoaded(e);
|
package/browser/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadParticlesLinksInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.5.
|
|
2
|
+
engine.checkVersion("4.5.2");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const pluginManager = e.pluginManager, [{ ensureInteractivityPluginLoaded }, { LinksPlugin },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-interactivity/lazy"),
|
package/cjs/CircleWarp.js
CHANGED
|
@@ -6,8 +6,9 @@ export class CircleWarp extends Circle {
|
|
|
6
6
|
this.#canvasSize = canvasSize;
|
|
7
7
|
}
|
|
8
8
|
contains(point) {
|
|
9
|
-
if (super.contains(point))
|
|
9
|
+
if (super.contains(point)) {
|
|
10
10
|
return true;
|
|
11
|
+
}
|
|
11
12
|
const { width, height } = this.#canvasSize, { x, y } = point;
|
|
12
13
|
return (super.contains({ x: x - width, y }) ||
|
|
13
14
|
super.contains({ x: x + width, y }) ||
|
|
@@ -19,8 +20,9 @@ export class CircleWarp extends Circle {
|
|
|
19
20
|
super.contains({ x: x + width, y: y - height }));
|
|
20
21
|
}
|
|
21
22
|
intersects(range) {
|
|
22
|
-
if (super.intersects(range))
|
|
23
|
+
if (super.intersects(range)) {
|
|
23
24
|
return true;
|
|
25
|
+
}
|
|
24
26
|
const { width, height } = this.#canvasSize, pos = range.position, shifts = [
|
|
25
27
|
{ x: -width, y: 0 },
|
|
26
28
|
{ x: width, y: 0 },
|
|
@@ -41,8 +43,9 @@ export class CircleWarp extends Circle {
|
|
|
41
43
|
const rect = range;
|
|
42
44
|
shiftedRange = new Rectangle(shiftedPos.x, shiftedPos.y, rect.size.width, rect.size.height);
|
|
43
45
|
}
|
|
44
|
-
if (super.intersects(shiftedRange))
|
|
46
|
+
if (super.intersects(shiftedRange)) {
|
|
45
47
|
return true;
|
|
48
|
+
}
|
|
46
49
|
}
|
|
47
50
|
return false;
|
|
48
51
|
}
|
|
@@ -52,14 +55,18 @@ export class CircleWarp extends Circle {
|
|
|
52
55
|
return grid.query(this);
|
|
53
56
|
}
|
|
54
57
|
const xShifts = [originPoint.x], yShifts = [originPoint.y];
|
|
55
|
-
if (crossesLeft)
|
|
58
|
+
if (crossesLeft) {
|
|
56
59
|
xShifts.push(width);
|
|
57
|
-
|
|
60
|
+
}
|
|
61
|
+
if (crossesRight) {
|
|
58
62
|
xShifts.push(-width);
|
|
59
|
-
|
|
63
|
+
}
|
|
64
|
+
if (crossesTop) {
|
|
60
65
|
yShifts.push(height);
|
|
61
|
-
|
|
66
|
+
}
|
|
67
|
+
if (crossesBottom) {
|
|
62
68
|
yShifts.push(-height);
|
|
69
|
+
}
|
|
63
70
|
const particles = new Set();
|
|
64
71
|
for (const dx of xShifts) {
|
|
65
72
|
for (const dy of yShifts) {
|
package/cjs/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
import { Linker } from "./Linker.js";
|
|
3
3
|
import { LinksPlugin } from "./LinksPlugin.js";
|
|
4
4
|
export async function loadParticlesLinksInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.5.
|
|
5
|
+
engine.checkVersion("4.5.2");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
const pluginManager = e.pluginManager;
|
|
8
8
|
ensureInteractivityPluginLoaded(e);
|
package/cjs/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadParticlesLinksInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.5.
|
|
2
|
+
engine.checkVersion("4.5.2");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const pluginManager = e.pluginManager, [{ ensureInteractivityPluginLoaded }, { LinksPlugin },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-interactivity/lazy"),
|
package/esm/CircleWarp.js
CHANGED
|
@@ -6,8 +6,9 @@ export class CircleWarp extends Circle {
|
|
|
6
6
|
this.#canvasSize = canvasSize;
|
|
7
7
|
}
|
|
8
8
|
contains(point) {
|
|
9
|
-
if (super.contains(point))
|
|
9
|
+
if (super.contains(point)) {
|
|
10
10
|
return true;
|
|
11
|
+
}
|
|
11
12
|
const { width, height } = this.#canvasSize, { x, y } = point;
|
|
12
13
|
return (super.contains({ x: x - width, y }) ||
|
|
13
14
|
super.contains({ x: x + width, y }) ||
|
|
@@ -19,8 +20,9 @@ export class CircleWarp extends Circle {
|
|
|
19
20
|
super.contains({ x: x + width, y: y - height }));
|
|
20
21
|
}
|
|
21
22
|
intersects(range) {
|
|
22
|
-
if (super.intersects(range))
|
|
23
|
+
if (super.intersects(range)) {
|
|
23
24
|
return true;
|
|
25
|
+
}
|
|
24
26
|
const { width, height } = this.#canvasSize, pos = range.position, shifts = [
|
|
25
27
|
{ x: -width, y: 0 },
|
|
26
28
|
{ x: width, y: 0 },
|
|
@@ -41,8 +43,9 @@ export class CircleWarp extends Circle {
|
|
|
41
43
|
const rect = range;
|
|
42
44
|
shiftedRange = new Rectangle(shiftedPos.x, shiftedPos.y, rect.size.width, rect.size.height);
|
|
43
45
|
}
|
|
44
|
-
if (super.intersects(shiftedRange))
|
|
46
|
+
if (super.intersects(shiftedRange)) {
|
|
45
47
|
return true;
|
|
48
|
+
}
|
|
46
49
|
}
|
|
47
50
|
return false;
|
|
48
51
|
}
|
|
@@ -52,14 +55,18 @@ export class CircleWarp extends Circle {
|
|
|
52
55
|
return grid.query(this);
|
|
53
56
|
}
|
|
54
57
|
const xShifts = [originPoint.x], yShifts = [originPoint.y];
|
|
55
|
-
if (crossesLeft)
|
|
58
|
+
if (crossesLeft) {
|
|
56
59
|
xShifts.push(width);
|
|
57
|
-
|
|
60
|
+
}
|
|
61
|
+
if (crossesRight) {
|
|
58
62
|
xShifts.push(-width);
|
|
59
|
-
|
|
63
|
+
}
|
|
64
|
+
if (crossesTop) {
|
|
60
65
|
yShifts.push(height);
|
|
61
|
-
|
|
66
|
+
}
|
|
67
|
+
if (crossesBottom) {
|
|
62
68
|
yShifts.push(-height);
|
|
69
|
+
}
|
|
63
70
|
const particles = new Set();
|
|
64
71
|
for (const dx of xShifts) {
|
|
65
72
|
for (const dy of yShifts) {
|
package/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
import { Linker } from "./Linker.js";
|
|
3
3
|
import { LinksPlugin } from "./LinksPlugin.js";
|
|
4
4
|
export async function loadParticlesLinksInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.5.
|
|
5
|
+
engine.checkVersion("4.5.2");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
const pluginManager = e.pluginManager;
|
|
8
8
|
ensureInteractivityPluginLoaded(e);
|
package/esm/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadParticlesLinksInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.5.
|
|
2
|
+
engine.checkVersion("4.5.2");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const pluginManager = e.pluginManager, [{ ensureInteractivityPluginLoaded }, { LinksPlugin },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-interactivity/lazy"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-particles-links",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.2",
|
|
4
4
|
"description": "tsParticles links particles interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
},
|
|
98
98
|
"type": "module",
|
|
99
99
|
"peerDependencies": {
|
|
100
|
-
"@tsparticles/engine": "4.5.
|
|
101
|
-
"@tsparticles/plugin-interactivity": "4.5.
|
|
100
|
+
"@tsparticles/engine": "4.5.2",
|
|
101
|
+
"@tsparticles/plugin-interactivity": "4.5.2"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@tsparticles/canvas-utils": "4.5.
|
|
104
|
+
"@tsparticles/canvas-utils": "4.5.2"
|
|
105
105
|
}
|
|
106
106
|
}
|
package/report.html
CHANGED
|
@@ -5285,7 +5285,7 @@ var drawChart = (function (exports) {
|
|
|
5285
5285
|
</script>
|
|
5286
5286
|
<script>
|
|
5287
5287
|
/*<!--*/
|
|
5288
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.interaction.particles.links.js","children":[{"name":"dist/browser","children":[{"uid":"
|
|
5288
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.interaction.particles.links.js","children":[{"name":"dist/browser","children":[{"uid":"fdc5c6f8-1","name":"CircleWarp.js"},{"name":"Options/Classes","children":[{"uid":"fdc5c6f8-3","name":"LinksShadow.js"},{"uid":"fdc5c6f8-5","name":"LinksTriangle.js"},{"uid":"fdc5c6f8-7","name":"Links.js"}]},{"uid":"fdc5c6f8-9","name":"Linker.js"},{"uid":"fdc5c6f8-11","name":"LinksPlugin.js"},{"uid":"fdc5c6f8-13","name":"index.js"},{"uid":"fdc5c6f8-15","name":"browser.js"},{"uid":"fdc5c6f8-17","name":"Utils.js"},{"uid":"fdc5c6f8-19","name":"LinkInstance.js"}]}]}],"isRoot":true},"nodeParts":{"fdc5c6f8-1":{"renderedLength":3331,"gzipLength":0,"brotliLength":0,"metaUid":"fdc5c6f8-0"},"fdc5c6f8-3":{"renderedLength":492,"gzipLength":0,"brotliLength":0,"metaUid":"fdc5c6f8-2"},"fdc5c6f8-5":{"renderedLength":551,"gzipLength":0,"brotliLength":0,"metaUid":"fdc5c6f8-4"},"fdc5c6f8-7":{"renderedLength":1242,"gzipLength":0,"brotliLength":0,"metaUid":"fdc5c6f8-6"},"fdc5c6f8-9":{"renderedLength":4838,"gzipLength":0,"brotliLength":0,"metaUid":"fdc5c6f8-8"},"fdc5c6f8-11":{"renderedLength":487,"gzipLength":0,"brotliLength":0,"metaUid":"fdc5c6f8-10"},"fdc5c6f8-13":{"renderedLength":524,"gzipLength":0,"brotliLength":0,"metaUid":"fdc5c6f8-12"},"fdc5c6f8-15":{"renderedLength":201,"gzipLength":0,"brotliLength":0,"metaUid":"fdc5c6f8-14"},"fdc5c6f8-17":{"renderedLength":390,"gzipLength":0,"brotliLength":0,"metaUid":"fdc5c6f8-16"},"fdc5c6f8-19":{"renderedLength":7779,"gzipLength":0,"brotliLength":0,"metaUid":"fdc5c6f8-18"}},"nodeMetas":{"fdc5c6f8-0":{"id":"/dist/browser/CircleWarp.js","moduleParts":{"tsparticles.interaction.particles.links.js":"fdc5c6f8-1"},"imported":[{"uid":"fdc5c6f8-21"}],"importedBy":[{"uid":"fdc5c6f8-8"}]},"fdc5c6f8-2":{"id":"/dist/browser/Options/Classes/LinksShadow.js","moduleParts":{"tsparticles.interaction.particles.links.js":"fdc5c6f8-3"},"imported":[{"uid":"fdc5c6f8-21"}],"importedBy":[{"uid":"fdc5c6f8-12"},{"uid":"fdc5c6f8-6"}]},"fdc5c6f8-4":{"id":"/dist/browser/Options/Classes/LinksTriangle.js","moduleParts":{"tsparticles.interaction.particles.links.js":"fdc5c6f8-5"},"imported":[{"uid":"fdc5c6f8-21"}],"importedBy":[{"uid":"fdc5c6f8-12"},{"uid":"fdc5c6f8-6"}]},"fdc5c6f8-6":{"id":"/dist/browser/Options/Classes/Links.js","moduleParts":{"tsparticles.interaction.particles.links.js":"fdc5c6f8-7"},"imported":[{"uid":"fdc5c6f8-21"},{"uid":"fdc5c6f8-2"},{"uid":"fdc5c6f8-4"}],"importedBy":[{"uid":"fdc5c6f8-12"},{"uid":"fdc5c6f8-8"}]},"fdc5c6f8-8":{"id":"/dist/browser/Linker.js","moduleParts":{"tsparticles.interaction.particles.links.js":"fdc5c6f8-9"},"imported":[{"uid":"fdc5c6f8-21"},{"uid":"fdc5c6f8-0"},{"uid":"fdc5c6f8-6"},{"uid":"fdc5c6f8-20"}],"importedBy":[{"uid":"fdc5c6f8-12"}]},"fdc5c6f8-10":{"id":"/dist/browser/LinksPlugin.js","moduleParts":{"tsparticles.interaction.particles.links.js":"fdc5c6f8-11"},"imported":[{"uid":"fdc5c6f8-18","dynamic":true}],"importedBy":[{"uid":"fdc5c6f8-12"}]},"fdc5c6f8-12":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.interaction.particles.links.js":"fdc5c6f8-13"},"imported":[{"uid":"fdc5c6f8-20"},{"uid":"fdc5c6f8-8"},{"uid":"fdc5c6f8-10"},{"uid":"fdc5c6f8-6"},{"uid":"fdc5c6f8-2"},{"uid":"fdc5c6f8-4"}],"importedBy":[{"uid":"fdc5c6f8-14"}]},"fdc5c6f8-14":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.interaction.particles.links.js":"fdc5c6f8-15"},"imported":[{"uid":"fdc5c6f8-12"}],"importedBy":[],"isEntry":true},"fdc5c6f8-16":{"id":"/dist/browser/Utils.js","moduleParts":{"tsparticles.interaction.particles.links.js":"fdc5c6f8-17"},"imported":[{"uid":"fdc5c6f8-21"}],"importedBy":[{"uid":"fdc5c6f8-18"}]},"fdc5c6f8-18":{"id":"/dist/browser/LinkInstance.js","moduleParts":{"tsparticles.interaction.particles.links.js":"fdc5c6f8-19"},"imported":[{"uid":"fdc5c6f8-21"},{"uid":"fdc5c6f8-16"}],"importedBy":[{"uid":"fdc5c6f8-10"}]},"fdc5c6f8-20":{"id":"@tsparticles/plugin-interactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"fdc5c6f8-12"},{"uid":"fdc5c6f8-8"}],"isExternal":true},"fdc5c6f8-21":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"fdc5c6f8-8"},{"uid":"fdc5c6f8-6"},{"uid":"fdc5c6f8-2"},{"uid":"fdc5c6f8-4"},{"uid":"fdc5c6f8-0"},{"uid":"fdc5c6f8-18"},{"uid":"fdc5c6f8-16"}],"isExternal":true}},"env":{"rollup":"4.67.4"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
|
|
5289
5289
|
|
|
5290
5290
|
const run = () => {
|
|
5291
5291
|
const width = window.innerWidth;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
2
|
(function (g) {
|
|
3
|
-
/* Particles Interaction v4.5.
|
|
3
|
+
/* Particles Interaction v4.5.2 */
|
|
4
4
|
g.__tsParticlesInternals = g.__tsParticlesInternals || {};
|
|
5
5
|
g.__tsParticlesInternals.interactions = g.__tsParticlesInternals.interactions || {};
|
|
6
6
|
(function (exports, pluginInteractivity, engine) {
|
|
@@ -13,8 +13,9 @@ g.__tsParticlesInternals.interactions = g.__tsParticlesInternals.interactions ||
|
|
|
13
13
|
this.#canvasSize = canvasSize;
|
|
14
14
|
}
|
|
15
15
|
contains(point) {
|
|
16
|
-
if (super.contains(point))
|
|
16
|
+
if (super.contains(point)) {
|
|
17
17
|
return true;
|
|
18
|
+
}
|
|
18
19
|
const { width, height } = this.#canvasSize, { x, y } = point;
|
|
19
20
|
return (super.contains({ x: x - width, y }) ||
|
|
20
21
|
super.contains({ x: x + width, y }) ||
|
|
@@ -26,8 +27,9 @@ g.__tsParticlesInternals.interactions = g.__tsParticlesInternals.interactions ||
|
|
|
26
27
|
super.contains({ x: x + width, y: y - height }));
|
|
27
28
|
}
|
|
28
29
|
intersects(range) {
|
|
29
|
-
if (super.intersects(range))
|
|
30
|
+
if (super.intersects(range)) {
|
|
30
31
|
return true;
|
|
32
|
+
}
|
|
31
33
|
const { width, height } = this.#canvasSize, pos = range.position, shifts = [
|
|
32
34
|
{ x: -width, y: 0 },
|
|
33
35
|
{ x: width, y: 0 },
|
|
@@ -48,8 +50,9 @@ g.__tsParticlesInternals.interactions = g.__tsParticlesInternals.interactions ||
|
|
|
48
50
|
const rect = range;
|
|
49
51
|
shiftedRange = new engine.Rectangle(shiftedPos.x, shiftedPos.y, rect.size.width, rect.size.height);
|
|
50
52
|
}
|
|
51
|
-
if (super.intersects(shiftedRange))
|
|
53
|
+
if (super.intersects(shiftedRange)) {
|
|
52
54
|
return true;
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
57
|
return false;
|
|
55
58
|
}
|
|
@@ -59,14 +62,18 @@ g.__tsParticlesInternals.interactions = g.__tsParticlesInternals.interactions ||
|
|
|
59
62
|
return grid.query(this);
|
|
60
63
|
}
|
|
61
64
|
const xShifts = [engine.originPoint.x], yShifts = [engine.originPoint.y];
|
|
62
|
-
if (crossesLeft)
|
|
65
|
+
if (crossesLeft) {
|
|
63
66
|
xShifts.push(width);
|
|
64
|
-
|
|
67
|
+
}
|
|
68
|
+
if (crossesRight) {
|
|
65
69
|
xShifts.push(-width);
|
|
66
|
-
|
|
70
|
+
}
|
|
71
|
+
if (crossesTop) {
|
|
67
72
|
yShifts.push(height);
|
|
68
|
-
|
|
73
|
+
}
|
|
74
|
+
if (crossesBottom) {
|
|
69
75
|
yShifts.push(-height);
|
|
76
|
+
}
|
|
70
77
|
const particles = new Set();
|
|
71
78
|
for (const dx of xShifts) {
|
|
72
79
|
for (const dy of yShifts) {
|
|
@@ -276,7 +283,7 @@ g.__tsParticlesInternals.interactions = g.__tsParticlesInternals.interactions ||
|
|
|
276
283
|
}
|
|
277
284
|
|
|
278
285
|
async function loadParticlesLinksInteraction(engine) {
|
|
279
|
-
engine.checkVersion("4.5.
|
|
286
|
+
engine.checkVersion("4.5.2");
|
|
280
287
|
await engine.pluginManager.register((e) => {
|
|
281
288
|
const pluginManager = e.pluginManager;
|
|
282
289
|
pluginInteractivity.ensureInteractivityPluginLoaded(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var s="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,s){return s in t||(t[s]={}),t[s]}})}:function(t){return t};t.__tsParticlesInternals.bundles=s(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=s(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=s(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=s(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=s(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=s(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=s(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=s(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=s(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=s(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=s(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=s(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=s(t.__tsParticlesInternals.path)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},function(t,s,n){"use strict";class e extends n.Circle{#t;constructor(t,s,n,e){super(t,s,n),this.#t=e}contains(t){if(super.contains(t))return!0;const{width:s,height:n}=this.#t,{x:e,y:i}=t;return super.contains({x:e-s,y:i})||super.contains({x:e+s,y:i})||super.contains({x:e,y:i-n})||super.contains({x:e,y:i+n})||super.contains({x:e-s,y:i-n})||super.contains({x:e+s,y:i+n})||super.contains({x:e-s,y:i+n})||super.contains({x:e+s,y:i-n})}intersects(t){if(super.intersects(t))return!0;const{width:s,height:e}=this.#t,i=t.position,r=[{x:-s,y:0},{x:s,y:0},{x:0,y:-e},{x:0,y:e},{x:-s,y:-e},{x:s,y:e},{x:-s,y:e},{x:s,y:-e}];for(const s of r){const e={x:i.x+s.x,y:i.y+s.y};let r;if(t instanceof n.Circle)r=new n.Circle(e.x,e.y,t.radius);else{const s=t;r=new n.Rectangle(e.x,e.y,s.size.width,s.size.height)}if(super.intersects(r))return!0}return!1}query(t){const{x:s,y:e}=this.position,{width:i,height:r}=this.#t,a=this.radius,l=s-a<=n.originPoint.x,o=s+a>=i,c=e-a<=n.originPoint.y,h=e+a>=r;if(!(l||o||c||h))return t.query(this);const p=[n.originPoint.x],_=[n.originPoint.y];l&&p.push(i),o&&p.push(-i),c&&_.push(r),h&&_.push(-r);const u=new Set;for(const n of p)for(const i of _)for(const r of t.queryCircle({x:s+n,y:e+i},a))u.add(r);return[...u]}}class i{blur=5;color=new n.OptionsColor;enable=!1;constructor(){this.color.value="#000"}load(t){n.isNull(t)||(n.loadProperty(this,"blur",t.blur),this.color=n.OptionsColor.create(this.color,t.color),n.loadProperty(this,"enable",t.enable))}}class r{color;enable=!1;frequency=1;opacity;load(t){n.isNull(t)||(void 0!==t.color&&(this.color=n.OptionsColor.create(this.color,t.color)),n.loadProperty(this,"enable",t.enable),n.loadProperty(this,"frequency",t.frequency),n.loadProperty(this,"opacity",t.opacity))}}class a{blink=!1;color=new n.OptionsColor;consent=!1;distance=100;enable=!1;frequency=1;id;opacity=1;shadow=new i;triangles=new r;warp=!1;width=1;constructor(){this.color.value="#fff"}load(t){n.isNull(t)||(n.loadProperty(this,"id",t.id),n.loadProperty(this,"blink",t.blink),this.color=n.OptionsColor.create(this.color,t.color),n.loadProperty(this,"consent",t.consent),n.loadProperty(this,"distance",t.distance),n.loadProperty(this,"enable",t.enable),n.loadProperty(this,"frequency",t.frequency),n.loadProperty(this,"opacity",t.opacity),this.shadow.load(t.shadow),this.triangles.load(t.triangles),n.loadProperty(this,"width",t.width),n.loadProperty(this,"warp",t.warp))}}function l(t,s,e){const{dx:i,dy:r}=n.getDistances(t,s),a={x:Math.abs(i),y:Math.abs(r)},l={x:Math.min(a.x,e.width-a.x),y:Math.min(a.y,e.height-a.y)};return Math.hypot(l.x,l.y)}class o extends s.ParticlesInteractorBase{#s;#n;constructor(t,s){super(s),this.#n=t,this.#s=0}get maxDistance(){return this.#s}clear(){}init(){this.container.particles.linksColor=void 0,this.container.particles.linksColors=new Map}interact(t){if(!t.options.links)return;t.links=[],t.linksDistance&&t.linksDistance>this.#s&&(this.#s=t.linksDistance);const s=t.getPosition(),i=this.container,r=i.canvas.size;if(s.x<n.originPoint.x||s.y<n.originPoint.y||s.x>r.width||s.y>r.height)return;const a=t.options.links,o=a.opacity,c=t.retina.linksDistance??0,h=a.warp,p=h?new e(s.x,s.y,c,r).query(i.particles.grid):i.particles.grid.queryCircle(s,c);for(const e of p){const i=e.options.links;if(t===e||!i?.enable||a.id!==i.id||e.spawning||e.destroyed||!e.links||t.links.some(t=>t.destination===e)||e.links.some(s=>s.destination===t))continue;const p=e.getPosition();if(p.x<n.originPoint.x||p.y<n.originPoint.y||p.x>r.width||p.y>r.height)continue;const _=n.getDistances(s,p).distance,u=h&&i.warp?l(s,p,r):_,d=Math.min(_,u);if(d>c)continue;const g=(1-d/c)*o;this.#e(t),t.links.push({destination:e,opacity:g,color:this.#i(t,e),isWarped:u<_})}}isEnabled(t){return!!t.options.links?.enable}loadParticlesOptions(t,...s){n.loadOptionProperty(t,"links",a,...s)}reset(){}#i(t,s){const e=this.container,i=t.options.links;if(!i)return;const r=void 0!==i.id?e.particles.linksColors.get(i.id):e.particles.linksColor;return n.getLinkColor(t,s,r,e.hdr)}#e(t){if(!t.options.links)return;const s=this.container,e=t.options.links;let i=void 0===e.id?s.particles.linksColor:s.particles.linksColors.get(e.id);i||(i=n.getLinkRandomColor(this.#n,e.color,e.blink,e.consent),void 0===e.id?s.particles.linksColor=i:s.particles.linksColors.set(e.id,i))}}class c{id="links";#n;constructor(t){this.#n=t}async getPlugin(t){const{LinkInstance:s}=await Promise.resolve().then(function(){return u});return new s(this.#n,t)}loadOptions(){}needsPlugin(){return!0}}async function h(t){t.checkVersion("4.5.1"),await t.pluginManager.register(t=>{const n=t.pluginManager;s.ensureInteractivityPluginLoaded(t),n.addPlugin(new c(n)),n.addInteractor?.("particlesLinks",t=>Promise.resolve(new o(n,t)))})}const p=globalThis;function _(t,s){const e=(i=t.map(t=>t.id),[...i].sort((t,s)=>t-s).join("_"));var i;let r=s.get(e);return void 0===r&&(r=n.getRandom(),s.set(e,r)),r}p.__tsParticlesInternals=p.__tsParticlesInternals??{},p.loadParticlesLinksInteraction=h;var u=Object.freeze({__proto__:null,LinkInstance:class{#r=new Map;#a;#l;#n;constructor(t,s){this.#n=t,this.#a=s,this.#l={links:new Map,triangles:new Map}}drawParticle(t,s){const{links:e,options:i}=s;if(!e?.length||!i.links)return;const r=i.links,a=s.retina.linksWidth??0,l=s.getPosition(),o=s.options.twinkle?.links,c=r.triangles.enable,h=c?new Set(e.map(t=>t.destination.id)):null,p=t.globalAlpha;let _="",u=-1,d=-1,g=!1;const P=()=>{g&&(t.stroke(),g=!1)};for(const p of e){if(r.frequency<1&&this.#o(s,p.destination)>r.frequency)continue;const e=p.destination.getPosition();if(c&&!p.isWarped&&h&&(P(),this.#c(i,s,p,h,l,e,t)),p.opacity<=0||a<=0)continue;if(!r.enable)continue;let y=p.opacity,f=p.color;const I=o?.enable&&n.getRandom()<o.frequency?n.rangeColorToRgb(this.#n,o.color):void 0;if(o&&I&&(f=I,y=n.getRangeValue(o.opacity)),!f){const t=void 0!==r.id?this.#a.particles.linksColors.get(r.id):this.#a.particles.linksColor;f=n.getLinkColor(s,p.destination,t)}if(!f)continue;const k=this.#h(f);if(k===_&&a===u&&y===d||(P(),t.strokeStyle=k,t.lineWidth=a,t.globalAlpha=y,_=k,u=a,d=y,t.beginPath(),g=!0),p.isWarped){const s=this.#a.canvas.size,i=e.x-l.x,r=e.y-l.y;let a=n.originPoint.x,o=n.originPoint.y;Math.abs(i)>s.width*n.half&&(a=i>0?-s.width:s.width),Math.abs(r)>s.height*n.half&&(o=r>0?-s.height:s.height),t.moveTo(l.x,l.y),t.lineTo(e.x+a,e.y+o),t.moveTo(l.x-a,l.y-o),t.lineTo(e.x,e.y)}else t.moveTo(l.x,l.y),t.lineTo(e.x,e.y)}P(),t.globalAlpha=p}init(){return this.#l.links.clear(),this.#l.triangles.clear(),this.#r.clear(),Promise.resolve()}particleCreated(t){if(t.links=[],!t.options.links)return;t.linksDistance=t.options.links.distance,t.linksWidth=t.options.links.width;const s=this.#a.retina.pixelRatio;t.retina.linksDistance=t.linksDistance*s,t.retina.linksWidth=t.linksWidth*s}particleDestroyed(t){t.links=[]}#c(t,s,e,i,r,a,l){const o=e.destination,c=t.links?.triangles;if(!c?.enable||!o.options.links?.triangles.enable)return;const h=o.links;if(h?.length)for(const p of h){if(p.isWarped||this.#o(o,p.destination)>o.options.links.frequency||!i.has(p.destination.id))continue;const h=p.destination;if(this.#p(s,o,h)>(t.links?.triangles.frequency??0))continue;const _=c.opacity??(e.opacity+p.opacity)*n.half,u=n.rangeColorToRgb(this.#n,c.color)??e.color;if(!u||_<=0)continue;const d=h.getPosition();l.save(),l.fillStyle=this.#h(u),l.globalAlpha=_,l.beginPath(),l.moveTo(r.x,r.y),l.lineTo(a.x,a.y),l.lineTo(d.x,d.y),l.closePath(),l.fill(),l.restore()}}#h(t){const s=`${t.r},${t.g},${t.b}-${this.#a.hdr}-${this.#a.peakNits}-${this.#a.hdrMode}`;let e=this.#r.get(s);return e||(e=n.getStyleFromRgb(t,this.#a.hdr,void 0,this.#a.peakNits,this.#a.hdrMode),this.#r.set(s,e)),e}#o(t,s){return _([t,s],this.#l.links)}#p(t,s,n){return _([t,s,n],this.#l.triangles)}}});t.Links=a,t.LinksShadow=i,t.LinksTriangle=r,t.loadParticlesLinksInteraction=h}(t.__tsParticlesInternals.interactions.particlesLinks=t.__tsParticlesInternals.interactions.particlesLinks||{},t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:self),Object.assign(globalThis.window||globalThis,{loadParticlesLinksInteraction:(globalThis.__tsParticlesInternals.interactions.particlesLinks||{}).loadParticlesLinksInteraction});
|
|
1
|
+
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var s="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,s){return s in t||(t[s]={}),t[s]}})}:function(t){return t};t.__tsParticlesInternals.bundles=s(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=s(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=s(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=s(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=s(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=s(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=s(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=s(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=s(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=s(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=s(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=s(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=s(t.__tsParticlesInternals.path)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},function(t,s,n){"use strict";class e extends n.Circle{#t;constructor(t,s,n,e){super(t,s,n),this.#t=e}contains(t){if(super.contains(t))return!0;const{width:s,height:n}=this.#t,{x:e,y:i}=t;return super.contains({x:e-s,y:i})||super.contains({x:e+s,y:i})||super.contains({x:e,y:i-n})||super.contains({x:e,y:i+n})||super.contains({x:e-s,y:i-n})||super.contains({x:e+s,y:i+n})||super.contains({x:e-s,y:i+n})||super.contains({x:e+s,y:i-n})}intersects(t){if(super.intersects(t))return!0;const{width:s,height:e}=this.#t,i=t.position,r=[{x:-s,y:0},{x:s,y:0},{x:0,y:-e},{x:0,y:e},{x:-s,y:-e},{x:s,y:e},{x:-s,y:e},{x:s,y:-e}];for(const s of r){const e={x:i.x+s.x,y:i.y+s.y};let r;if(t instanceof n.Circle)r=new n.Circle(e.x,e.y,t.radius);else{const s=t;r=new n.Rectangle(e.x,e.y,s.size.width,s.size.height)}if(super.intersects(r))return!0}return!1}query(t){const{x:s,y:e}=this.position,{width:i,height:r}=this.#t,a=this.radius,l=s-a<=n.originPoint.x,o=s+a>=i,c=e-a<=n.originPoint.y,h=e+a>=r;if(!(l||o||c||h))return t.query(this);const p=[n.originPoint.x],_=[n.originPoint.y];l&&p.push(i),o&&p.push(-i),c&&_.push(r),h&&_.push(-r);const u=new Set;for(const n of p)for(const i of _)for(const r of t.queryCircle({x:s+n,y:e+i},a))u.add(r);return[...u]}}class i{blur=5;color=new n.OptionsColor;enable=!1;constructor(){this.color.value="#000"}load(t){n.isNull(t)||(n.loadProperty(this,"blur",t.blur),this.color=n.OptionsColor.create(this.color,t.color),n.loadProperty(this,"enable",t.enable))}}class r{color;enable=!1;frequency=1;opacity;load(t){n.isNull(t)||(void 0!==t.color&&(this.color=n.OptionsColor.create(this.color,t.color)),n.loadProperty(this,"enable",t.enable),n.loadProperty(this,"frequency",t.frequency),n.loadProperty(this,"opacity",t.opacity))}}class a{blink=!1;color=new n.OptionsColor;consent=!1;distance=100;enable=!1;frequency=1;id;opacity=1;shadow=new i;triangles=new r;warp=!1;width=1;constructor(){this.color.value="#fff"}load(t){n.isNull(t)||(n.loadProperty(this,"id",t.id),n.loadProperty(this,"blink",t.blink),this.color=n.OptionsColor.create(this.color,t.color),n.loadProperty(this,"consent",t.consent),n.loadProperty(this,"distance",t.distance),n.loadProperty(this,"enable",t.enable),n.loadProperty(this,"frequency",t.frequency),n.loadProperty(this,"opacity",t.opacity),this.shadow.load(t.shadow),this.triangles.load(t.triangles),n.loadProperty(this,"width",t.width),n.loadProperty(this,"warp",t.warp))}}function l(t,s,e){const{dx:i,dy:r}=n.getDistances(t,s),a={x:Math.abs(i),y:Math.abs(r)},l={x:Math.min(a.x,e.width-a.x),y:Math.min(a.y,e.height-a.y)};return Math.hypot(l.x,l.y)}class o extends s.ParticlesInteractorBase{#s;#n;constructor(t,s){super(s),this.#n=t,this.#s=0}get maxDistance(){return this.#s}clear(){}init(){this.container.particles.linksColor=void 0,this.container.particles.linksColors=new Map}interact(t){if(!t.options.links)return;t.links=[],t.linksDistance&&t.linksDistance>this.#s&&(this.#s=t.linksDistance);const s=t.getPosition(),i=this.container,r=i.canvas.size;if(s.x<n.originPoint.x||s.y<n.originPoint.y||s.x>r.width||s.y>r.height)return;const a=t.options.links,o=a.opacity,c=t.retina.linksDistance??0,h=a.warp,p=h?new e(s.x,s.y,c,r).query(i.particles.grid):i.particles.grid.queryCircle(s,c);for(const e of p){const i=e.options.links;if(t===e||!i?.enable||a.id!==i.id||e.spawning||e.destroyed||!e.links||t.links.some(t=>t.destination===e)||e.links.some(s=>s.destination===t))continue;const p=e.getPosition();if(p.x<n.originPoint.x||p.y<n.originPoint.y||p.x>r.width||p.y>r.height)continue;const _=n.getDistances(s,p).distance,u=h&&i.warp?l(s,p,r):_,d=Math.min(_,u);if(d>c)continue;const g=(1-d/c)*o;this.#e(t),t.links.push({destination:e,opacity:g,color:this.#i(t,e),isWarped:u<_})}}isEnabled(t){return!!t.options.links?.enable}loadParticlesOptions(t,...s){n.loadOptionProperty(t,"links",a,...s)}reset(){}#i(t,s){const e=this.container,i=t.options.links;if(!i)return;const r=void 0!==i.id?e.particles.linksColors.get(i.id):e.particles.linksColor;return n.getLinkColor(t,s,r,e.hdr)}#e(t){if(!t.options.links)return;const s=this.container,e=t.options.links;let i=void 0===e.id?s.particles.linksColor:s.particles.linksColors.get(e.id);i||(i=n.getLinkRandomColor(this.#n,e.color,e.blink,e.consent),void 0===e.id?s.particles.linksColor=i:s.particles.linksColors.set(e.id,i))}}class c{id="links";#n;constructor(t){this.#n=t}async getPlugin(t){const{LinkInstance:s}=await Promise.resolve().then(function(){return u});return new s(this.#n,t)}loadOptions(){}needsPlugin(){return!0}}async function h(t){t.checkVersion("4.5.2"),await t.pluginManager.register(t=>{const n=t.pluginManager;s.ensureInteractivityPluginLoaded(t),n.addPlugin(new c(n)),n.addInteractor?.("particlesLinks",t=>Promise.resolve(new o(n,t)))})}const p=globalThis;function _(t,s){const e=(i=t.map(t=>t.id),[...i].sort((t,s)=>t-s).join("_"));var i;let r=s.get(e);return void 0===r&&(r=n.getRandom(),s.set(e,r)),r}p.__tsParticlesInternals=p.__tsParticlesInternals??{},p.loadParticlesLinksInteraction=h;var u=Object.freeze({__proto__:null,LinkInstance:class{#r=new Map;#a;#l;#n;constructor(t,s){this.#n=t,this.#a=s,this.#l={links:new Map,triangles:new Map}}drawParticle(t,s){const{links:e,options:i}=s;if(!e?.length||!i.links)return;const r=i.links,a=s.retina.linksWidth??0,l=s.getPosition(),o=s.options.twinkle?.links,c=r.triangles.enable,h=c?new Set(e.map(t=>t.destination.id)):null,p=t.globalAlpha;let _="",u=-1,d=-1,g=!1;const P=()=>{g&&(t.stroke(),g=!1)};for(const p of e){if(r.frequency<1&&this.#o(s,p.destination)>r.frequency)continue;const e=p.destination.getPosition();if(c&&!p.isWarped&&h&&(P(),this.#c(i,s,p,h,l,e,t)),p.opacity<=0||a<=0)continue;if(!r.enable)continue;let y=p.opacity,f=p.color;const I=o?.enable&&n.getRandom()<o.frequency?n.rangeColorToRgb(this.#n,o.color):void 0;if(o&&I&&(f=I,y=n.getRangeValue(o.opacity)),!f){const t=void 0!==r.id?this.#a.particles.linksColors.get(r.id):this.#a.particles.linksColor;f=n.getLinkColor(s,p.destination,t)}if(!f)continue;const k=this.#h(f);if(k===_&&a===u&&y===d||(P(),t.strokeStyle=k,t.lineWidth=a,t.globalAlpha=y,_=k,u=a,d=y,t.beginPath(),g=!0),p.isWarped){const s=this.#a.canvas.size,i=e.x-l.x,r=e.y-l.y;let a=n.originPoint.x,o=n.originPoint.y;Math.abs(i)>s.width*n.half&&(a=i>0?-s.width:s.width),Math.abs(r)>s.height*n.half&&(o=r>0?-s.height:s.height),t.moveTo(l.x,l.y),t.lineTo(e.x+a,e.y+o),t.moveTo(l.x-a,l.y-o),t.lineTo(e.x,e.y)}else t.moveTo(l.x,l.y),t.lineTo(e.x,e.y)}P(),t.globalAlpha=p}init(){return this.#l.links.clear(),this.#l.triangles.clear(),this.#r.clear(),Promise.resolve()}particleCreated(t){if(t.links=[],!t.options.links)return;t.linksDistance=t.options.links.distance,t.linksWidth=t.options.links.width;const s=this.#a.retina.pixelRatio;t.retina.linksDistance=t.linksDistance*s,t.retina.linksWidth=t.linksWidth*s}particleDestroyed(t){t.links=[]}#c(t,s,e,i,r,a,l){const o=e.destination,c=t.links?.triangles;if(!c?.enable||!o.options.links?.triangles.enable)return;const h=o.links;if(h?.length)for(const p of h){if(p.isWarped||this.#o(o,p.destination)>o.options.links.frequency||!i.has(p.destination.id))continue;const h=p.destination;if(this.#p(s,o,h)>(t.links?.triangles.frequency??0))continue;const _=c.opacity??(e.opacity+p.opacity)*n.half,u=n.rangeColorToRgb(this.#n,c.color)??e.color;if(!u||_<=0)continue;const d=h.getPosition();l.save(),l.fillStyle=this.#h(u),l.globalAlpha=_,l.beginPath(),l.moveTo(r.x,r.y),l.lineTo(a.x,a.y),l.lineTo(d.x,d.y),l.closePath(),l.fill(),l.restore()}}#h(t){const s=`${t.r},${t.g},${t.b}-${this.#a.hdr}-${this.#a.peakNits}-${this.#a.hdrMode}`;let e=this.#r.get(s);return e||(e=n.getStyleFromRgb(t,this.#a.hdr,void 0,this.#a.peakNits,this.#a.hdrMode),this.#r.set(s,e)),e}#o(t,s){return _([t,s],this.#l.links)}#p(t,s,n){return _([t,s,n],this.#l.triangles)}}});t.Links=a,t.LinksShadow=i,t.LinksTriangle=r,t.loadParticlesLinksInteraction=h}(t.__tsParticlesInternals.interactions.particlesLinks=t.__tsParticlesInternals.interactions.particlesLinks||{},t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:self),Object.assign(globalThis.window||globalThis,{loadParticlesLinksInteraction:(globalThis.__tsParticlesInternals.interactions.particlesLinks||{}).loadParticlesLinksInteraction});
|
package/types/LinksPlugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IPlugin, PluginManager } from "@tsparticles/engine";
|
|
2
2
|
import type { LinkContainer } from "./Types.js";
|
|
3
3
|
import type { LinkInstance } from "./LinkInstance.js";
|
|
4
4
|
export declare class LinksPlugin implements IPlugin {
|