@tsparticles/interaction-external-repulse 3.3.0 → 3.4.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/Options/Classes/Repulse.js +1 -1
- package/browser/Options/Classes/RepulseBase.js +2 -1
- package/browser/Repulser.js +5 -5
- package/browser/index.js +3 -3
- package/cjs/Options/Classes/Repulse.js +1 -1
- package/cjs/Options/Classes/RepulseBase.js +2 -1
- package/cjs/Repulser.js +4 -4
- package/cjs/index.js +3 -3
- package/esm/Options/Classes/Repulse.js +1 -1
- package/esm/Options/Classes/RepulseBase.js +2 -1
- package/esm/Repulser.js +5 -5
- package/esm/index.js +3 -3
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.interaction.external.repulse.js +13 -201
- package/tsparticles.interaction.external.repulse.min.js +1 -1
- package/tsparticles.interaction.external.repulse.min.js.LICENSE.txt +1 -1
- package/umd/Options/Classes/Repulse.js +1 -1
- package/umd/Options/Classes/RepulseBase.js +3 -2
- package/umd/Repulser.js +4 -4
- package/umd/index.js +4 -17
- package/206.min.js +0 -2
- package/206.min.js.LICENSE.txt +0 -1
- package/dist_browser_Repulser_js.js +0 -30
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EasingType } from "@tsparticles/engine";
|
|
1
2
|
export class RepulseBase {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.distance = 200;
|
|
@@ -5,7 +6,7 @@ export class RepulseBase {
|
|
|
5
6
|
this.factor = 100;
|
|
6
7
|
this.speed = 1;
|
|
7
8
|
this.maxSpeed = 50;
|
|
8
|
-
this.easing =
|
|
9
|
+
this.easing = EasingType.easeOutQuad;
|
|
9
10
|
}
|
|
10
11
|
load(data) {
|
|
11
12
|
if (!data) {
|
package/browser/Repulser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Circle, ExternalInteractorBase, Rectangle, Vector, clamp, divMode, divModeExecute, getDistances, getEasing, isDivModeEnabled, isInArray, millisecondsToSeconds, mouseMoveEvent, } from "@tsparticles/engine";
|
|
1
|
+
import { Circle, DivType, ExternalInteractorBase, Rectangle, Vector, clamp, divMode, divModeExecute, getDistances, getEasing, isDivModeEnabled, isInArray, millisecondsToSeconds, mouseMoveEvent, } from "@tsparticles/engine";
|
|
2
2
|
import { Repulse } from "./Options/Classes/Repulse.js";
|
|
3
3
|
const repulseMode = "repulse", minDistance = 0, repulseRadiusFactor = 6, repulseRadiusPower = 3, squarePower = 2, minRadius = 0, minSpeed = 0, easingOffset = 1, half = 0.5;
|
|
4
4
|
export class Repulser extends ExternalInteractorBase {
|
|
@@ -28,7 +28,7 @@ export class Repulser extends ExternalInteractorBase {
|
|
|
28
28
|
if (mouseClickPos === undefined) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
const range = new Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius), query = container.particles.quadTree.query(range,
|
|
31
|
+
const range = new Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius), query = container.particles.quadTree.query(range, p => this.isEnabled(p));
|
|
32
32
|
for (const particle of query) {
|
|
33
33
|
const { dx, dy, distance } = getDistances(mouseClickPos, particle.position), d = distance ** squarePower, velocity = repulseOptions.speed, force = (-repulseRadius * velocity) / d;
|
|
34
34
|
if (d <= repulseRadius) {
|
|
@@ -54,7 +54,7 @@ export class Repulser extends ExternalInteractorBase {
|
|
|
54
54
|
this._processRepulse(mousePos, repulseRadius, new Circle(mousePos.x, mousePos.y, repulseRadius));
|
|
55
55
|
};
|
|
56
56
|
this._processRepulse = (position, repulseRadius, area, divRepulse) => {
|
|
57
|
-
const container = this.container, query = container.particles.quadTree.query(area,
|
|
57
|
+
const container = this.container, query = container.particles.quadTree.query(area, p => this.isEnabled(p)), repulseOptions = container.actualOptions.interactivity.modes.repulse;
|
|
58
58
|
if (!repulseOptions) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -73,11 +73,11 @@ export class Repulser extends ExternalInteractorBase {
|
|
|
73
73
|
if (!query.length) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
query.forEach(
|
|
76
|
+
query.forEach(item => {
|
|
77
77
|
const elem = item, pxRatio = container.retina.pixelRatio, pos = {
|
|
78
78
|
x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,
|
|
79
79
|
y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio,
|
|
80
|
-
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type ===
|
|
80
|
+
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type === DivType.circle
|
|
81
81
|
? new Circle(pos.x, pos.y, repulseRadius)
|
|
82
82
|
: new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), divs = repulse.divs, divRepulse = divMode(divs, elem);
|
|
83
83
|
this._processRepulse(pos, repulseRadius, area, divRepulse);
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Repulser } from "./Repulser.js";
|
|
1
2
|
export async function loadExternalRepulseInteraction(engine, refresh = true) {
|
|
2
|
-
await engine.addInteractor("externalRepulse",
|
|
3
|
-
|
|
4
|
-
return new Repulser(engine, container);
|
|
3
|
+
await engine.addInteractor("externalRepulse", container => {
|
|
4
|
+
return Promise.resolve(new Repulser(engine, container));
|
|
5
5
|
}, refresh);
|
|
6
6
|
}
|
|
7
7
|
export * from "./Options/Classes/RepulseBase.js";
|
|
@@ -10,7 +10,7 @@ class Repulse extends RepulseBase_js_1.RepulseBase {
|
|
|
10
10
|
if (!data) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
this.divs = (0, engine_1.executeOnSingleOrMultiple)(data.divs,
|
|
13
|
+
this.divs = (0, engine_1.executeOnSingleOrMultiple)(data.divs, div => {
|
|
14
14
|
const tmp = new RepulseDiv_js_1.RepulseDiv();
|
|
15
15
|
tmp.load(div);
|
|
16
16
|
return tmp;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RepulseBase = void 0;
|
|
4
|
+
const engine_1 = require("@tsparticles/engine");
|
|
4
5
|
class RepulseBase {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.distance = 200;
|
|
@@ -8,7 +9,7 @@ class RepulseBase {
|
|
|
8
9
|
this.factor = 100;
|
|
9
10
|
this.speed = 1;
|
|
10
11
|
this.maxSpeed = 50;
|
|
11
|
-
this.easing =
|
|
12
|
+
this.easing = engine_1.EasingType.easeOutQuad;
|
|
12
13
|
}
|
|
13
14
|
load(data) {
|
|
14
15
|
if (!data) {
|
package/cjs/Repulser.js
CHANGED
|
@@ -31,7 +31,7 @@ class Repulser extends engine_1.ExternalInteractorBase {
|
|
|
31
31
|
if (mouseClickPos === undefined) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
const range = new engine_1.Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius), query = container.particles.quadTree.query(range,
|
|
34
|
+
const range = new engine_1.Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius), query = container.particles.quadTree.query(range, p => this.isEnabled(p));
|
|
35
35
|
for (const particle of query) {
|
|
36
36
|
const { dx, dy, distance } = (0, engine_1.getDistances)(mouseClickPos, particle.position), d = distance ** squarePower, velocity = repulseOptions.speed, force = (-repulseRadius * velocity) / d;
|
|
37
37
|
if (d <= repulseRadius) {
|
|
@@ -57,7 +57,7 @@ class Repulser extends engine_1.ExternalInteractorBase {
|
|
|
57
57
|
this._processRepulse(mousePos, repulseRadius, new engine_1.Circle(mousePos.x, mousePos.y, repulseRadius));
|
|
58
58
|
};
|
|
59
59
|
this._processRepulse = (position, repulseRadius, area, divRepulse) => {
|
|
60
|
-
const container = this.container, query = container.particles.quadTree.query(area,
|
|
60
|
+
const container = this.container, query = container.particles.quadTree.query(area, p => this.isEnabled(p)), repulseOptions = container.actualOptions.interactivity.modes.repulse;
|
|
61
61
|
if (!repulseOptions) {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
@@ -76,11 +76,11 @@ class Repulser extends engine_1.ExternalInteractorBase {
|
|
|
76
76
|
if (!query.length) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
query.forEach(
|
|
79
|
+
query.forEach(item => {
|
|
80
80
|
const elem = item, pxRatio = container.retina.pixelRatio, pos = {
|
|
81
81
|
x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,
|
|
82
82
|
y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio,
|
|
83
|
-
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type ===
|
|
83
|
+
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type === engine_1.DivType.circle
|
|
84
84
|
? new engine_1.Circle(pos.x, pos.y, repulseRadius)
|
|
85
85
|
: new engine_1.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), divs = repulse.divs, divRepulse = (0, engine_1.divMode)(divs, elem);
|
|
86
86
|
this._processRepulse(pos, repulseRadius, area, divRepulse);
|
package/cjs/index.js
CHANGED
|
@@ -15,10 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.loadExternalRepulseInteraction = void 0;
|
|
18
|
+
const Repulser_js_1 = require("./Repulser.js");
|
|
18
19
|
async function loadExternalRepulseInteraction(engine, refresh = true) {
|
|
19
|
-
await engine.addInteractor("externalRepulse",
|
|
20
|
-
|
|
21
|
-
return new Repulser(engine, container);
|
|
20
|
+
await engine.addInteractor("externalRepulse", container => {
|
|
21
|
+
return Promise.resolve(new Repulser_js_1.Repulser(engine, container));
|
|
22
22
|
}, refresh);
|
|
23
23
|
}
|
|
24
24
|
exports.loadExternalRepulseInteraction = loadExternalRepulseInteraction;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EasingType } from "@tsparticles/engine";
|
|
1
2
|
export class RepulseBase {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.distance = 200;
|
|
@@ -5,7 +6,7 @@ export class RepulseBase {
|
|
|
5
6
|
this.factor = 100;
|
|
6
7
|
this.speed = 1;
|
|
7
8
|
this.maxSpeed = 50;
|
|
8
|
-
this.easing =
|
|
9
|
+
this.easing = EasingType.easeOutQuad;
|
|
9
10
|
}
|
|
10
11
|
load(data) {
|
|
11
12
|
if (!data) {
|
package/esm/Repulser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Circle, ExternalInteractorBase, Rectangle, Vector, clamp, divMode, divModeExecute, getDistances, getEasing, isDivModeEnabled, isInArray, millisecondsToSeconds, mouseMoveEvent, } from "@tsparticles/engine";
|
|
1
|
+
import { Circle, DivType, ExternalInteractorBase, Rectangle, Vector, clamp, divMode, divModeExecute, getDistances, getEasing, isDivModeEnabled, isInArray, millisecondsToSeconds, mouseMoveEvent, } from "@tsparticles/engine";
|
|
2
2
|
import { Repulse } from "./Options/Classes/Repulse.js";
|
|
3
3
|
const repulseMode = "repulse", minDistance = 0, repulseRadiusFactor = 6, repulseRadiusPower = 3, squarePower = 2, minRadius = 0, minSpeed = 0, easingOffset = 1, half = 0.5;
|
|
4
4
|
export class Repulser extends ExternalInteractorBase {
|
|
@@ -28,7 +28,7 @@ export class Repulser extends ExternalInteractorBase {
|
|
|
28
28
|
if (mouseClickPos === undefined) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
const range = new Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius), query = container.particles.quadTree.query(range,
|
|
31
|
+
const range = new Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius), query = container.particles.quadTree.query(range, p => this.isEnabled(p));
|
|
32
32
|
for (const particle of query) {
|
|
33
33
|
const { dx, dy, distance } = getDistances(mouseClickPos, particle.position), d = distance ** squarePower, velocity = repulseOptions.speed, force = (-repulseRadius * velocity) / d;
|
|
34
34
|
if (d <= repulseRadius) {
|
|
@@ -54,7 +54,7 @@ export class Repulser extends ExternalInteractorBase {
|
|
|
54
54
|
this._processRepulse(mousePos, repulseRadius, new Circle(mousePos.x, mousePos.y, repulseRadius));
|
|
55
55
|
};
|
|
56
56
|
this._processRepulse = (position, repulseRadius, area, divRepulse) => {
|
|
57
|
-
const container = this.container, query = container.particles.quadTree.query(area,
|
|
57
|
+
const container = this.container, query = container.particles.quadTree.query(area, p => this.isEnabled(p)), repulseOptions = container.actualOptions.interactivity.modes.repulse;
|
|
58
58
|
if (!repulseOptions) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -73,11 +73,11 @@ export class Repulser extends ExternalInteractorBase {
|
|
|
73
73
|
if (!query.length) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
query.forEach(
|
|
76
|
+
query.forEach(item => {
|
|
77
77
|
const elem = item, pxRatio = container.retina.pixelRatio, pos = {
|
|
78
78
|
x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,
|
|
79
79
|
y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio,
|
|
80
|
-
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type ===
|
|
80
|
+
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type === DivType.circle
|
|
81
81
|
? new Circle(pos.x, pos.y, repulseRadius)
|
|
82
82
|
: new Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), divs = repulse.divs, divRepulse = divMode(divs, elem);
|
|
83
83
|
this._processRepulse(pos, repulseRadius, area, divRepulse);
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Repulser } from "./Repulser.js";
|
|
1
2
|
export async function loadExternalRepulseInteraction(engine, refresh = true) {
|
|
2
|
-
await engine.addInteractor("externalRepulse",
|
|
3
|
-
|
|
4
|
-
return new Repulser(engine, container);
|
|
3
|
+
await engine.addInteractor("externalRepulse", container => {
|
|
4
|
+
return Promise.resolve(new Repulser(engine, container));
|
|
5
5
|
}, refresh);
|
|
6
6
|
}
|
|
7
7
|
export * from "./Options/Classes/RepulseBase.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-repulse",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "tsParticles repulse external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"./package.json": "./package.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "^3.
|
|
90
|
+
"@tsparticles/engine": "^3.4.0"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
-
<title>@tsparticles/interaction-external-repulse [
|
|
6
|
+
<title>@tsparticles/interaction-external-repulse [13 May 2024 at 00:07]</title>
|
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
|
|
8
8
|
|
|
9
9
|
<script>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.
|
|
7
|
+
* v3.4.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -44,7 +44,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
44
44
|
\*****************************************************/
|
|
45
45
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
46
46
|
|
|
47
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RepulseBase: () => (/* binding */ RepulseBase)\n/* harmony export */ });\nclass RepulseBase {\n constructor() {\n this.distance = 200;\n this.duration = 0.4;\n this.factor = 100;\n this.speed = 1;\n this.maxSpeed = 50;\n this.easing =
|
|
47
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RepulseBase: () => (/* binding */ RepulseBase)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass RepulseBase {\n constructor() {\n this.distance = 200;\n this.duration = 0.4;\n this.factor = 100;\n this.speed = 1;\n this.maxSpeed = 50;\n this.easing = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.EasingType.easeOutQuad;\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.distance !== undefined) {\n this.distance = data.distance;\n }\n if (data.duration !== undefined) {\n this.duration = data.duration;\n }\n if (data.easing !== undefined) {\n this.easing = data.easing;\n }\n if (data.factor !== undefined) {\n this.factor = data.factor;\n }\n if (data.speed !== undefined) {\n this.speed = data.speed;\n }\n if (data.maxSpeed !== undefined) {\n this.maxSpeed = data.maxSpeed;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/Options/Classes/RepulseBase.js?");
|
|
48
48
|
|
|
49
49
|
/***/ }),
|
|
50
50
|
|
|
@@ -58,13 +58,23 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
58
58
|
|
|
59
59
|
/***/ }),
|
|
60
60
|
|
|
61
|
+
/***/ "./dist/browser/Repulser.js":
|
|
62
|
+
/*!**********************************!*\
|
|
63
|
+
!*** ./dist/browser/Repulser.js ***!
|
|
64
|
+
\**********************************/
|
|
65
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66
|
+
|
|
67
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Repulser: () => (/* binding */ Repulser)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Repulse_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Repulse.js */ \"./dist/browser/Options/Classes/Repulse.js\");\n\n\nconst repulseMode = \"repulse\",\n minDistance = 0,\n repulseRadiusFactor = 6,\n repulseRadiusPower = 3,\n squarePower = 2,\n minRadius = 0,\n minSpeed = 0,\n easingOffset = 1,\n half = 0.5;\nclass Repulser extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(engine, container) {\n super(container);\n this._clickRepulse = () => {\n const container = this.container,\n repulseOptions = container.actualOptions.interactivity.modes.repulse;\n if (!repulseOptions) {\n return;\n }\n const repulse = container.repulse ?? {\n particles: []\n };\n if (!repulse.finish) {\n if (!repulse.count) {\n repulse.count = 0;\n }\n repulse.count++;\n if (repulse.count === container.particles.count) {\n repulse.finish = true;\n }\n }\n if (repulse.clicking) {\n const repulseDistance = container.retina.repulseModeDistance;\n if (!repulseDistance || repulseDistance < minDistance) {\n return;\n }\n const repulseRadius = Math.pow(repulseDistance / repulseRadiusFactor, repulseRadiusPower),\n mouseClickPos = container.interactivity.mouse.clickPosition;\n if (mouseClickPos === undefined) {\n return;\n }\n const range = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius),\n query = container.particles.quadTree.query(range, p => this.isEnabled(p));\n for (const particle of query) {\n const {\n dx,\n dy,\n distance\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(mouseClickPos, particle.position),\n d = distance ** squarePower,\n velocity = repulseOptions.speed,\n force = -repulseRadius * velocity / d;\n if (d <= repulseRadius) {\n repulse.particles.push(particle);\n const vect = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(dx, dy);\n vect.length = force;\n particle.velocity.setTo(vect);\n }\n }\n } else if (repulse.clicking === false) {\n for (const particle of repulse.particles) {\n particle.velocity.setTo(particle.initialVelocity);\n }\n repulse.particles = [];\n }\n };\n this._hoverRepulse = () => {\n const container = this.container,\n mousePos = container.interactivity.mouse.position,\n repulseRadius = container.retina.repulseModeDistance;\n if (!repulseRadius || repulseRadius < minRadius || !mousePos) {\n return;\n }\n this._processRepulse(mousePos, repulseRadius, new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(mousePos.x, mousePos.y, repulseRadius));\n };\n this._processRepulse = (position, repulseRadius, area, divRepulse) => {\n const container = this.container,\n query = container.particles.quadTree.query(area, p => this.isEnabled(p)),\n repulseOptions = container.actualOptions.interactivity.modes.repulse;\n if (!repulseOptions) {\n return;\n }\n const {\n easing,\n speed,\n factor,\n maxSpeed\n } = repulseOptions,\n easingFunc = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getEasing)(easing),\n velocity = (divRepulse?.speed ?? speed) * factor;\n for (const particle of query) {\n const {\n dx,\n dy,\n distance\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(particle.position, position),\n repulseFactor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(easingFunc(easingOffset - distance / repulseRadius) * velocity, minSpeed, maxSpeed),\n normVec = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(!distance ? velocity : dx / distance * repulseFactor, !distance ? velocity : dy / distance * repulseFactor);\n particle.position.addTo(normVec);\n }\n };\n this._singleSelectorRepulse = (selector, div) => {\n const container = this.container,\n repulse = container.actualOptions.interactivity.modes.repulse;\n if (!repulse) {\n return;\n }\n const query = document.querySelectorAll(selector);\n if (!query.length) {\n return;\n }\n query.forEach(item => {\n const elem = item,\n pxRatio = container.retina.pixelRatio,\n pos = {\n x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,\n y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio\n },\n repulseRadius = elem.offsetWidth * half * pxRatio,\n area = div.type === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DivType.circle ? new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(pos.x, pos.y, repulseRadius) : new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),\n divs = repulse.divs,\n divRepulse = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divMode)(divs, elem);\n this._processRepulse(pos, repulseRadius, area, divRepulse);\n });\n };\n this._engine = engine;\n if (!container.repulse) {\n container.repulse = {\n particles: []\n };\n }\n this.handleClickMode = mode => {\n const options = this.container.actualOptions,\n repulseOpts = options.interactivity.modes.repulse;\n if (!repulseOpts || mode !== repulseMode) {\n return;\n }\n if (!container.repulse) {\n container.repulse = {\n particles: []\n };\n }\n const repulse = container.repulse;\n repulse.clicking = true;\n repulse.count = 0;\n for (const particle of container.repulse.particles) {\n if (!this.isEnabled(particle)) {\n continue;\n }\n particle.velocity.setTo(particle.initialVelocity);\n }\n repulse.particles = [];\n repulse.finish = false;\n setTimeout(() => {\n if (container.destroyed) {\n return;\n }\n repulse.clicking = false;\n }, repulseOpts.duration * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds);\n };\n }\n clear() {}\n init() {\n const container = this.container,\n repulse = container.actualOptions.interactivity.modes.repulse;\n if (!repulse) {\n return;\n }\n container.retina.repulseModeDistance = repulse.distance * container.retina.pixelRatio;\n }\n interact() {\n const container = this.container,\n options = container.actualOptions,\n mouseMoveStatus = container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseMoveEvent,\n events = options.interactivity.events,\n hover = events.onHover,\n hoverEnabled = hover.enable,\n hoverMode = hover.mode,\n click = events.onClick,\n clickEnabled = click.enable,\n clickMode = click.mode,\n divs = events.onDiv;\n if (mouseMoveStatus && hoverEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, hoverMode)) {\n this._hoverRepulse();\n } else if (clickEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, clickMode)) {\n this._clickRepulse();\n } else {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divModeExecute)(repulseMode, divs, (selector, div) => this._singleSelectorRepulse(selector, div));\n }\n }\n isEnabled(particle) {\n const container = this.container,\n options = container.actualOptions,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? options.interactivity).events,\n divs = events.onDiv,\n hover = events.onHover,\n click = events.onClick,\n divRepulse = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isDivModeEnabled)(repulseMode, divs);\n if (!(divRepulse || hover.enable && !!mouse.position || click.enable && mouse.clickPosition)) {\n return false;\n }\n const hoverMode = hover.mode,\n clickMode = click.mode;\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, hoverMode) || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, clickMode) || divRepulse;\n }\n loadModeOptions(options, ...sources) {\n if (!options.repulse) {\n options.repulse = new _Options_Classes_Repulse_js__WEBPACK_IMPORTED_MODULE_1__.Repulse();\n }\n for (const source of sources) {\n options.repulse.load(source?.repulse);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/Repulser.js?");
|
|
68
|
+
|
|
69
|
+
/***/ }),
|
|
70
|
+
|
|
61
71
|
/***/ "./dist/browser/index.js":
|
|
62
72
|
/*!*******************************!*\
|
|
63
73
|
!*** ./dist/browser/index.js ***!
|
|
64
74
|
\*******************************/
|
|
65
75
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66
76
|
|
|
67
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Repulse: () => (/* reexport safe */
|
|
77
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Repulse: () => (/* reexport safe */ _Options_Classes_Repulse_js__WEBPACK_IMPORTED_MODULE_3__.Repulse),\n/* harmony export */ RepulseBase: () => (/* reexport safe */ _Options_Classes_RepulseBase_js__WEBPACK_IMPORTED_MODULE_1__.RepulseBase),\n/* harmony export */ RepulseDiv: () => (/* reexport safe */ _Options_Classes_RepulseDiv_js__WEBPACK_IMPORTED_MODULE_2__.RepulseDiv),\n/* harmony export */ loadExternalRepulseInteraction: () => (/* binding */ loadExternalRepulseInteraction)\n/* harmony export */ });\n/* harmony import */ var _Repulser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Repulser.js */ \"./dist/browser/Repulser.js\");\n/* harmony import */ var _Options_Classes_RepulseBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/RepulseBase.js */ \"./dist/browser/Options/Classes/RepulseBase.js\");\n/* harmony import */ var _Options_Classes_RepulseDiv_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/RepulseDiv.js */ \"./dist/browser/Options/Classes/RepulseDiv.js\");\n/* harmony import */ var _Options_Classes_Repulse_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Options/Classes/Repulse.js */ \"./dist/browser/Options/Classes/Repulse.js\");\n\nasync function loadExternalRepulseInteraction(engine, refresh = true) {\n await engine.addInteractor(\"externalRepulse\", container => {\n return Promise.resolve(new _Repulser_js__WEBPACK_IMPORTED_MODULE_0__.Repulser(engine, container));\n }, refresh);\n}\n\n\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/index.js?");
|
|
68
78
|
|
|
69
79
|
/***/ }),
|
|
70
80
|
|
|
@@ -104,9 +114,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
104
114
|
/******/ return module.exports;
|
|
105
115
|
/******/ }
|
|
106
116
|
/******/
|
|
107
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
108
|
-
/******/ __webpack_require__.m = __webpack_modules__;
|
|
109
|
-
/******/
|
|
110
117
|
/************************************************************************/
|
|
111
118
|
/******/ /* webpack/runtime/compat get default export */
|
|
112
119
|
/******/ (() => {
|
|
@@ -132,91 +139,11 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
132
139
|
/******/ };
|
|
133
140
|
/******/ })();
|
|
134
141
|
/******/
|
|
135
|
-
/******/ /* webpack/runtime/ensure chunk */
|
|
136
|
-
/******/ (() => {
|
|
137
|
-
/******/ __webpack_require__.f = {};
|
|
138
|
-
/******/ // This file contains only the entry chunk.
|
|
139
|
-
/******/ // The chunk loading function for additional chunks
|
|
140
|
-
/******/ __webpack_require__.e = (chunkId) => {
|
|
141
|
-
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
142
|
-
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
143
|
-
/******/ return promises;
|
|
144
|
-
/******/ }, []));
|
|
145
|
-
/******/ };
|
|
146
|
-
/******/ })();
|
|
147
|
-
/******/
|
|
148
|
-
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
149
|
-
/******/ (() => {
|
|
150
|
-
/******/ // This function allow to reference async chunks
|
|
151
|
-
/******/ __webpack_require__.u = (chunkId) => {
|
|
152
|
-
/******/ // return url for filenames based on template
|
|
153
|
-
/******/ return "" + chunkId + ".js";
|
|
154
|
-
/******/ };
|
|
155
|
-
/******/ })();
|
|
156
|
-
/******/
|
|
157
|
-
/******/ /* webpack/runtime/global */
|
|
158
|
-
/******/ (() => {
|
|
159
|
-
/******/ __webpack_require__.g = (function() {
|
|
160
|
-
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
161
|
-
/******/ try {
|
|
162
|
-
/******/ return this || new Function('return this')();
|
|
163
|
-
/******/ } catch (e) {
|
|
164
|
-
/******/ if (typeof window === 'object') return window;
|
|
165
|
-
/******/ }
|
|
166
|
-
/******/ })();
|
|
167
|
-
/******/ })();
|
|
168
|
-
/******/
|
|
169
142
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
170
143
|
/******/ (() => {
|
|
171
144
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
172
145
|
/******/ })();
|
|
173
146
|
/******/
|
|
174
|
-
/******/ /* webpack/runtime/load script */
|
|
175
|
-
/******/ (() => {
|
|
176
|
-
/******/ var inProgress = {};
|
|
177
|
-
/******/ var dataWebpackPrefix = "@tsparticles/interaction-external-repulse:";
|
|
178
|
-
/******/ // loadScript function to load a script via script tag
|
|
179
|
-
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
180
|
-
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
181
|
-
/******/ var script, needAttach;
|
|
182
|
-
/******/ if(key !== undefined) {
|
|
183
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
184
|
-
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
185
|
-
/******/ var s = scripts[i];
|
|
186
|
-
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
187
|
-
/******/ }
|
|
188
|
-
/******/ }
|
|
189
|
-
/******/ if(!script) {
|
|
190
|
-
/******/ needAttach = true;
|
|
191
|
-
/******/ script = document.createElement('script');
|
|
192
|
-
/******/
|
|
193
|
-
/******/ script.charset = 'utf-8';
|
|
194
|
-
/******/ script.timeout = 120;
|
|
195
|
-
/******/ if (__webpack_require__.nc) {
|
|
196
|
-
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
197
|
-
/******/ }
|
|
198
|
-
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
199
|
-
/******/
|
|
200
|
-
/******/ script.src = url;
|
|
201
|
-
/******/ }
|
|
202
|
-
/******/ inProgress[url] = [done];
|
|
203
|
-
/******/ var onScriptComplete = (prev, event) => {
|
|
204
|
-
/******/ // avoid mem leaks in IE.
|
|
205
|
-
/******/ script.onerror = script.onload = null;
|
|
206
|
-
/******/ clearTimeout(timeout);
|
|
207
|
-
/******/ var doneFns = inProgress[url];
|
|
208
|
-
/******/ delete inProgress[url];
|
|
209
|
-
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
210
|
-
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
211
|
-
/******/ if(prev) return prev(event);
|
|
212
|
-
/******/ }
|
|
213
|
-
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
214
|
-
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
215
|
-
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
216
|
-
/******/ needAttach && document.head.appendChild(script);
|
|
217
|
-
/******/ };
|
|
218
|
-
/******/ })();
|
|
219
|
-
/******/
|
|
220
147
|
/******/ /* webpack/runtime/make namespace object */
|
|
221
148
|
/******/ (() => {
|
|
222
149
|
/******/ // define __esModule on exports
|
|
@@ -228,121 +155,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
228
155
|
/******/ };
|
|
229
156
|
/******/ })();
|
|
230
157
|
/******/
|
|
231
|
-
/******/ /* webpack/runtime/publicPath */
|
|
232
|
-
/******/ (() => {
|
|
233
|
-
/******/ var scriptUrl;
|
|
234
|
-
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
235
|
-
/******/ var document = __webpack_require__.g.document;
|
|
236
|
-
/******/ if (!scriptUrl && document) {
|
|
237
|
-
/******/ if (document.currentScript)
|
|
238
|
-
/******/ scriptUrl = document.currentScript.src;
|
|
239
|
-
/******/ if (!scriptUrl) {
|
|
240
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
241
|
-
/******/ if(scripts.length) {
|
|
242
|
-
/******/ var i = scripts.length - 1;
|
|
243
|
-
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
244
|
-
/******/ }
|
|
245
|
-
/******/ }
|
|
246
|
-
/******/ }
|
|
247
|
-
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
248
|
-
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
249
|
-
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
250
|
-
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
251
|
-
/******/ __webpack_require__.p = scriptUrl;
|
|
252
|
-
/******/ })();
|
|
253
|
-
/******/
|
|
254
|
-
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
255
|
-
/******/ (() => {
|
|
256
|
-
/******/ // no baseURI
|
|
257
|
-
/******/
|
|
258
|
-
/******/ // object to store loaded and loading chunks
|
|
259
|
-
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
260
|
-
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
261
|
-
/******/ var installedChunks = {
|
|
262
|
-
/******/ "tsparticles.interaction.external.repulse": 0
|
|
263
|
-
/******/ };
|
|
264
|
-
/******/
|
|
265
|
-
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
266
|
-
/******/ // JSONP chunk loading for javascript
|
|
267
|
-
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
268
|
-
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
269
|
-
/******/
|
|
270
|
-
/******/ // a Promise means "currently loading".
|
|
271
|
-
/******/ if(installedChunkData) {
|
|
272
|
-
/******/ promises.push(installedChunkData[2]);
|
|
273
|
-
/******/ } else {
|
|
274
|
-
/******/ if(true) { // all chunks have JS
|
|
275
|
-
/******/ // setup Promise in chunk cache
|
|
276
|
-
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
277
|
-
/******/ promises.push(installedChunkData[2] = promise);
|
|
278
|
-
/******/
|
|
279
|
-
/******/ // start chunk loading
|
|
280
|
-
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
281
|
-
/******/ // create error before stack unwound to get useful stacktrace later
|
|
282
|
-
/******/ var error = new Error();
|
|
283
|
-
/******/ var loadingEnded = (event) => {
|
|
284
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
285
|
-
/******/ installedChunkData = installedChunks[chunkId];
|
|
286
|
-
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
287
|
-
/******/ if(installedChunkData) {
|
|
288
|
-
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
289
|
-
/******/ var realSrc = event && event.target && event.target.src;
|
|
290
|
-
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
291
|
-
/******/ error.name = 'ChunkLoadError';
|
|
292
|
-
/******/ error.type = errorType;
|
|
293
|
-
/******/ error.request = realSrc;
|
|
294
|
-
/******/ installedChunkData[1](error);
|
|
295
|
-
/******/ }
|
|
296
|
-
/******/ }
|
|
297
|
-
/******/ };
|
|
298
|
-
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
299
|
-
/******/ }
|
|
300
|
-
/******/ }
|
|
301
|
-
/******/ }
|
|
302
|
-
/******/ };
|
|
303
|
-
/******/
|
|
304
|
-
/******/ // no prefetching
|
|
305
|
-
/******/
|
|
306
|
-
/******/ // no preloaded
|
|
307
|
-
/******/
|
|
308
|
-
/******/ // no HMR
|
|
309
|
-
/******/
|
|
310
|
-
/******/ // no HMR manifest
|
|
311
|
-
/******/
|
|
312
|
-
/******/ // no on chunks loaded
|
|
313
|
-
/******/
|
|
314
|
-
/******/ // install a JSONP callback for chunk loading
|
|
315
|
-
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
316
|
-
/******/ var chunkIds = data[0];
|
|
317
|
-
/******/ var moreModules = data[1];
|
|
318
|
-
/******/ var runtime = data[2];
|
|
319
|
-
/******/ // add "moreModules" to the modules object,
|
|
320
|
-
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
321
|
-
/******/ var moduleId, chunkId, i = 0;
|
|
322
|
-
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
323
|
-
/******/ for(moduleId in moreModules) {
|
|
324
|
-
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
325
|
-
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
326
|
-
/******/ }
|
|
327
|
-
/******/ }
|
|
328
|
-
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
329
|
-
/******/ }
|
|
330
|
-
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
331
|
-
/******/ for(;i < chunkIds.length; i++) {
|
|
332
|
-
/******/ chunkId = chunkIds[i];
|
|
333
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
334
|
-
/******/ installedChunks[chunkId][0]();
|
|
335
|
-
/******/ }
|
|
336
|
-
/******/ installedChunks[chunkId] = 0;
|
|
337
|
-
/******/ }
|
|
338
|
-
/******/
|
|
339
|
-
/******/ }
|
|
340
|
-
/******/
|
|
341
|
-
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_interaction_external_repulse"] = this["webpackChunk_tsparticles_interaction_external_repulse"] || [];
|
|
342
|
-
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
343
|
-
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
344
|
-
/******/ })();
|
|
345
|
-
/******/
|
|
346
158
|
/************************************************************************/
|
|
347
159
|
/******/
|
|
348
160
|
/******/ // startup
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.external.repulse.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var i="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(this,(e=>(()=>{var t={303:t=>{t.exports=e}},i={};function s(e){var o=i[e];if(void 0!==o)return o.exports;var n=i[e]={exports:{}};return t[e](n,n.exports,s),n.exports}s.d=(e,t)=>{for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{s.r(o),s.d(o,{Repulse:()=>n,RepulseBase:()=>t,RepulseDiv:()=>i,loadExternalRepulseInteraction:()=>a});var e=s(303);class t{constructor(){this.distance=200,this.duration=.4,this.factor=100,this.speed=1,this.maxSpeed=50,this.easing=e.EasingType.easeOutQuad}load(e){e&&(void 0!==e.distance&&(this.distance=e.distance),void 0!==e.duration&&(this.duration=e.duration),void 0!==e.easing&&(this.easing=e.easing),void 0!==e.factor&&(this.factor=e.factor),void 0!==e.speed&&(this.speed=e.speed),void 0!==e.maxSpeed&&(this.maxSpeed=e.maxSpeed))}}class i extends t{constructor(){super(),this.selectors=[]}load(e){super.load(e),e&&void 0!==e.selectors&&(this.selectors=e.selectors)}}class n extends t{load(t){super.load(t),t&&(this.divs=(0,e.executeOnSingleOrMultiple)(t.divs,(e=>{const t=new i;return t.load(e),t})))}}const r="repulse";class c extends e.ExternalInteractorBase{constructor(t,i){super(i),this._clickRepulse=()=>{const t=this.container,i=t.actualOptions.interactivity.modes.repulse;if(!i)return;const s=t.repulse??{particles:[]};if(s.finish||(s.count||(s.count=0),s.count++,s.count===t.particles.count&&(s.finish=!0)),s.clicking){const o=t.retina.repulseModeDistance;if(!o||o<0)return;const n=Math.pow(o/6,3),r=t.interactivity.mouse.clickPosition;if(void 0===r)return;const c=new e.Circle(r.x,r.y,n),a=t.particles.quadTree.query(c,(e=>this.isEnabled(e)));for(const t of a){const{dx:o,dy:c,distance:a}=(0,e.getDistances)(r,t.position),l=a**2,p=-n*i.speed/l;if(l<=n){s.particles.push(t);const i=e.Vector.create(o,c);i.length=p,t.velocity.setTo(i)}}}else if(!1===s.clicking){for(const e of s.particles)e.velocity.setTo(e.initialVelocity);s.particles=[]}},this._hoverRepulse=()=>{const t=this.container,i=t.interactivity.mouse.position,s=t.retina.repulseModeDistance;!s||s<0||!i||this._processRepulse(i,s,new e.Circle(i.x,i.y,s))},this._processRepulse=(t,i,s,o)=>{const n=this.container,r=n.particles.quadTree.query(s,(e=>this.isEnabled(e))),c=n.actualOptions.interactivity.modes.repulse;if(!c)return;const{easing:a,speed:l,factor:p,maxSpeed:d}=c,u=(0,e.getEasing)(a),f=(o?.speed??l)*p;for(const s of r){const{dx:o,dy:n,distance:r}=(0,e.getDistances)(s.position,t),c=(0,e.clamp)(u(1-r/i)*f,0,d),a=e.Vector.create(r?o/r*c:f,r?n/r*c:f);s.position.addTo(a)}},this._singleSelectorRepulse=(t,i)=>{const s=this.container,o=s.actualOptions.interactivity.modes.repulse;if(!o)return;const n=document.querySelectorAll(t);n.length&&n.forEach((t=>{const n=t,r=s.retina.pixelRatio,c={x:(n.offsetLeft+.5*n.offsetWidth)*r,y:(n.offsetTop+.5*n.offsetHeight)*r},a=.5*n.offsetWidth*r,l=i.type===e.DivType.circle?new e.Circle(c.x,c.y,a):new e.Rectangle(n.offsetLeft*r,n.offsetTop*r,n.offsetWidth*r,n.offsetHeight*r),p=o.divs,d=(0,e.divMode)(p,n);this._processRepulse(c,a,l,d)}))},this._engine=t,i.repulse||(i.repulse={particles:[]}),this.handleClickMode=t=>{const s=this.container.actualOptions.interactivity.modes.repulse;if(!s||t!==r)return;i.repulse||(i.repulse={particles:[]});const o=i.repulse;o.clicking=!0,o.count=0;for(const e of i.repulse.particles)this.isEnabled(e)&&e.velocity.setTo(e.initialVelocity);o.particles=[],o.finish=!1,setTimeout((()=>{i.destroyed||(o.clicking=!1)}),s.duration*e.millisecondsToSeconds)}}clear(){}init(){const e=this.container,t=e.actualOptions.interactivity.modes.repulse;t&&(e.retina.repulseModeDistance=t.distance*e.retina.pixelRatio)}interact(){const t=this.container,i=t.actualOptions,s=t.interactivity.status===e.mouseMoveEvent,o=i.interactivity.events,n=o.onHover,c=n.enable,a=n.mode,l=o.onClick,p=l.enable,d=l.mode,u=o.onDiv;s&&c&&(0,e.isInArray)(r,a)?this._hoverRepulse():p&&(0,e.isInArray)(r,d)?this._clickRepulse():(0,e.divModeExecute)(r,u,((e,t)=>this._singleSelectorRepulse(e,t)))}isEnabled(t){const i=this.container,s=i.actualOptions,o=i.interactivity.mouse,n=(t?.interactivity??s.interactivity).events,c=n.onDiv,a=n.onHover,l=n.onClick,p=(0,e.isDivModeEnabled)(r,c);if(!(p||a.enable&&o.position||l.enable&&o.clickPosition))return!1;const d=a.mode,u=l.mode;return(0,e.isInArray)(r,d)||(0,e.isInArray)(r,u)||p}loadModeOptions(e,...t){e.repulse||(e.repulse=new n);for(const i of t)e.repulse.load(i?.repulse)}reset(){}}async function a(e,t=!0){await e.addInteractor("externalRepulse",(t=>Promise.resolve(new c(e,t))),t)}})(),o})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Repulse External Interaction v3.
|
|
1
|
+
/*! tsParticles Repulse External Interaction v3.4.0 by Matteo Bruni */
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
if (!data) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
this.divs = (0, engine_1.executeOnSingleOrMultiple)(data.divs,
|
|
22
|
+
this.divs = (0, engine_1.executeOnSingleOrMultiple)(data.divs, div => {
|
|
23
23
|
const tmp = new RepulseDiv_js_1.RepulseDiv();
|
|
24
24
|
tmp.load(div);
|
|
25
25
|
return tmp;
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.RepulseBase = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
13
14
|
class RepulseBase {
|
|
14
15
|
constructor() {
|
|
15
16
|
this.distance = 200;
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
this.factor = 100;
|
|
18
19
|
this.speed = 1;
|
|
19
20
|
this.maxSpeed = 50;
|
|
20
|
-
this.easing =
|
|
21
|
+
this.easing = engine_1.EasingType.easeOutQuad;
|
|
21
22
|
}
|
|
22
23
|
load(data) {
|
|
23
24
|
if (!data) {
|
package/umd/Repulser.js
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
if (mouseClickPos === undefined) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
const range = new engine_1.Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius), query = container.particles.quadTree.query(range,
|
|
43
|
+
const range = new engine_1.Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius), query = container.particles.quadTree.query(range, p => this.isEnabled(p));
|
|
44
44
|
for (const particle of query) {
|
|
45
45
|
const { dx, dy, distance } = (0, engine_1.getDistances)(mouseClickPos, particle.position), d = distance ** squarePower, velocity = repulseOptions.speed, force = (-repulseRadius * velocity) / d;
|
|
46
46
|
if (d <= repulseRadius) {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
this._processRepulse(mousePos, repulseRadius, new engine_1.Circle(mousePos.x, mousePos.y, repulseRadius));
|
|
67
67
|
};
|
|
68
68
|
this._processRepulse = (position, repulseRadius, area, divRepulse) => {
|
|
69
|
-
const container = this.container, query = container.particles.quadTree.query(area,
|
|
69
|
+
const container = this.container, query = container.particles.quadTree.query(area, p => this.isEnabled(p)), repulseOptions = container.actualOptions.interactivity.modes.repulse;
|
|
70
70
|
if (!repulseOptions) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
@@ -85,11 +85,11 @@
|
|
|
85
85
|
if (!query.length) {
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
query.forEach(
|
|
88
|
+
query.forEach(item => {
|
|
89
89
|
const elem = item, pxRatio = container.retina.pixelRatio, pos = {
|
|
90
90
|
x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,
|
|
91
91
|
y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio,
|
|
92
|
-
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type ===
|
|
92
|
+
}, repulseRadius = elem.offsetWidth * half * pxRatio, area = div.type === engine_1.DivType.circle
|
|
93
93
|
? new engine_1.Circle(pos.x, pos.y, repulseRadius)
|
|
94
94
|
: new engine_1.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio), divs = repulse.divs, divRepulse = (0, engine_1.divMode)(divs, elem);
|
|
95
95
|
this._processRepulse(pos, repulseRadius, area, divRepulse);
|
package/umd/index.js
CHANGED
|
@@ -9,18 +9,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
9
9
|
if (k2 === undefined) k2 = k;
|
|
10
10
|
o[k2] = m[k];
|
|
11
11
|
}));
|
|
12
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
-
}) : function(o, v) {
|
|
15
|
-
o["default"] = v;
|
|
16
|
-
});
|
|
17
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
|
-
if (mod && mod.__esModule) return mod;
|
|
19
|
-
var result = {};
|
|
20
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
-
__setModuleDefault(result, mod);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
12
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
13
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
14
|
};
|
|
@@ -30,17 +18,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
30
18
|
if (v !== undefined) module.exports = v;
|
|
31
19
|
}
|
|
32
20
|
else if (typeof define === "function" && define.amd) {
|
|
33
|
-
define(["require", "exports", "./Options/Classes/RepulseBase.js", "./Options/Classes/RepulseDiv.js", "./Options/Classes/Repulse.js", "./Options/Interfaces/IRepulseBase.js", "./Options/Interfaces/IRepulseDiv.js", "./Options/Interfaces/IRepulse.js"], factory);
|
|
21
|
+
define(["require", "exports", "./Repulser.js", "./Options/Classes/RepulseBase.js", "./Options/Classes/RepulseDiv.js", "./Options/Classes/Repulse.js", "./Options/Interfaces/IRepulseBase.js", "./Options/Interfaces/IRepulseDiv.js", "./Options/Interfaces/IRepulse.js"], factory);
|
|
34
22
|
}
|
|
35
23
|
})(function (require, exports) {
|
|
36
24
|
"use strict";
|
|
37
|
-
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
38
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
26
|
exports.loadExternalRepulseInteraction = void 0;
|
|
27
|
+
const Repulser_js_1 = require("./Repulser.js");
|
|
40
28
|
async function loadExternalRepulseInteraction(engine, refresh = true) {
|
|
41
|
-
await engine.addInteractor("externalRepulse",
|
|
42
|
-
|
|
43
|
-
return new Repulser(engine, container);
|
|
29
|
+
await engine.addInteractor("externalRepulse", container => {
|
|
30
|
+
return Promise.resolve(new Repulser_js_1.Repulser(engine, container));
|
|
44
31
|
}, refresh);
|
|
45
32
|
}
|
|
46
33
|
exports.loadExternalRepulseInteraction = loadExternalRepulseInteraction;
|
package/206.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 206.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_interaction_external_repulse=this.webpackChunk_tsparticles_interaction_external_repulse||[]).push([[206],{206:(e,t,i)=>{i.d(t,{Repulser:()=>c});var s=i(303),n=i(644);const o="repulse";class c extends s.ExternalInteractorBase{constructor(e,t){super(t),this._clickRepulse=()=>{const e=this.container,t=e.actualOptions.interactivity.modes.repulse;if(!t)return;const i=e.repulse??{particles:[]};if(i.finish||(i.count||(i.count=0),i.count++,i.count===e.particles.count&&(i.finish=!0)),i.clicking){const n=e.retina.repulseModeDistance;if(!n||n<0)return;const o=Math.pow(n/6,3),c=e.interactivity.mouse.clickPosition;if(void 0===c)return;const r=new s.Circle(c.x,c.y,o),a=e.particles.quadTree.query(r,(e=>this.isEnabled(e)));for(const e of a){const{dx:n,dy:r,distance:a}=(0,s.getDistances)(c,e.position),l=a**2,p=-o*t.speed/l;if(l<=o){i.particles.push(e);const t=s.Vector.create(n,r);t.length=p,e.velocity.setTo(t)}}}else if(!1===i.clicking){for(const e of i.particles)e.velocity.setTo(e.initialVelocity);i.particles=[]}},this._hoverRepulse=()=>{const e=this.container,t=e.interactivity.mouse.position,i=e.retina.repulseModeDistance;!i||i<0||!t||this._processRepulse(t,i,new s.Circle(t.x,t.y,i))},this._processRepulse=(e,t,i,n)=>{const o=this.container,c=o.particles.quadTree.query(i,(e=>this.isEnabled(e))),r=o.actualOptions.interactivity.modes.repulse;if(!r)return;const{easing:a,speed:l,factor:p,maxSpeed:u}=r,d=(0,s.getEasing)(a),f=(n?.speed??l)*p;for(const i of c){const{dx:n,dy:o,distance:c}=(0,s.getDistances)(i.position,e),r=(0,s.clamp)(d(1-c/t)*f,0,u),a=s.Vector.create(c?n/c*r:f,c?o/c*r:f);i.position.addTo(a)}},this._singleSelectorRepulse=(e,t)=>{const i=this.container,n=i.actualOptions.interactivity.modes.repulse;if(!n)return;const o=document.querySelectorAll(e);o.length&&o.forEach((e=>{const o=e,c=i.retina.pixelRatio,r={x:(o.offsetLeft+.5*o.offsetWidth)*c,y:(o.offsetTop+.5*o.offsetHeight)*c},a=.5*o.offsetWidth*c,l="circle"===t.type?new s.Circle(r.x,r.y,a):new s.Rectangle(o.offsetLeft*c,o.offsetTop*c,o.offsetWidth*c,o.offsetHeight*c),p=n.divs,u=(0,s.divMode)(p,o);this._processRepulse(r,a,l,u)}))},this._engine=e,t.repulse||(t.repulse={particles:[]}),this.handleClickMode=e=>{const i=this.container.actualOptions.interactivity.modes.repulse;if(!i||e!==o)return;t.repulse||(t.repulse={particles:[]});const n=t.repulse;n.clicking=!0,n.count=0;for(const e of t.repulse.particles)this.isEnabled(e)&&e.velocity.setTo(e.initialVelocity);n.particles=[],n.finish=!1,setTimeout((()=>{t.destroyed||(n.clicking=!1)}),i.duration*s.millisecondsToSeconds)}}clear(){}init(){const e=this.container,t=e.actualOptions.interactivity.modes.repulse;t&&(e.retina.repulseModeDistance=t.distance*e.retina.pixelRatio)}interact(){const e=this.container,t=e.actualOptions,i=e.interactivity.status===s.mouseMoveEvent,n=t.interactivity.events,c=n.onHover,r=c.enable,a=c.mode,l=n.onClick,p=l.enable,u=l.mode,d=n.onDiv;i&&r&&(0,s.isInArray)(o,a)?this._hoverRepulse():p&&(0,s.isInArray)(o,u)?this._clickRepulse():(0,s.divModeExecute)(o,d,((e,t)=>this._singleSelectorRepulse(e,t)))}isEnabled(e){const t=this.container,i=t.actualOptions,n=t.interactivity.mouse,c=(e?.interactivity??i.interactivity).events,r=c.onDiv,a=c.onHover,l=c.onClick,p=(0,s.isDivModeEnabled)(o,r);if(!(p||a.enable&&n.position||l.enable&&n.clickPosition))return!1;const u=a.mode,d=l.mode;return(0,s.isInArray)(o,u)||(0,s.isInArray)(o,d)||p}loadModeOptions(e,...t){e.repulse||(e.repulse=new n.Z);for(const i of t)e.repulse.load(i?.repulse)}reset(){}}}}]);
|
package/206.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Repulse External Interaction v3.3.0 by Matteo Bruni */
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Author : Matteo Bruni
|
|
3
|
-
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
-
* Demo / Generator : https://particles.js.org/
|
|
5
|
-
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
-
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.3.0
|
|
8
|
-
*/
|
|
9
|
-
"use strict";
|
|
10
|
-
/*
|
|
11
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
-
* This devtool is neither made for production nor for readable output files.
|
|
13
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
-
* or disable the default devtool with "devtool: false".
|
|
16
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
-
*/
|
|
18
|
-
(this["webpackChunk_tsparticles_interaction_external_repulse"] = this["webpackChunk_tsparticles_interaction_external_repulse"] || []).push([["dist_browser_Repulser_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/Repulser.js":
|
|
21
|
-
/*!**********************************!*\
|
|
22
|
-
!*** ./dist/browser/Repulser.js ***!
|
|
23
|
-
\**********************************/
|
|
24
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
|
-
|
|
26
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Repulser: () => (/* binding */ Repulser)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Repulse_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Repulse.js */ \"./dist/browser/Options/Classes/Repulse.js\");\n\n\nconst repulseMode = \"repulse\",\n minDistance = 0,\n repulseRadiusFactor = 6,\n repulseRadiusPower = 3,\n squarePower = 2,\n minRadius = 0,\n minSpeed = 0,\n easingOffset = 1,\n half = 0.5;\nclass Repulser extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(engine, container) {\n super(container);\n this._clickRepulse = () => {\n const container = this.container,\n repulseOptions = container.actualOptions.interactivity.modes.repulse;\n if (!repulseOptions) {\n return;\n }\n const repulse = container.repulse ?? {\n particles: []\n };\n if (!repulse.finish) {\n if (!repulse.count) {\n repulse.count = 0;\n }\n repulse.count++;\n if (repulse.count === container.particles.count) {\n repulse.finish = true;\n }\n }\n if (repulse.clicking) {\n const repulseDistance = container.retina.repulseModeDistance;\n if (!repulseDistance || repulseDistance < minDistance) {\n return;\n }\n const repulseRadius = Math.pow(repulseDistance / repulseRadiusFactor, repulseRadiusPower),\n mouseClickPos = container.interactivity.mouse.clickPosition;\n if (mouseClickPos === undefined) {\n return;\n }\n const range = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius),\n query = container.particles.quadTree.query(range, p => this.isEnabled(p));\n for (const particle of query) {\n const {\n dx,\n dy,\n distance\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(mouseClickPos, particle.position),\n d = distance ** squarePower,\n velocity = repulseOptions.speed,\n force = -repulseRadius * velocity / d;\n if (d <= repulseRadius) {\n repulse.particles.push(particle);\n const vect = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(dx, dy);\n vect.length = force;\n particle.velocity.setTo(vect);\n }\n }\n } else if (repulse.clicking === false) {\n for (const particle of repulse.particles) {\n particle.velocity.setTo(particle.initialVelocity);\n }\n repulse.particles = [];\n }\n };\n this._hoverRepulse = () => {\n const container = this.container,\n mousePos = container.interactivity.mouse.position,\n repulseRadius = container.retina.repulseModeDistance;\n if (!repulseRadius || repulseRadius < minRadius || !mousePos) {\n return;\n }\n this._processRepulse(mousePos, repulseRadius, new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(mousePos.x, mousePos.y, repulseRadius));\n };\n this._processRepulse = (position, repulseRadius, area, divRepulse) => {\n const container = this.container,\n query = container.particles.quadTree.query(area, p => this.isEnabled(p)),\n repulseOptions = container.actualOptions.interactivity.modes.repulse;\n if (!repulseOptions) {\n return;\n }\n const {\n easing,\n speed,\n factor,\n maxSpeed\n } = repulseOptions,\n easingFunc = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getEasing)(easing),\n velocity = (divRepulse?.speed ?? speed) * factor;\n for (const particle of query) {\n const {\n dx,\n dy,\n distance\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(particle.position, position),\n repulseFactor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(easingFunc(easingOffset - distance / repulseRadius) * velocity, minSpeed, maxSpeed),\n normVec = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(!distance ? velocity : dx / distance * repulseFactor, !distance ? velocity : dy / distance * repulseFactor);\n particle.position.addTo(normVec);\n }\n };\n this._singleSelectorRepulse = (selector, div) => {\n const container = this.container,\n repulse = container.actualOptions.interactivity.modes.repulse;\n if (!repulse) {\n return;\n }\n const query = document.querySelectorAll(selector);\n if (!query.length) {\n return;\n }\n query.forEach(item => {\n const elem = item,\n pxRatio = container.retina.pixelRatio,\n pos = {\n x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,\n y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio\n },\n repulseRadius = elem.offsetWidth * half * pxRatio,\n area = div.type === \"circle\" ? new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(pos.x, pos.y, repulseRadius) : new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),\n divs = repulse.divs,\n divRepulse = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divMode)(divs, elem);\n this._processRepulse(pos, repulseRadius, area, divRepulse);\n });\n };\n this._engine = engine;\n if (!container.repulse) {\n container.repulse = {\n particles: []\n };\n }\n this.handleClickMode = mode => {\n const options = this.container.actualOptions,\n repulseOpts = options.interactivity.modes.repulse;\n if (!repulseOpts || mode !== repulseMode) {\n return;\n }\n if (!container.repulse) {\n container.repulse = {\n particles: []\n };\n }\n const repulse = container.repulse;\n repulse.clicking = true;\n repulse.count = 0;\n for (const particle of container.repulse.particles) {\n if (!this.isEnabled(particle)) {\n continue;\n }\n particle.velocity.setTo(particle.initialVelocity);\n }\n repulse.particles = [];\n repulse.finish = false;\n setTimeout(() => {\n if (container.destroyed) {\n return;\n }\n repulse.clicking = false;\n }, repulseOpts.duration * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds);\n };\n }\n clear() {}\n init() {\n const container = this.container,\n repulse = container.actualOptions.interactivity.modes.repulse;\n if (!repulse) {\n return;\n }\n container.retina.repulseModeDistance = repulse.distance * container.retina.pixelRatio;\n }\n interact() {\n const container = this.container,\n options = container.actualOptions,\n mouseMoveStatus = container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseMoveEvent,\n events = options.interactivity.events,\n hover = events.onHover,\n hoverEnabled = hover.enable,\n hoverMode = hover.mode,\n click = events.onClick,\n clickEnabled = click.enable,\n clickMode = click.mode,\n divs = events.onDiv;\n if (mouseMoveStatus && hoverEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, hoverMode)) {\n this._hoverRepulse();\n } else if (clickEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, clickMode)) {\n this._clickRepulse();\n } else {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divModeExecute)(repulseMode, divs, (selector, div) => this._singleSelectorRepulse(selector, div));\n }\n }\n isEnabled(particle) {\n const container = this.container,\n options = container.actualOptions,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? options.interactivity).events,\n divs = events.onDiv,\n hover = events.onHover,\n click = events.onClick,\n divRepulse = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isDivModeEnabled)(repulseMode, divs);\n if (!(divRepulse || hover.enable && !!mouse.position || click.enable && mouse.clickPosition)) {\n return false;\n }\n const hoverMode = hover.mode,\n clickMode = click.mode;\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, hoverMode) || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, clickMode) || divRepulse;\n }\n loadModeOptions(options, ...sources) {\n if (!options.repulse) {\n options.repulse = new _Options_Classes_Repulse_js__WEBPACK_IMPORTED_MODULE_1__.Repulse();\n }\n for (const source of sources) {\n options.repulse.load(source?.repulse);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/Repulser.js?");
|
|
27
|
-
|
|
28
|
-
/***/ })
|
|
29
|
-
|
|
30
|
-
}]);
|