@tsparticles/interaction-external-attract 4.1.2 → 4.2.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/browser/Attractor.js +2 -5
- package/browser/Options/Classes/Attract.js +11 -25
- package/browser/index.js +1 -1
- package/browser/index.lazy.js +1 -1
- package/cjs/Attractor.js +2 -5
- package/cjs/Options/Classes/Attract.js +11 -25
- package/cjs/index.js +1 -1
- package/cjs/index.lazy.js +1 -1
- package/esm/Attractor.js +2 -5
- package/esm/Options/Classes/Attract.js +11 -25
- package/esm/index.js +1 -1
- package/esm/index.lazy.js +1 -1
- package/package.json +3 -3
- package/report.html +1 -1
- package/tsparticles.interaction.external.attract.js +13 -30
- package/tsparticles.interaction.external.attract.min.js +1 -1
- package/types/Options/Classes/Attract.d.ts +2 -2
- package/types/Options/Classes/AttractOptions.d.ts +4 -2
- package/types/Options/Interfaces/IAttract.d.ts +1 -2
package/browser/Attractor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExternalInteractorBase, mouseMoveEvent, } from "@tsparticles/plugin-interactivity";
|
|
2
|
-
import { isInArray, millisecondsToSeconds } from "@tsparticles/engine";
|
|
2
|
+
import { isInArray, loadOptionProperty, millisecondsToSeconds, } from "@tsparticles/engine";
|
|
3
3
|
import { clickAttract, hoverAttract } from "./Utils.js";
|
|
4
4
|
import { Attract } from "./Options/Classes/Attract.js";
|
|
5
5
|
const attractMode = "attract", minVelocityLengthSq = 0, minRestoreSpeed = 0.001, maxRestoreSpeed = 1, restoreEpsilon = 0.5;
|
|
@@ -82,10 +82,7 @@ export class Attractor extends ExternalInteractorBase {
|
|
|
82
82
|
return isInArray(attractMode, hoverMode) || isInArray(attractMode, clickMode);
|
|
83
83
|
}
|
|
84
84
|
loadModeOptions(options, ...sources) {
|
|
85
|
-
options
|
|
86
|
-
for (const source of sources) {
|
|
87
|
-
options.attract.load(source?.attract);
|
|
88
|
-
}
|
|
85
|
+
loadOptionProperty(options, "attract", Attract, ...sources);
|
|
89
86
|
}
|
|
90
87
|
reset() {
|
|
91
88
|
}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class Attract {
|
|
3
|
-
distance;
|
|
4
|
-
duration;
|
|
5
|
-
easing;
|
|
6
|
-
factor;
|
|
7
|
-
maxSpeed;
|
|
3
|
+
distance = 200;
|
|
4
|
+
duration = 0.4;
|
|
5
|
+
easing = "ease-out-quad";
|
|
6
|
+
factor = 1;
|
|
7
|
+
maxSpeed = 50;
|
|
8
8
|
restore;
|
|
9
|
-
speed;
|
|
9
|
+
speed = 1;
|
|
10
10
|
constructor() {
|
|
11
|
-
this.distance = 200;
|
|
12
|
-
this.duration = 0.4;
|
|
13
|
-
this.easing = EasingType.easeOutQuad;
|
|
14
|
-
this.factor = 1;
|
|
15
|
-
this.maxSpeed = 50;
|
|
16
|
-
this.speed = 1;
|
|
17
11
|
this.restore = {
|
|
18
12
|
enable: false,
|
|
19
13
|
delay: 0,
|
|
@@ -25,24 +19,16 @@ export class Attract {
|
|
|
25
19
|
if (isNull(data)) {
|
|
26
20
|
return;
|
|
27
21
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
if (data.duration !== undefined) {
|
|
32
|
-
this.duration = data.duration;
|
|
33
|
-
}
|
|
22
|
+
loadProperty(this, "distance", data.distance);
|
|
23
|
+
loadProperty(this, "duration", data.duration);
|
|
34
24
|
if (data.easing !== undefined) {
|
|
35
25
|
this.easing = data.easing;
|
|
36
26
|
}
|
|
37
|
-
|
|
38
|
-
this.factor = data.factor;
|
|
39
|
-
}
|
|
27
|
+
loadProperty(this, "factor", data.factor);
|
|
40
28
|
if (data.maxSpeed !== undefined) {
|
|
41
29
|
this.maxSpeed = data.maxSpeed;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
|
-
this.speed = data.speed;
|
|
45
|
-
}
|
|
31
|
+
loadProperty(this, "speed", data.speed);
|
|
46
32
|
if (data.restore !== undefined) {
|
|
47
33
|
this.restore.enable = data.restore.enable ?? this.restore.enable;
|
|
48
34
|
this.restore.delay = data.restore.delay ?? this.restore.delay;
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivity";
|
|
2
2
|
import { Attractor } from "./Attractor.js";
|
|
3
3
|
export async function loadExternalAttractInteraction(engine) {
|
|
4
|
-
engine.checkVersion("4.
|
|
4
|
+
engine.checkVersion("4.2.0");
|
|
5
5
|
await engine.pluginManager.register((e) => {
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
|
7
7
|
e.pluginManager.addInteractor?.("externalAttract", container => {
|
package/browser/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadExternalAttractInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.
|
|
2
|
+
engine.checkVersion("4.2.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
5
5
|
ensureInteractivityPluginLoaded(e);
|
package/cjs/Attractor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExternalInteractorBase, mouseMoveEvent, } from "@tsparticles/plugin-interactivity";
|
|
2
|
-
import { isInArray, millisecondsToSeconds } from "@tsparticles/engine";
|
|
2
|
+
import { isInArray, loadOptionProperty, millisecondsToSeconds, } from "@tsparticles/engine";
|
|
3
3
|
import { clickAttract, hoverAttract } from "./Utils.js";
|
|
4
4
|
import { Attract } from "./Options/Classes/Attract.js";
|
|
5
5
|
const attractMode = "attract", minVelocityLengthSq = 0, minRestoreSpeed = 0.001, maxRestoreSpeed = 1, restoreEpsilon = 0.5;
|
|
@@ -82,10 +82,7 @@ export class Attractor extends ExternalInteractorBase {
|
|
|
82
82
|
return isInArray(attractMode, hoverMode) || isInArray(attractMode, clickMode);
|
|
83
83
|
}
|
|
84
84
|
loadModeOptions(options, ...sources) {
|
|
85
|
-
options
|
|
86
|
-
for (const source of sources) {
|
|
87
|
-
options.attract.load(source?.attract);
|
|
88
|
-
}
|
|
85
|
+
loadOptionProperty(options, "attract", Attract, ...sources);
|
|
89
86
|
}
|
|
90
87
|
reset() {
|
|
91
88
|
}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class Attract {
|
|
3
|
-
distance;
|
|
4
|
-
duration;
|
|
5
|
-
easing;
|
|
6
|
-
factor;
|
|
7
|
-
maxSpeed;
|
|
3
|
+
distance = 200;
|
|
4
|
+
duration = 0.4;
|
|
5
|
+
easing = "ease-out-quad";
|
|
6
|
+
factor = 1;
|
|
7
|
+
maxSpeed = 50;
|
|
8
8
|
restore;
|
|
9
|
-
speed;
|
|
9
|
+
speed = 1;
|
|
10
10
|
constructor() {
|
|
11
|
-
this.distance = 200;
|
|
12
|
-
this.duration = 0.4;
|
|
13
|
-
this.easing = EasingType.easeOutQuad;
|
|
14
|
-
this.factor = 1;
|
|
15
|
-
this.maxSpeed = 50;
|
|
16
|
-
this.speed = 1;
|
|
17
11
|
this.restore = {
|
|
18
12
|
enable: false,
|
|
19
13
|
delay: 0,
|
|
@@ -25,24 +19,16 @@ export class Attract {
|
|
|
25
19
|
if (isNull(data)) {
|
|
26
20
|
return;
|
|
27
21
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
if (data.duration !== undefined) {
|
|
32
|
-
this.duration = data.duration;
|
|
33
|
-
}
|
|
22
|
+
loadProperty(this, "distance", data.distance);
|
|
23
|
+
loadProperty(this, "duration", data.duration);
|
|
34
24
|
if (data.easing !== undefined) {
|
|
35
25
|
this.easing = data.easing;
|
|
36
26
|
}
|
|
37
|
-
|
|
38
|
-
this.factor = data.factor;
|
|
39
|
-
}
|
|
27
|
+
loadProperty(this, "factor", data.factor);
|
|
40
28
|
if (data.maxSpeed !== undefined) {
|
|
41
29
|
this.maxSpeed = data.maxSpeed;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
|
-
this.speed = data.speed;
|
|
45
|
-
}
|
|
31
|
+
loadProperty(this, "speed", data.speed);
|
|
46
32
|
if (data.restore !== undefined) {
|
|
47
33
|
this.restore.enable = data.restore.enable ?? this.restore.enable;
|
|
48
34
|
this.restore.delay = data.restore.delay ?? this.restore.delay;
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivity";
|
|
2
2
|
import { Attractor } from "./Attractor.js";
|
|
3
3
|
export async function loadExternalAttractInteraction(engine) {
|
|
4
|
-
engine.checkVersion("4.
|
|
4
|
+
engine.checkVersion("4.2.0");
|
|
5
5
|
await engine.pluginManager.register((e) => {
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
|
7
7
|
e.pluginManager.addInteractor?.("externalAttract", container => {
|
package/cjs/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadExternalAttractInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.
|
|
2
|
+
engine.checkVersion("4.2.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
5
5
|
ensureInteractivityPluginLoaded(e);
|
package/esm/Attractor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExternalInteractorBase, mouseMoveEvent, } from "@tsparticles/plugin-interactivity";
|
|
2
|
-
import { isInArray, millisecondsToSeconds } from "@tsparticles/engine";
|
|
2
|
+
import { isInArray, loadOptionProperty, millisecondsToSeconds, } from "@tsparticles/engine";
|
|
3
3
|
import { clickAttract, hoverAttract } from "./Utils.js";
|
|
4
4
|
import { Attract } from "./Options/Classes/Attract.js";
|
|
5
5
|
const attractMode = "attract", minVelocityLengthSq = 0, minRestoreSpeed = 0.001, maxRestoreSpeed = 1, restoreEpsilon = 0.5;
|
|
@@ -82,10 +82,7 @@ export class Attractor extends ExternalInteractorBase {
|
|
|
82
82
|
return isInArray(attractMode, hoverMode) || isInArray(attractMode, clickMode);
|
|
83
83
|
}
|
|
84
84
|
loadModeOptions(options, ...sources) {
|
|
85
|
-
options
|
|
86
|
-
for (const source of sources) {
|
|
87
|
-
options.attract.load(source?.attract);
|
|
88
|
-
}
|
|
85
|
+
loadOptionProperty(options, "attract", Attract, ...sources);
|
|
89
86
|
}
|
|
90
87
|
reset() {
|
|
91
88
|
}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isNull, loadProperty } from "@tsparticles/engine";
|
|
2
2
|
export class Attract {
|
|
3
|
-
distance;
|
|
4
|
-
duration;
|
|
5
|
-
easing;
|
|
6
|
-
factor;
|
|
7
|
-
maxSpeed;
|
|
3
|
+
distance = 200;
|
|
4
|
+
duration = 0.4;
|
|
5
|
+
easing = "ease-out-quad";
|
|
6
|
+
factor = 1;
|
|
7
|
+
maxSpeed = 50;
|
|
8
8
|
restore;
|
|
9
|
-
speed;
|
|
9
|
+
speed = 1;
|
|
10
10
|
constructor() {
|
|
11
|
-
this.distance = 200;
|
|
12
|
-
this.duration = 0.4;
|
|
13
|
-
this.easing = EasingType.easeOutQuad;
|
|
14
|
-
this.factor = 1;
|
|
15
|
-
this.maxSpeed = 50;
|
|
16
|
-
this.speed = 1;
|
|
17
11
|
this.restore = {
|
|
18
12
|
enable: false,
|
|
19
13
|
delay: 0,
|
|
@@ -25,24 +19,16 @@ export class Attract {
|
|
|
25
19
|
if (isNull(data)) {
|
|
26
20
|
return;
|
|
27
21
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
if (data.duration !== undefined) {
|
|
32
|
-
this.duration = data.duration;
|
|
33
|
-
}
|
|
22
|
+
loadProperty(this, "distance", data.distance);
|
|
23
|
+
loadProperty(this, "duration", data.duration);
|
|
34
24
|
if (data.easing !== undefined) {
|
|
35
25
|
this.easing = data.easing;
|
|
36
26
|
}
|
|
37
|
-
|
|
38
|
-
this.factor = data.factor;
|
|
39
|
-
}
|
|
27
|
+
loadProperty(this, "factor", data.factor);
|
|
40
28
|
if (data.maxSpeed !== undefined) {
|
|
41
29
|
this.maxSpeed = data.maxSpeed;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
|
-
this.speed = data.speed;
|
|
45
|
-
}
|
|
31
|
+
loadProperty(this, "speed", data.speed);
|
|
46
32
|
if (data.restore !== undefined) {
|
|
47
33
|
this.restore.enable = data.restore.enable ?? this.restore.enable;
|
|
48
34
|
this.restore.delay = data.restore.delay ?? this.restore.delay;
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivity";
|
|
2
2
|
import { Attractor } from "./Attractor.js";
|
|
3
3
|
export async function loadExternalAttractInteraction(engine) {
|
|
4
|
-
engine.checkVersion("4.
|
|
4
|
+
engine.checkVersion("4.2.0");
|
|
5
5
|
await engine.pluginManager.register((e) => {
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
|
7
7
|
e.pluginManager.addInteractor?.("externalAttract", container => {
|
package/esm/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadExternalAttractInteraction(engine) {
|
|
2
|
-
engine.checkVersion("4.
|
|
2
|
+
engine.checkVersion("4.2.0");
|
|
3
3
|
await engine.pluginManager.register(async (e) => {
|
|
4
4
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
5
5
|
ensureInteractivityPluginLoaded(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-attract",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "tsParticles attract external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
},
|
|
98
98
|
"type": "module",
|
|
99
99
|
"peerDependencies": {
|
|
100
|
-
"@tsparticles/engine": "4.
|
|
101
|
-
"@tsparticles/plugin-interactivity": "4.
|
|
100
|
+
"@tsparticles/engine": "4.2.0",
|
|
101
|
+
"@tsparticles/plugin-interactivity": "4.2.0"
|
|
102
102
|
}
|
|
103
103
|
}
|
package/report.html
CHANGED
|
@@ -4930,7 +4930,7 @@ var drawChart = (function (exports) {
|
|
|
4930
4930
|
</script>
|
|
4931
4931
|
<script>
|
|
4932
4932
|
/*<!--*/
|
|
4933
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.interaction.external.attract.js","children":[{"name":"dist/browser","children":[{"uid":"
|
|
4933
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.interaction.external.attract.js","children":[{"name":"dist/browser","children":[{"uid":"9c18390f-1","name":"Utils.js"},{"name":"Options/Classes/Attract.js","uid":"9c18390f-3"},{"uid":"9c18390f-5","name":"Attractor.js"},{"uid":"9c18390f-7","name":"index.js"},{"uid":"9c18390f-9","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"9c18390f-1":{"renderedLength":2506,"gzipLength":0,"brotliLength":0,"metaUid":"9c18390f-0"},"9c18390f-3":{"renderedLength":1334,"gzipLength":0,"brotliLength":0,"metaUid":"9c18390f-2"},"9c18390f-5":{"renderedLength":6994,"gzipLength":0,"brotliLength":0,"metaUid":"9c18390f-4"},"9c18390f-7":{"renderedLength":413,"gzipLength":0,"brotliLength":0,"metaUid":"9c18390f-6"},"9c18390f-9":{"renderedLength":203,"gzipLength":0,"brotliLength":0,"metaUid":"9c18390f-8"}},"nodeMetas":{"9c18390f-0":{"id":"/dist/browser/Utils.js","moduleParts":{"tsparticles.interaction.external.attract.js":"9c18390f-1"},"imported":[{"uid":"9c18390f-11"}],"importedBy":[{"uid":"9c18390f-4"}]},"9c18390f-2":{"id":"/dist/browser/Options/Classes/Attract.js","moduleParts":{"tsparticles.interaction.external.attract.js":"9c18390f-3"},"imported":[{"uid":"9c18390f-11"}],"importedBy":[{"uid":"9c18390f-6"},{"uid":"9c18390f-4"}]},"9c18390f-4":{"id":"/dist/browser/Attractor.js","moduleParts":{"tsparticles.interaction.external.attract.js":"9c18390f-5"},"imported":[{"uid":"9c18390f-10"},{"uid":"9c18390f-11"},{"uid":"9c18390f-0"},{"uid":"9c18390f-2"}],"importedBy":[{"uid":"9c18390f-6"}]},"9c18390f-6":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.interaction.external.attract.js":"9c18390f-7"},"imported":[{"uid":"9c18390f-10"},{"uid":"9c18390f-4"},{"uid":"9c18390f-2"}],"importedBy":[{"uid":"9c18390f-8"}]},"9c18390f-8":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.interaction.external.attract.js":"9c18390f-9"},"imported":[{"uid":"9c18390f-6"}],"importedBy":[],"isEntry":true},"9c18390f-10":{"id":"@tsparticles/plugin-interactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"9c18390f-6"},{"uid":"9c18390f-4"}],"isExternal":true},"9c18390f-11":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"9c18390f-4"},{"uid":"9c18390f-2"},{"uid":"9c18390f-0"}],"isExternal":true}},"env":{"rollup":"4.62.0"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
|
|
4934
4934
|
|
|
4935
4935
|
const run = () => {
|
|
4936
4936
|
const width = window.innerWidth;
|
|
@@ -1,5 +1,5 @@
|
|
|
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);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
-
/* External Interaction v4.
|
|
2
|
+
/* External Interaction v4.2.0 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/plugin-interactivity'), require('@tsparticles/engine')) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/plugin-interactivity', '@tsparticles/engine'], factory) :
|
|
@@ -51,20 +51,14 @@
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
class Attract {
|
|
54
|
-
distance;
|
|
55
|
-
duration;
|
|
56
|
-
easing;
|
|
57
|
-
factor;
|
|
58
|
-
maxSpeed;
|
|
54
|
+
distance = 200;
|
|
55
|
+
duration = 0.4;
|
|
56
|
+
easing = "ease-out-quad";
|
|
57
|
+
factor = 1;
|
|
58
|
+
maxSpeed = 50;
|
|
59
59
|
restore;
|
|
60
|
-
speed;
|
|
60
|
+
speed = 1;
|
|
61
61
|
constructor() {
|
|
62
|
-
this.distance = 200;
|
|
63
|
-
this.duration = 0.4;
|
|
64
|
-
this.easing = engine.EasingType.easeOutQuad;
|
|
65
|
-
this.factor = 1;
|
|
66
|
-
this.maxSpeed = 50;
|
|
67
|
-
this.speed = 1;
|
|
68
62
|
this.restore = {
|
|
69
63
|
enable: false,
|
|
70
64
|
delay: 0,
|
|
@@ -76,24 +70,16 @@
|
|
|
76
70
|
if (engine.isNull(data)) {
|
|
77
71
|
return;
|
|
78
72
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
if (data.duration !== undefined) {
|
|
83
|
-
this.duration = data.duration;
|
|
84
|
-
}
|
|
73
|
+
engine.loadProperty(this, "distance", data.distance);
|
|
74
|
+
engine.loadProperty(this, "duration", data.duration);
|
|
85
75
|
if (data.easing !== undefined) {
|
|
86
76
|
this.easing = data.easing;
|
|
87
77
|
}
|
|
88
|
-
|
|
89
|
-
this.factor = data.factor;
|
|
90
|
-
}
|
|
78
|
+
engine.loadProperty(this, "factor", data.factor);
|
|
91
79
|
if (data.maxSpeed !== undefined) {
|
|
92
80
|
this.maxSpeed = data.maxSpeed;
|
|
93
81
|
}
|
|
94
|
-
|
|
95
|
-
this.speed = data.speed;
|
|
96
|
-
}
|
|
82
|
+
engine.loadProperty(this, "speed", data.speed);
|
|
97
83
|
if (data.restore !== undefined) {
|
|
98
84
|
this.restore.enable = data.restore.enable ?? this.restore.enable;
|
|
99
85
|
this.restore.delay = data.restore.delay ?? this.restore.delay;
|
|
@@ -183,10 +169,7 @@
|
|
|
183
169
|
return engine.isInArray(attractMode, hoverMode) || engine.isInArray(attractMode, clickMode);
|
|
184
170
|
}
|
|
185
171
|
loadModeOptions(options, ...sources) {
|
|
186
|
-
options
|
|
187
|
-
for (const source of sources) {
|
|
188
|
-
options.attract.load(source?.attract);
|
|
189
|
-
}
|
|
172
|
+
engine.loadOptionProperty(options, "attract", Attract, ...sources);
|
|
190
173
|
}
|
|
191
174
|
reset() {
|
|
192
175
|
}
|
|
@@ -250,7 +233,7 @@
|
|
|
250
233
|
}
|
|
251
234
|
|
|
252
235
|
async function loadExternalAttractInteraction(engine) {
|
|
253
|
-
engine.checkVersion("4.
|
|
236
|
+
engine.checkVersion("4.2.0");
|
|
254
237
|
await engine.pluginManager.register((e) => {
|
|
255
238
|
pluginInteractivity.ensureInteractivityPluginLoaded(e);
|
|
256
239
|
e.pluginManager.addInteractor?.("externalAttract", container => {
|
|
@@ -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 e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.interactions.externalAttract=t.__tsParticlesInternals.interactions.externalAttract||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,s){"use strict";const a=s.Vector.origin;function n(t,e,n,i,r,l,c){const o=e.actualOptions.interactivity?.modes.attract;if(!o)return;const _=e.particles.grid.query(r,l);for(const e of _){const{dx:r,dy:l,distance:_}=s.getDistances(e.position,n),
|
|
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 e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.interactions.externalAttract=t.__tsParticlesInternals.interactions.externalAttract||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,s){"use strict";const a=s.Vector.origin;function n(t,e,n,i,r,l,c){const o=e.actualOptions.interactivity?.modes.attract;if(!o)return;const _=e.particles.grid.query(r,l);for(const e of _){const{dx:r,dy:l,distance:_}=s.getDistances(e.position,n),p=o.speed*o.factor,d=s.clamp(t.getEasing(o.easing)(s.identity-_/i)*p,1,o.maxSpeed);a.x=_?r/_*d:p,a.y=_?l/_*d:p,c?.(e),e.position.subFrom(a)}}class i{distance=200;duration=.4;easing="ease-out-quad";factor=1;maxSpeed=50;restore;speed=1;constructor(){this.restore={enable:!1,delay:0,speed:.08,follow:!0}}load(t){s.isNull(t)||(s.loadProperty(this,"distance",t.distance),s.loadProperty(this,"duration",t.duration),void 0!==t.easing&&(this.easing=t.easing),s.loadProperty(this,"factor",t.factor),void 0!==t.maxSpeed&&(this.maxSpeed=t.maxSpeed),s.loadProperty(this,"speed",t.speed),void 0!==t.restore&&(this.restore.enable=t.restore.enable??this.restore.enable,this.restore.delay=t.restore.delay??this.restore.delay,this.restore.speed=t.restore.speed??this.restore.speed,this.restore.follow=t.restore.follow??this.restore.follow))}}const r="attract";class l extends e.ExternalInteractorBase{handleClickMode;#t;#e;#s;#a;constructor(t,e){super(e),this.#s=t,this.#e=0,this.#t=new Set,this.#a=new Map,e.attract??={particles:[]},this.handleClickMode=(t,a)=>{const n=this.container.actualOptions,i=n.interactivity?.modes.attract;if(i&&t===r){e.attract??={particles:[]},e.attract.clicking=!0,e.attract.count=0;for(const t of e.attract.particles)this.isEnabled(a,t)&&t.velocity.setTo(t.initialVelocity);e.attract.particles=[],e.attract.finish=!1,setTimeout(()=>{e.destroyed||(e.attract??={particles:[]},e.attract.clicking=!1)},i.duration*s.millisecondsToSeconds)}}}get maxDistance(){return this.#e}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity?.modes.attract;e&&(this.#e=e.distance,t.retina.attractModeDistance=e.distance*t.retina.pixelRatio)}interact(t){this.#t.clear();const a=this.container.actualOptions,i=t.status===e.mouseMoveEvent,l=a.interactivity?.events;if(!l)return;const{enable:c,mode:o}=l.onHover,{enable:_,mode:p}=l.onClick;i&&c&&s.isInArray(r,o)?function(t,e,a,i,r){const l=a.mouse.position,c=e.retina.attractModeDistance;!c||c<0||!l||n(t,e,l,c,new s.Circle(l.x,l.y,c),t=>i(t),r)}(this.#s,this.container,t,e=>this.isEnabled(t,e),t=>{this.#n(t)}):_&&s.isInArray(r,p)&&function(t,e,a,i,r){e.attract??={particles:[]};const{attract:l}=e;if(l.finish||(l.count??=0,l.count++,l.count===e.particles.count&&(l.finish=!0)),l.clicking){const l=a.mouse.clickPosition,c=e.retina.attractModeDistance;if(!c||c<0||!l)return;n(t,e,l,c,new s.Circle(l.x,l.y,c),t=>i(t),r)}else!1===l.clicking&&(l.particles=[])}(this.#s,this.container,t,e=>this.isEnabled(t,e),t=>{this.#n(t)}),this.#i()}isEnabled(t,e){const a=this.container.actualOptions,n=t.mouse,i=(e?.interactivity??a.interactivity)?.events;if(!(n.position&&i?.onHover.enable||n.clickPosition&&i?.onClick.enable))return!1;const l=i.onHover.mode,c=i.onClick.mode;return s.isInArray(r,l)||s.isInArray(r,c)}loadModeOptions(t,...e){s.loadOptionProperty(t,"attract",i,...e)}reset(){}#i(){const t=this.container.actualOptions.interactivity?.modes.attract?.restore;if(!t?.enable||!this.#a.size)return;const e=Date.now(),a=t.delay*s.millisecondsToSeconds,n=Math.max(.001,Math.min(1,t.speed));for(const[s,i]of this.#a){if(this.#t.has(s))continue;if(s.destroyed){this.#a.delete(s);continue}const r=i.target;if(e-i.lastInteractionTime<a)continue;let l=r.x-s.position.x,c=r.y-s.position.y,o=r.z-s.position.z;if(t.follow&&s.options.move.enable){const{x:t,y:e,z:a}=s.velocity,n=t*t+e*e+a*a;if(n>0){const s=(l*t+c*e+o*a)/n;l-=t*s,c-=e*s,o-=a*s}}s.position.x+=l*n,s.position.y+=c*n,s.position.z+=o*n,Math.abs(l)<=.5&&Math.abs(c)<=.5&&(s.position.x=r.x,s.position.y=r.y,s.position.z=r.z,this.#a.delete(s))}}#n(t){this.#t.add(t);const e=this.container.actualOptions.interactivity?.modes.attract?.restore;if(!e?.enable)return;const s=Date.now();let a=this.#a.get(t);a||(a={target:t.position.copy(),lastInteractionTime:s},this.#a.set(t,a)),a.lastInteractionTime=s}}async function c(t){t.checkVersion("4.2.0"),await t.pluginManager.register(t=>{e.ensureInteractivityPluginLoaded(t),t.pluginManager.addInteractor?.("externalAttract",e=>Promise.resolve(new l(t.pluginManager,e)))})}const o=globalThis;o.__tsParticlesInternals=o.__tsParticlesInternals??{},o.loadExternalAttractInteraction=c,t.Attract=i,t.loadExternalAttractInteraction=c}),Object.assign(globalThis.window||globalThis,{loadExternalAttractInteraction:(globalThis.__tsParticlesInternals.interactions.externalAttract||{}).loadExternalAttractInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { EasingType, type EasingTypeAlt, type IOptionLoader, type RecursivePartial } from "@tsparticles/engine";
|
|
2
1
|
import type { IAttract, IAttractRestore } from "../Interfaces/IAttract.js";
|
|
2
|
+
import { type IOptionLoader, type RecursivePartial } from "@tsparticles/engine";
|
|
3
3
|
export declare class Attract implements IAttract, IOptionLoader<IAttract> {
|
|
4
4
|
distance: number;
|
|
5
5
|
duration: number;
|
|
6
|
-
easing:
|
|
6
|
+
easing: string;
|
|
7
7
|
factor: number;
|
|
8
8
|
maxSpeed: number;
|
|
9
9
|
restore: IAttractRestore;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Attract } from "./Attract.js";
|
|
2
2
|
import type { InteractivityOptions } from "@tsparticles/plugin-interactivity";
|
|
3
3
|
export type AttractOptions = InteractivityOptions & {
|
|
4
4
|
interactivity?: {
|
|
5
|
-
modes:
|
|
5
|
+
modes: {
|
|
6
|
+
attract?: Attract;
|
|
7
|
+
};
|
|
6
8
|
};
|
|
7
9
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { EasingType, EasingTypeAlt } from "@tsparticles/engine";
|
|
2
1
|
export interface IAttractRestore {
|
|
3
2
|
delay: number;
|
|
4
3
|
enable: boolean;
|
|
@@ -8,7 +7,7 @@ export interface IAttractRestore {
|
|
|
8
7
|
export interface IAttract {
|
|
9
8
|
distance: number;
|
|
10
9
|
duration: number;
|
|
11
|
-
easing:
|
|
10
|
+
easing: string;
|
|
12
11
|
factor: number;
|
|
13
12
|
maxSpeed: number;
|
|
14
13
|
restore: IAttractRestore;
|