@tsparticles/interaction-external-cannon 4.1.3 → 4.2.1
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/Cannoner.js +2 -5
- package/browser/Options/Classes/Cannon.js +17 -42
- package/browser/index.js +1 -1
- package/browser/index.lazy.js +1 -1
- package/cjs/Cannoner.js +2 -5
- package/cjs/Options/Classes/Cannon.js +17 -42
- package/cjs/index.js +1 -1
- package/cjs/index.lazy.js +1 -1
- package/esm/Cannoner.js +2 -5
- package/esm/Options/Classes/Cannon.js +17 -42
- 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.cannon.js +19 -48
- package/tsparticles.interaction.external.cannon.min.js +1 -1
- package/types/Options/Classes/Cannon.d.ts +1 -2
- package/types/Options/Classes/CannonOptions.d.ts +4 -2
package/browser/Cannoner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
|
|
2
|
-
import { Vector, degToRad, double, doublePI, getDistance, getRandomInRange, identity, none, } from "@tsparticles/engine";
|
|
2
|
+
import { Vector, degToRad, double, doublePI, getDistance, getRandomInRange, identity, loadOptionProperty, none, } from "@tsparticles/engine";
|
|
3
3
|
import { Cannon } from "./Options/Classes/Cannon.js";
|
|
4
4
|
var CannonState;
|
|
5
5
|
(function (CannonState) {
|
|
@@ -72,10 +72,7 @@ export class Cannoner extends ExternalInteractorBase {
|
|
|
72
72
|
return this.#state !== CannonState.idle || interactivityData.mouse.clicking;
|
|
73
73
|
}
|
|
74
74
|
loadModeOptions(options, ...sources) {
|
|
75
|
-
options
|
|
76
|
-
for (const source of sources) {
|
|
77
|
-
options.cannon.load(source?.cannon);
|
|
78
|
-
}
|
|
75
|
+
loadOptionProperty(options, "cannon", Cannon, ...sources);
|
|
79
76
|
}
|
|
80
77
|
reset(_interactivityData, _particle) {
|
|
81
78
|
}
|
|
@@ -1,49 +1,24 @@
|
|
|
1
|
+
import { loadProperty } from "@tsparticles/engine";
|
|
1
2
|
export class Cannon {
|
|
2
|
-
drawVector;
|
|
3
|
-
maxDragDistance;
|
|
4
|
-
maxParticles;
|
|
5
|
-
minParticles;
|
|
6
|
-
particleFactor;
|
|
7
|
-
spread;
|
|
8
|
-
vectorColor;
|
|
9
|
-
velocityFactor;
|
|
10
|
-
constructor() {
|
|
11
|
-
this.spread = 30;
|
|
12
|
-
this.velocityFactor = 0.5;
|
|
13
|
-
this.particleFactor = 0.2;
|
|
14
|
-
this.maxDragDistance = 0;
|
|
15
|
-
this.minParticles = 5;
|
|
16
|
-
this.maxParticles = 200;
|
|
17
|
-
this.drawVector = true;
|
|
18
|
-
this.vectorColor = "#ffffff80";
|
|
19
|
-
}
|
|
3
|
+
drawVector = true;
|
|
4
|
+
maxDragDistance = 0;
|
|
5
|
+
maxParticles = 200;
|
|
6
|
+
minParticles = 5;
|
|
7
|
+
particleFactor = 0.2;
|
|
8
|
+
spread = 30;
|
|
9
|
+
vectorColor = "#ffffff80";
|
|
10
|
+
velocityFactor = 0.5;
|
|
20
11
|
load(data) {
|
|
21
12
|
if (!data) {
|
|
22
13
|
return;
|
|
23
14
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
if (data.minParticles !== undefined) {
|
|
34
|
-
this.minParticles = data.minParticles;
|
|
35
|
-
}
|
|
36
|
-
if (data.maxParticles !== undefined) {
|
|
37
|
-
this.maxParticles = data.maxParticles;
|
|
38
|
-
}
|
|
39
|
-
if (data.maxDragDistance !== undefined) {
|
|
40
|
-
this.maxDragDistance = data.maxDragDistance;
|
|
41
|
-
}
|
|
42
|
-
if (data.drawVector !== undefined) {
|
|
43
|
-
this.drawVector = data.drawVector;
|
|
44
|
-
}
|
|
45
|
-
if (data.vectorColor !== undefined) {
|
|
46
|
-
this.vectorColor = data.vectorColor;
|
|
47
|
-
}
|
|
15
|
+
loadProperty(this, "spread", data.spread);
|
|
16
|
+
loadProperty(this, "velocityFactor", data.velocityFactor);
|
|
17
|
+
loadProperty(this, "particleFactor", data.particleFactor);
|
|
18
|
+
loadProperty(this, "minParticles", data.minParticles);
|
|
19
|
+
loadProperty(this, "maxParticles", data.maxParticles);
|
|
20
|
+
loadProperty(this, "maxDragDistance", data.maxDragDistance);
|
|
21
|
+
loadProperty(this, "drawVector", data.drawVector);
|
|
22
|
+
loadProperty(this, "vectorColor", data.vectorColor);
|
|
48
23
|
}
|
|
49
24
|
}
|
package/browser/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
3
3
|
import { Cannoner } from "./Cannoner.js";
|
|
4
4
|
export async function loadExternalCannonInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.1
|
|
5
|
+
engine.checkVersion("4.2.1");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
ensureInteractivityPluginLoaded(e);
|
|
8
8
|
e.pluginManager.addInteractor?.("externalCannon", container => {
|
package/browser/index.lazy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
2
2
|
export async function loadExternalCannonInteraction(engine) {
|
|
3
|
-
engine.checkVersion("4.1
|
|
3
|
+
engine.checkVersion("4.2.1");
|
|
4
4
|
await engine.pluginManager.register(async (e) => {
|
|
5
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
package/cjs/Cannoner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
|
|
2
|
-
import { Vector, degToRad, double, doublePI, getDistance, getRandomInRange, identity, none, } from "@tsparticles/engine";
|
|
2
|
+
import { Vector, degToRad, double, doublePI, getDistance, getRandomInRange, identity, loadOptionProperty, none, } from "@tsparticles/engine";
|
|
3
3
|
import { Cannon } from "./Options/Classes/Cannon.js";
|
|
4
4
|
var CannonState;
|
|
5
5
|
(function (CannonState) {
|
|
@@ -72,10 +72,7 @@ export class Cannoner extends ExternalInteractorBase {
|
|
|
72
72
|
return this.#state !== CannonState.idle || interactivityData.mouse.clicking;
|
|
73
73
|
}
|
|
74
74
|
loadModeOptions(options, ...sources) {
|
|
75
|
-
options
|
|
76
|
-
for (const source of sources) {
|
|
77
|
-
options.cannon.load(source?.cannon);
|
|
78
|
-
}
|
|
75
|
+
loadOptionProperty(options, "cannon", Cannon, ...sources);
|
|
79
76
|
}
|
|
80
77
|
reset(_interactivityData, _particle) {
|
|
81
78
|
}
|
|
@@ -1,49 +1,24 @@
|
|
|
1
|
+
import { loadProperty } from "@tsparticles/engine";
|
|
1
2
|
export class Cannon {
|
|
2
|
-
drawVector;
|
|
3
|
-
maxDragDistance;
|
|
4
|
-
maxParticles;
|
|
5
|
-
minParticles;
|
|
6
|
-
particleFactor;
|
|
7
|
-
spread;
|
|
8
|
-
vectorColor;
|
|
9
|
-
velocityFactor;
|
|
10
|
-
constructor() {
|
|
11
|
-
this.spread = 30;
|
|
12
|
-
this.velocityFactor = 0.5;
|
|
13
|
-
this.particleFactor = 0.2;
|
|
14
|
-
this.maxDragDistance = 0;
|
|
15
|
-
this.minParticles = 5;
|
|
16
|
-
this.maxParticles = 200;
|
|
17
|
-
this.drawVector = true;
|
|
18
|
-
this.vectorColor = "#ffffff80";
|
|
19
|
-
}
|
|
3
|
+
drawVector = true;
|
|
4
|
+
maxDragDistance = 0;
|
|
5
|
+
maxParticles = 200;
|
|
6
|
+
minParticles = 5;
|
|
7
|
+
particleFactor = 0.2;
|
|
8
|
+
spread = 30;
|
|
9
|
+
vectorColor = "#ffffff80";
|
|
10
|
+
velocityFactor = 0.5;
|
|
20
11
|
load(data) {
|
|
21
12
|
if (!data) {
|
|
22
13
|
return;
|
|
23
14
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
if (data.minParticles !== undefined) {
|
|
34
|
-
this.minParticles = data.minParticles;
|
|
35
|
-
}
|
|
36
|
-
if (data.maxParticles !== undefined) {
|
|
37
|
-
this.maxParticles = data.maxParticles;
|
|
38
|
-
}
|
|
39
|
-
if (data.maxDragDistance !== undefined) {
|
|
40
|
-
this.maxDragDistance = data.maxDragDistance;
|
|
41
|
-
}
|
|
42
|
-
if (data.drawVector !== undefined) {
|
|
43
|
-
this.drawVector = data.drawVector;
|
|
44
|
-
}
|
|
45
|
-
if (data.vectorColor !== undefined) {
|
|
46
|
-
this.vectorColor = data.vectorColor;
|
|
47
|
-
}
|
|
15
|
+
loadProperty(this, "spread", data.spread);
|
|
16
|
+
loadProperty(this, "velocityFactor", data.velocityFactor);
|
|
17
|
+
loadProperty(this, "particleFactor", data.particleFactor);
|
|
18
|
+
loadProperty(this, "minParticles", data.minParticles);
|
|
19
|
+
loadProperty(this, "maxParticles", data.maxParticles);
|
|
20
|
+
loadProperty(this, "maxDragDistance", data.maxDragDistance);
|
|
21
|
+
loadProperty(this, "drawVector", data.drawVector);
|
|
22
|
+
loadProperty(this, "vectorColor", data.vectorColor);
|
|
48
23
|
}
|
|
49
24
|
}
|
package/cjs/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
3
3
|
import { Cannoner } from "./Cannoner.js";
|
|
4
4
|
export async function loadExternalCannonInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.1
|
|
5
|
+
engine.checkVersion("4.2.1");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
ensureInteractivityPluginLoaded(e);
|
|
8
8
|
e.pluginManager.addInteractor?.("externalCannon", container => {
|
package/cjs/index.lazy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
2
2
|
export async function loadExternalCannonInteraction(engine) {
|
|
3
|
-
engine.checkVersion("4.1
|
|
3
|
+
engine.checkVersion("4.2.1");
|
|
4
4
|
await engine.pluginManager.register(async (e) => {
|
|
5
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
package/esm/Cannoner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExternalInteractorBase, } from "@tsparticles/plugin-interactivity";
|
|
2
|
-
import { Vector, degToRad, double, doublePI, getDistance, getRandomInRange, identity, none, } from "@tsparticles/engine";
|
|
2
|
+
import { Vector, degToRad, double, doublePI, getDistance, getRandomInRange, identity, loadOptionProperty, none, } from "@tsparticles/engine";
|
|
3
3
|
import { Cannon } from "./Options/Classes/Cannon.js";
|
|
4
4
|
var CannonState;
|
|
5
5
|
(function (CannonState) {
|
|
@@ -72,10 +72,7 @@ export class Cannoner extends ExternalInteractorBase {
|
|
|
72
72
|
return this.#state !== CannonState.idle || interactivityData.mouse.clicking;
|
|
73
73
|
}
|
|
74
74
|
loadModeOptions(options, ...sources) {
|
|
75
|
-
options
|
|
76
|
-
for (const source of sources) {
|
|
77
|
-
options.cannon.load(source?.cannon);
|
|
78
|
-
}
|
|
75
|
+
loadOptionProperty(options, "cannon", Cannon, ...sources);
|
|
79
76
|
}
|
|
80
77
|
reset(_interactivityData, _particle) {
|
|
81
78
|
}
|
|
@@ -1,49 +1,24 @@
|
|
|
1
|
+
import { loadProperty } from "@tsparticles/engine";
|
|
1
2
|
export class Cannon {
|
|
2
|
-
drawVector;
|
|
3
|
-
maxDragDistance;
|
|
4
|
-
maxParticles;
|
|
5
|
-
minParticles;
|
|
6
|
-
particleFactor;
|
|
7
|
-
spread;
|
|
8
|
-
vectorColor;
|
|
9
|
-
velocityFactor;
|
|
10
|
-
constructor() {
|
|
11
|
-
this.spread = 30;
|
|
12
|
-
this.velocityFactor = 0.5;
|
|
13
|
-
this.particleFactor = 0.2;
|
|
14
|
-
this.maxDragDistance = 0;
|
|
15
|
-
this.minParticles = 5;
|
|
16
|
-
this.maxParticles = 200;
|
|
17
|
-
this.drawVector = true;
|
|
18
|
-
this.vectorColor = "#ffffff80";
|
|
19
|
-
}
|
|
3
|
+
drawVector = true;
|
|
4
|
+
maxDragDistance = 0;
|
|
5
|
+
maxParticles = 200;
|
|
6
|
+
minParticles = 5;
|
|
7
|
+
particleFactor = 0.2;
|
|
8
|
+
spread = 30;
|
|
9
|
+
vectorColor = "#ffffff80";
|
|
10
|
+
velocityFactor = 0.5;
|
|
20
11
|
load(data) {
|
|
21
12
|
if (!data) {
|
|
22
13
|
return;
|
|
23
14
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
if (data.minParticles !== undefined) {
|
|
34
|
-
this.minParticles = data.minParticles;
|
|
35
|
-
}
|
|
36
|
-
if (data.maxParticles !== undefined) {
|
|
37
|
-
this.maxParticles = data.maxParticles;
|
|
38
|
-
}
|
|
39
|
-
if (data.maxDragDistance !== undefined) {
|
|
40
|
-
this.maxDragDistance = data.maxDragDistance;
|
|
41
|
-
}
|
|
42
|
-
if (data.drawVector !== undefined) {
|
|
43
|
-
this.drawVector = data.drawVector;
|
|
44
|
-
}
|
|
45
|
-
if (data.vectorColor !== undefined) {
|
|
46
|
-
this.vectorColor = data.vectorColor;
|
|
47
|
-
}
|
|
15
|
+
loadProperty(this, "spread", data.spread);
|
|
16
|
+
loadProperty(this, "velocityFactor", data.velocityFactor);
|
|
17
|
+
loadProperty(this, "particleFactor", data.particleFactor);
|
|
18
|
+
loadProperty(this, "minParticles", data.minParticles);
|
|
19
|
+
loadProperty(this, "maxParticles", data.maxParticles);
|
|
20
|
+
loadProperty(this, "maxDragDistance", data.maxDragDistance);
|
|
21
|
+
loadProperty(this, "drawVector", data.drawVector);
|
|
22
|
+
loadProperty(this, "vectorColor", data.vectorColor);
|
|
48
23
|
}
|
|
49
24
|
}
|
package/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
3
3
|
import { Cannoner } from "./Cannoner.js";
|
|
4
4
|
export async function loadExternalCannonInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.1
|
|
5
|
+
engine.checkVersion("4.2.1");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
ensureInteractivityPluginLoaded(e);
|
|
8
8
|
e.pluginManager.addInteractor?.("externalCannon", container => {
|
package/esm/index.lazy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
2
2
|
export async function loadExternalCannonInteraction(engine) {
|
|
3
|
-
engine.checkVersion("4.1
|
|
3
|
+
engine.checkVersion("4.2.1");
|
|
4
4
|
await engine.pluginManager.register(async (e) => {
|
|
5
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-cannon",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "tsParticles cannon 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.1
|
|
101
|
-
"@tsparticles/plugin-interactivity": "4.1
|
|
100
|
+
"@tsparticles/engine": "4.2.1",
|
|
101
|
+
"@tsparticles/plugin-interactivity": "4.2.1"
|
|
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.cannon.js","children":[{"name":"dist/browser","children":[{"name":"Options/Classes/Cannon.js","uid":"
|
|
4933
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.interaction.external.cannon.js","children":[{"name":"dist/browser","children":[{"name":"Options/Classes/Cannon.js","uid":"7bd041ec-1"},{"uid":"7bd041ec-3","name":"Cannoner.js"},{"uid":"7bd041ec-5","name":"index.js"},{"uid":"7bd041ec-7","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"7bd041ec-1":{"renderedLength":932,"gzipLength":0,"brotliLength":0,"metaUid":"7bd041ec-0"},"7bd041ec-3":{"renderedLength":6023,"gzipLength":0,"brotliLength":0,"metaUid":"7bd041ec-2"},"7bd041ec-5":{"renderedLength":393,"gzipLength":0,"brotliLength":0,"metaUid":"7bd041ec-4"},"7bd041ec-7":{"renderedLength":201,"gzipLength":0,"brotliLength":0,"metaUid":"7bd041ec-6"}},"nodeMetas":{"7bd041ec-0":{"id":"/dist/browser/Options/Classes/Cannon.js","moduleParts":{"tsparticles.interaction.external.cannon.js":"7bd041ec-1"},"imported":[{"uid":"7bd041ec-9"}],"importedBy":[{"uid":"7bd041ec-4"},{"uid":"7bd041ec-2"}]},"7bd041ec-2":{"id":"/dist/browser/Cannoner.js","moduleParts":{"tsparticles.interaction.external.cannon.js":"7bd041ec-3"},"imported":[{"uid":"7bd041ec-8"},{"uid":"7bd041ec-9"},{"uid":"7bd041ec-0"}],"importedBy":[{"uid":"7bd041ec-4"}]},"7bd041ec-4":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.interaction.external.cannon.js":"7bd041ec-5"},"imported":[{"uid":"7bd041ec-8"},{"uid":"7bd041ec-0"},{"uid":"7bd041ec-2"}],"importedBy":[{"uid":"7bd041ec-6"}]},"7bd041ec-6":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.interaction.external.cannon.js":"7bd041ec-7"},"imported":[{"uid":"7bd041ec-4"}],"importedBy":[],"isEntry":true},"7bd041ec-8":{"id":"@tsparticles/plugin-interactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"7bd041ec-4"},{"uid":"7bd041ec-2"}],"isExternal":true},"7bd041ec-9":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"7bd041ec-0"},{"uid":"7bd041ec-2"}],"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.1
|
|
2
|
+
/* External Interaction v4.2.1 */
|
|
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) :
|
|
@@ -7,52 +7,26 @@
|
|
|
7
7
|
})(this, (function (exports, pluginInteractivity, engine) { 'use strict';
|
|
8
8
|
|
|
9
9
|
class Cannon {
|
|
10
|
-
drawVector;
|
|
11
|
-
maxDragDistance;
|
|
12
|
-
maxParticles;
|
|
13
|
-
minParticles;
|
|
14
|
-
particleFactor;
|
|
15
|
-
spread;
|
|
16
|
-
vectorColor;
|
|
17
|
-
velocityFactor;
|
|
18
|
-
constructor() {
|
|
19
|
-
this.spread = 30;
|
|
20
|
-
this.velocityFactor = 0.5;
|
|
21
|
-
this.particleFactor = 0.2;
|
|
22
|
-
this.maxDragDistance = 0;
|
|
23
|
-
this.minParticles = 5;
|
|
24
|
-
this.maxParticles = 200;
|
|
25
|
-
this.drawVector = true;
|
|
26
|
-
this.vectorColor = "#ffffff80";
|
|
27
|
-
}
|
|
10
|
+
drawVector = true;
|
|
11
|
+
maxDragDistance = 0;
|
|
12
|
+
maxParticles = 200;
|
|
13
|
+
minParticles = 5;
|
|
14
|
+
particleFactor = 0.2;
|
|
15
|
+
spread = 30;
|
|
16
|
+
vectorColor = "#ffffff80";
|
|
17
|
+
velocityFactor = 0.5;
|
|
28
18
|
load(data) {
|
|
29
19
|
if (!data) {
|
|
30
20
|
return;
|
|
31
21
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
if (data.minParticles !== undefined) {
|
|
42
|
-
this.minParticles = data.minParticles;
|
|
43
|
-
}
|
|
44
|
-
if (data.maxParticles !== undefined) {
|
|
45
|
-
this.maxParticles = data.maxParticles;
|
|
46
|
-
}
|
|
47
|
-
if (data.maxDragDistance !== undefined) {
|
|
48
|
-
this.maxDragDistance = data.maxDragDistance;
|
|
49
|
-
}
|
|
50
|
-
if (data.drawVector !== undefined) {
|
|
51
|
-
this.drawVector = data.drawVector;
|
|
52
|
-
}
|
|
53
|
-
if (data.vectorColor !== undefined) {
|
|
54
|
-
this.vectorColor = data.vectorColor;
|
|
55
|
-
}
|
|
22
|
+
engine.loadProperty(this, "spread", data.spread);
|
|
23
|
+
engine.loadProperty(this, "velocityFactor", data.velocityFactor);
|
|
24
|
+
engine.loadProperty(this, "particleFactor", data.particleFactor);
|
|
25
|
+
engine.loadProperty(this, "minParticles", data.minParticles);
|
|
26
|
+
engine.loadProperty(this, "maxParticles", data.maxParticles);
|
|
27
|
+
engine.loadProperty(this, "maxDragDistance", data.maxDragDistance);
|
|
28
|
+
engine.loadProperty(this, "drawVector", data.drawVector);
|
|
29
|
+
engine.loadProperty(this, "vectorColor", data.vectorColor);
|
|
56
30
|
}
|
|
57
31
|
}
|
|
58
32
|
|
|
@@ -127,10 +101,7 @@
|
|
|
127
101
|
return this.#state !== CannonState.idle || interactivityData.mouse.clicking;
|
|
128
102
|
}
|
|
129
103
|
loadModeOptions(options, ...sources) {
|
|
130
|
-
options
|
|
131
|
-
for (const source of sources) {
|
|
132
|
-
options.cannon.load(source?.cannon);
|
|
133
|
-
}
|
|
104
|
+
engine.loadOptionProperty(options, "cannon", Cannon, ...sources);
|
|
134
105
|
}
|
|
135
106
|
reset(_interactivityData, _particle) {
|
|
136
107
|
}
|
|
@@ -181,7 +152,7 @@
|
|
|
181
152
|
}
|
|
182
153
|
|
|
183
154
|
async function loadExternalCannonInteraction(engine) {
|
|
184
|
-
engine.checkVersion("4.1
|
|
155
|
+
engine.checkVersion("4.2.1");
|
|
185
156
|
await engine.pluginManager.register((e) => {
|
|
186
157
|
pluginInteractivity.ensureInteractivityPluginLoaded(e);
|
|
187
158
|
e.pluginManager.addInteractor?.("externalCannon", 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.externalCannon=t.__tsParticlesInternals.interactions.externalCannon||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,s){"use strict";class a{drawVector;maxDragDistance;maxParticles;minParticles;particleFactor;spread
|
|
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.externalCannon=t.__tsParticlesInternals.interactions.externalCannon||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,s){"use strict";class a{drawVector=!0;maxDragDistance=0;maxParticles=200;minParticles=5;particleFactor=.2;spread=30;vectorColor="#ffffff80";velocityFactor=.5;load(t){t&&(s.loadProperty(this,"spread",t.spread),s.loadProperty(this,"velocityFactor",t.velocityFactor),s.loadProperty(this,"particleFactor",t.particleFactor),s.loadProperty(this,"minParticles",t.minParticles),s.loadProperty(this,"maxParticles",t.maxParticles),s.loadProperty(this,"maxDragDistance",t.maxDragDistance),s.loadProperty(this,"drawVector",t.drawVector),s.loadProperty(this,"vectorColor",t.vectorColor))}}var n;!function(t){t[t.idle=0]="idle",t[t.aiming=1]="aiming",t[t.fired=2]="fired"}(n||(n={}));const r="cannon",i=s.identity/20;class l extends e.ExternalInteractorBase{maxDistance=0;#t;#e={origin:s.Vector.origin,current:s.Vector.origin,active:!1};#s=void 0;#a=n.idle;constructor(t){super(t)}clear(t,e){}init(){const t=this.container.actualOptions.interactivity?.modes.cannon??new a;this.#t={spread:s.degToRad(t.spread),maxDragDistance:t.maxDragDistance,velocityFactor:t.velocityFactor,particleFactor:t.particleFactor,minParticles:t.minParticles,maxParticles:t.maxParticles,drawVector:t.drawVector,vectorColor:t.vectorColor}}interact(t,e){const s=t.mouse,a=s.position,r=s.clicking,i=s.downPosition;r&&i&&i!==this.#s&&this.#a===n.idle&&(this.#s=i,this.#e={origin:{x:i.x,y:i.y},current:{x:i.x,y:i.y},active:!0},this.#a=n.aiming),this.#a===n.aiming&&a&&(this.#e.current={x:a.x,y:a.y},this.#n()),r||this.#a!==n.aiming||(this.#e.active=!1,this.#r(),this.#a=n.idle)}isEnabled(t){const e=this.container,s=e.actualOptions.interactivity?.events;if(!s?.onClick.enable)return!1;const a=s.onClick.mode;return!!(Array.isArray(a)?a.includes(r):a===r)&&(this.#a!==n.idle||t.mouse.clicking)}loadModeOptions(t,...e){s.loadOptionProperty(t,"cannon",a,...e)}reset(t,e){}#n(){this.container.canvas.render.draw(t=>{const e=this.#t;if(!e)return;const{origin:a,current:n}=this.#e,r=this.container.retina.pixelRatio,l=s.getDistance(a,n),c=e.maxDragDistance>s.none?Math.min(l,e.maxDragDistance*r):l,o=l>0?c/l:0,_=a.x+(n.x-a.x)*o,P=a.y+(n.y-a.y)*o;t.save(),t.strokeStyle=e.vectorColor,t.lineWidth=s.double*r,t.beginPath(),t.moveTo(a.x,a.y),t.lineTo(_,P),t.stroke();const d=Math.max(4,c*i)*r;t.beginPath(),t.arc(a.x,a.y,d,0,s.doublePI),t.strokeStyle=e.vectorColor,t.lineWidth=s.double*r,t.stroke(),t.restore()})}#r(){const t=this.#t;if(!t)return;const{origin:e,current:a}=this.#e,n=this.container.retina.pixelRatio,r=s.getDistance(e,a),i=t.maxDragDistance>s.none?Math.min(r,t.maxDragDistance*n):r;if(i<2)return;const l=s.identity/n,c=(d=a.x,p=a.y,I=e.x,u=e.y,Math.atan2(u-p,I-d)),o=i*l*t.velocityFactor,_=Math.min(t.maxParticles,Math.max(t.minParticles,Math.round(i*t.particleFactor))),P=180/Math.PI;var d,p,I,u;for(let a=0;a<_;a++){const a=c+s.getRandomInRange(-t.spread,t.spread),n=s.getRandomInRange(.25*o,o);this.container.particles.addParticle(e,{move:{enable:!0,speed:n,direction:a*P}})}}}async function c(t){t.checkVersion("4.2.1"),await t.pluginManager.register(t=>{e.ensureInteractivityPluginLoaded(t),t.pluginManager.addInteractor?.("externalCannon",t=>Promise.resolve(new l(t)))})}const o=globalThis;o.__tsParticlesInternals=o.__tsParticlesInternals??{},o.loadExternalCannonInteraction=c,t.Cannon=a,t.loadExternalCannonInteraction=c}),Object.assign(globalThis.window||globalThis,{loadExternalCannonInteraction:(globalThis.__tsParticlesInternals.interactions.externalCannon||{}).loadExternalCannonInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type RecursivePartial } from "@tsparticles/engine";
|
|
1
2
|
import type { ICannon } from "../Interfaces/ICannon.js";
|
|
2
|
-
import type { RecursivePartial } from "@tsparticles/engine";
|
|
3
3
|
export declare class Cannon implements ICannon {
|
|
4
4
|
drawVector: boolean;
|
|
5
5
|
maxDragDistance: number;
|
|
@@ -9,6 +9,5 @@ export declare class Cannon implements ICannon {
|
|
|
9
9
|
spread: number;
|
|
10
10
|
vectorColor: string;
|
|
11
11
|
velocityFactor: number;
|
|
12
|
-
constructor();
|
|
13
12
|
load(data?: RecursivePartial<ICannon>): void;
|
|
14
13
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Cannon } from "./Cannon.js";
|
|
2
2
|
import type { InteractivityOptions } from "@tsparticles/plugin-interactivity";
|
|
3
3
|
export type CannonOptions = InteractivityOptions & {
|
|
4
4
|
interactivity?: {
|
|
5
|
-
modes:
|
|
5
|
+
modes: {
|
|
6
|
+
cannon?: Cannon;
|
|
7
|
+
};
|
|
6
8
|
};
|
|
7
9
|
};
|