@tsparticles/updater-orbit 3.0.2 → 3.1.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/OrbitUpdater.js +13 -10
- package/browser/Utils.js +5 -4
- package/cjs/OrbitUpdater.js +13 -10
- package/cjs/Utils.js +4 -3
- package/esm/OrbitUpdater.js +13 -10
- package/esm/Utils.js +5 -4
- package/package.json +2 -2
- package/report.html +2 -2
- package/tsparticles.updater.orbit.js +27 -14
- package/tsparticles.updater.orbit.min.js +1 -1
- package/tsparticles.updater.orbit.min.js.LICENSE.txt +1 -1
- package/umd/OrbitUpdater.js +13 -10
- package/umd/Utils.js +4 -3
package/browser/OrbitUpdater.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getRangeValue, rangeColorToHsl, } from "@tsparticles/engine";
|
|
2
2
|
import { Orbit } from "./Options/Classes/Orbit.js";
|
|
3
3
|
import { drawEllipse } from "./Utils.js";
|
|
4
|
+
const double = 2, half = 0.5, doublePI = Math.PI * double, defaultOrbitSpeed = 0, halfPI = Math.PI * half, piAndAHalf = Math.PI + halfPI, startAngle = 0, defaultOpacity = 1, defaultWidth = 1, defaultRotation = 0;
|
|
4
5
|
export class OrbitUpdater {
|
|
5
6
|
constructor(container) {
|
|
6
7
|
this.container = container;
|
|
@@ -22,19 +23,19 @@ export class OrbitUpdater {
|
|
|
22
23
|
let start, end;
|
|
23
24
|
switch (type) {
|
|
24
25
|
case "back":
|
|
25
|
-
start =
|
|
26
|
-
end =
|
|
26
|
+
start = halfPI;
|
|
27
|
+
end = piAndAHalf;
|
|
27
28
|
break;
|
|
28
29
|
case "front":
|
|
29
|
-
start =
|
|
30
|
-
end =
|
|
30
|
+
start = piAndAHalf;
|
|
31
|
+
end = halfPI;
|
|
31
32
|
break;
|
|
32
33
|
default:
|
|
33
|
-
start =
|
|
34
|
-
end =
|
|
34
|
+
start = startAngle;
|
|
35
|
+
end = doublePI;
|
|
35
36
|
}
|
|
36
37
|
container.canvas.draw((ctx) => {
|
|
37
|
-
drawEllipse(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ??
|
|
38
|
+
drawEllipse(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
init(particle) {
|
|
@@ -49,7 +50,9 @@ export class OrbitUpdater {
|
|
|
49
50
|
? getRangeValue(orbitOptions.radius) * container.retina.pixelRatio
|
|
50
51
|
: undefined;
|
|
51
52
|
container.retina.orbitRadius = particle.retina.orbitRadius;
|
|
52
|
-
particle.orbitAnimationSpeed = orbitOptions.animation.enable
|
|
53
|
+
particle.orbitAnimationSpeed = orbitOptions.animation.enable
|
|
54
|
+
? getRangeValue(orbitOptions.animation.speed)
|
|
55
|
+
: defaultOrbitSpeed;
|
|
53
56
|
particle.orbitWidth = getRangeValue(orbitOptions.width);
|
|
54
57
|
particle.orbitOpacity = getRangeValue(orbitOptions.opacity);
|
|
55
58
|
}
|
|
@@ -70,8 +73,8 @@ export class OrbitUpdater {
|
|
|
70
73
|
return;
|
|
71
74
|
}
|
|
72
75
|
if (particle.orbitRotation === undefined) {
|
|
73
|
-
particle.orbitRotation =
|
|
76
|
+
particle.orbitRotation = defaultRotation;
|
|
74
77
|
}
|
|
75
|
-
particle.orbitRotation += (particle.orbitAnimationSpeed ??
|
|
78
|
+
particle.orbitRotation += (particle.orbitAnimationSpeed ?? defaultOrbitSpeed / doublePI) * delta.factor;
|
|
76
79
|
}
|
|
77
80
|
}
|
package/browser/Utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { getStyleFromHsl } from "@tsparticles/engine";
|
|
1
|
+
import { degToRad, getStyleFromHsl } from "@tsparticles/engine";
|
|
2
|
+
const minWidth = 0, half = 0.5, double = 2;
|
|
2
3
|
export function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
3
|
-
if (width <=
|
|
4
|
+
if (width <= minWidth) {
|
|
4
5
|
return;
|
|
5
6
|
}
|
|
6
7
|
const pos = particle.getPosition();
|
|
@@ -8,8 +9,8 @@ export function drawEllipse(context, particle, fillColorValue, radius, opacity,
|
|
|
8
9
|
context.strokeStyle = getStyleFromHsl(fillColorValue, opacity);
|
|
9
10
|
}
|
|
10
11
|
context.lineWidth = width;
|
|
11
|
-
const rotationRadian = (rotation
|
|
12
|
+
const rotationRadian = degToRad(rotation);
|
|
12
13
|
context.beginPath();
|
|
13
|
-
context.ellipse(pos.x, pos.y, radius
|
|
14
|
+
context.ellipse(pos.x, pos.y, radius * half, radius * double, rotationRadian, start, end);
|
|
14
15
|
context.stroke();
|
|
15
16
|
}
|
package/cjs/OrbitUpdater.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.OrbitUpdater = void 0;
|
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
5
|
const Orbit_js_1 = require("./Options/Classes/Orbit.js");
|
|
6
6
|
const Utils_js_1 = require("./Utils.js");
|
|
7
|
+
const double = 2, half = 0.5, doublePI = Math.PI * double, defaultOrbitSpeed = 0, halfPI = Math.PI * half, piAndAHalf = Math.PI + halfPI, startAngle = 0, defaultOpacity = 1, defaultWidth = 1, defaultRotation = 0;
|
|
7
8
|
class OrbitUpdater {
|
|
8
9
|
constructor(container) {
|
|
9
10
|
this.container = container;
|
|
@@ -25,19 +26,19 @@ class OrbitUpdater {
|
|
|
25
26
|
let start, end;
|
|
26
27
|
switch (type) {
|
|
27
28
|
case "back":
|
|
28
|
-
start =
|
|
29
|
-
end =
|
|
29
|
+
start = halfPI;
|
|
30
|
+
end = piAndAHalf;
|
|
30
31
|
break;
|
|
31
32
|
case "front":
|
|
32
|
-
start =
|
|
33
|
-
end =
|
|
33
|
+
start = piAndAHalf;
|
|
34
|
+
end = halfPI;
|
|
34
35
|
break;
|
|
35
36
|
default:
|
|
36
|
-
start =
|
|
37
|
-
end =
|
|
37
|
+
start = startAngle;
|
|
38
|
+
end = doublePI;
|
|
38
39
|
}
|
|
39
40
|
container.canvas.draw((ctx) => {
|
|
40
|
-
(0, Utils_js_1.drawEllipse)(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ??
|
|
41
|
+
(0, Utils_js_1.drawEllipse)(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
init(particle) {
|
|
@@ -52,7 +53,9 @@ class OrbitUpdater {
|
|
|
52
53
|
? (0, engine_1.getRangeValue)(orbitOptions.radius) * container.retina.pixelRatio
|
|
53
54
|
: undefined;
|
|
54
55
|
container.retina.orbitRadius = particle.retina.orbitRadius;
|
|
55
|
-
particle.orbitAnimationSpeed = orbitOptions.animation.enable
|
|
56
|
+
particle.orbitAnimationSpeed = orbitOptions.animation.enable
|
|
57
|
+
? (0, engine_1.getRangeValue)(orbitOptions.animation.speed)
|
|
58
|
+
: defaultOrbitSpeed;
|
|
56
59
|
particle.orbitWidth = (0, engine_1.getRangeValue)(orbitOptions.width);
|
|
57
60
|
particle.orbitOpacity = (0, engine_1.getRangeValue)(orbitOptions.opacity);
|
|
58
61
|
}
|
|
@@ -73,9 +76,9 @@ class OrbitUpdater {
|
|
|
73
76
|
return;
|
|
74
77
|
}
|
|
75
78
|
if (particle.orbitRotation === undefined) {
|
|
76
|
-
particle.orbitRotation =
|
|
79
|
+
particle.orbitRotation = defaultRotation;
|
|
77
80
|
}
|
|
78
|
-
particle.orbitRotation += (particle.orbitAnimationSpeed ??
|
|
81
|
+
particle.orbitRotation += (particle.orbitAnimationSpeed ?? defaultOrbitSpeed / doublePI) * delta.factor;
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
exports.OrbitUpdater = OrbitUpdater;
|
package/cjs/Utils.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.drawEllipse = void 0;
|
|
4
4
|
const engine_1 = require("@tsparticles/engine");
|
|
5
|
+
const minWidth = 0, half = 0.5, double = 2;
|
|
5
6
|
function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
6
|
-
if (width <=
|
|
7
|
+
if (width <= minWidth) {
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
9
10
|
const pos = particle.getPosition();
|
|
@@ -11,9 +12,9 @@ function drawEllipse(context, particle, fillColorValue, radius, opacity, width,
|
|
|
11
12
|
context.strokeStyle = (0, engine_1.getStyleFromHsl)(fillColorValue, opacity);
|
|
12
13
|
}
|
|
13
14
|
context.lineWidth = width;
|
|
14
|
-
const rotationRadian = (
|
|
15
|
+
const rotationRadian = (0, engine_1.degToRad)(rotation);
|
|
15
16
|
context.beginPath();
|
|
16
|
-
context.ellipse(pos.x, pos.y, radius
|
|
17
|
+
context.ellipse(pos.x, pos.y, radius * half, radius * double, rotationRadian, start, end);
|
|
17
18
|
context.stroke();
|
|
18
19
|
}
|
|
19
20
|
exports.drawEllipse = drawEllipse;
|
package/esm/OrbitUpdater.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getRangeValue, rangeColorToHsl, } from "@tsparticles/engine";
|
|
2
2
|
import { Orbit } from "./Options/Classes/Orbit.js";
|
|
3
3
|
import { drawEllipse } from "./Utils.js";
|
|
4
|
+
const double = 2, half = 0.5, doublePI = Math.PI * double, defaultOrbitSpeed = 0, halfPI = Math.PI * half, piAndAHalf = Math.PI + halfPI, startAngle = 0, defaultOpacity = 1, defaultWidth = 1, defaultRotation = 0;
|
|
4
5
|
export class OrbitUpdater {
|
|
5
6
|
constructor(container) {
|
|
6
7
|
this.container = container;
|
|
@@ -22,19 +23,19 @@ export class OrbitUpdater {
|
|
|
22
23
|
let start, end;
|
|
23
24
|
switch (type) {
|
|
24
25
|
case "back":
|
|
25
|
-
start =
|
|
26
|
-
end =
|
|
26
|
+
start = halfPI;
|
|
27
|
+
end = piAndAHalf;
|
|
27
28
|
break;
|
|
28
29
|
case "front":
|
|
29
|
-
start =
|
|
30
|
-
end =
|
|
30
|
+
start = piAndAHalf;
|
|
31
|
+
end = halfPI;
|
|
31
32
|
break;
|
|
32
33
|
default:
|
|
33
|
-
start =
|
|
34
|
-
end =
|
|
34
|
+
start = startAngle;
|
|
35
|
+
end = doublePI;
|
|
35
36
|
}
|
|
36
37
|
container.canvas.draw((ctx) => {
|
|
37
|
-
drawEllipse(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ??
|
|
38
|
+
drawEllipse(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
init(particle) {
|
|
@@ -49,7 +50,9 @@ export class OrbitUpdater {
|
|
|
49
50
|
? getRangeValue(orbitOptions.radius) * container.retina.pixelRatio
|
|
50
51
|
: undefined;
|
|
51
52
|
container.retina.orbitRadius = particle.retina.orbitRadius;
|
|
52
|
-
particle.orbitAnimationSpeed = orbitOptions.animation.enable
|
|
53
|
+
particle.orbitAnimationSpeed = orbitOptions.animation.enable
|
|
54
|
+
? getRangeValue(orbitOptions.animation.speed)
|
|
55
|
+
: defaultOrbitSpeed;
|
|
53
56
|
particle.orbitWidth = getRangeValue(orbitOptions.width);
|
|
54
57
|
particle.orbitOpacity = getRangeValue(orbitOptions.opacity);
|
|
55
58
|
}
|
|
@@ -70,8 +73,8 @@ export class OrbitUpdater {
|
|
|
70
73
|
return;
|
|
71
74
|
}
|
|
72
75
|
if (particle.orbitRotation === undefined) {
|
|
73
|
-
particle.orbitRotation =
|
|
76
|
+
particle.orbitRotation = defaultRotation;
|
|
74
77
|
}
|
|
75
|
-
particle.orbitRotation += (particle.orbitAnimationSpeed ??
|
|
78
|
+
particle.orbitRotation += (particle.orbitAnimationSpeed ?? defaultOrbitSpeed / doublePI) * delta.factor;
|
|
76
79
|
}
|
|
77
80
|
}
|
package/esm/Utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { getStyleFromHsl } from "@tsparticles/engine";
|
|
1
|
+
import { degToRad, getStyleFromHsl } from "@tsparticles/engine";
|
|
2
|
+
const minWidth = 0, half = 0.5, double = 2;
|
|
2
3
|
export function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
3
|
-
if (width <=
|
|
4
|
+
if (width <= minWidth) {
|
|
4
5
|
return;
|
|
5
6
|
}
|
|
6
7
|
const pos = particle.getPosition();
|
|
@@ -8,8 +9,8 @@ export function drawEllipse(context, particle, fillColorValue, radius, opacity,
|
|
|
8
9
|
context.strokeStyle = getStyleFromHsl(fillColorValue, opacity);
|
|
9
10
|
}
|
|
10
11
|
context.lineWidth = width;
|
|
11
|
-
const rotationRadian = (rotation
|
|
12
|
+
const rotationRadian = degToRad(rotation);
|
|
12
13
|
context.beginPath();
|
|
13
|
-
context.ellipse(pos.x, pos.y, radius
|
|
14
|
+
context.ellipse(pos.x, pos.y, radius * half, radius * double, rotationRadian, start, end);
|
|
14
15
|
context.stroke();
|
|
15
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-orbit",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "tsParticles particles orbit updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"./package.json": "./package.json"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@tsparticles/engine": "^3.0
|
|
104
|
+
"@tsparticles/engine": "^3.1.0"
|
|
105
105
|
},
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"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/updater-orbit [
|
|
6
|
+
<title>@tsparticles/updater-orbit [13 Jan 2024 at 23:08]</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>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<body>
|
|
32
32
|
<div id="app"></div>
|
|
33
33
|
<script>
|
|
34
|
-
window.chartData = [{"label":"tsparticles.updater.orbit.js","isAsset":true,"statSize":
|
|
34
|
+
window.chartData = [{"label":"tsparticles.updater.orbit.js","isAsset":true,"statSize":5047,"parsedSize":9017,"gzipSize":2562,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":5005,"groups":[{"id":199,"label":"index.js + 4 modules (concatenated)","path":"./dist/browser/index.js + 4 modules (concatenated)","statSize":5005,"parsedSize":9017,"gzipSize":2562,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser","statSize":5005,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/index.js","statSize":211,"parsedSize":380,"gzipSize":108,"inaccurateSizes":true},{"id":null,"label":"OrbitUpdater.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/OrbitUpdater.js","statSize":3001,"parsedSize":5406,"gzipSize":1536,"inaccurateSizes":true},{"id":null,"label":"Utils.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Utils.js","statSize":612,"parsedSize":1102,"gzipSize":313,"inaccurateSizes":true},{"label":"Options/Classes","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Options/Classes","statSize":1181,"groups":[{"id":null,"label":"Orbit.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Options/Classes/Orbit.js","statSize":925,"parsedSize":1666,"gzipSize":473,"inaccurateSizes":true},{"id":null,"label":"OrbitRotation.js","path":"./dist/browser/index.js + 4 modules (concatenated)/dist/browser/Options/Classes/OrbitRotation.js","statSize":256,"parsedSize":461,"gzipSize":131,"inaccurateSizes":true}],"parsedSize":2127,"gzipSize":604,"inaccurateSizes":true}],"parsedSize":9017,"gzipSize":2562,"inaccurateSizes":true}]}],"parsedSize":9017,"gzipSize":2562},{"label":"engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles","statSize":42,"groups":[{"id":533,"label":"engine\",\"root\":\"window\"}","path":"./engine\",\"commonjs2\":\"@tsparticles/engine\",\"amd\":\"@tsparticles/engine\",\"root\":\"window\"}","statSize":42}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"tsparticles.updater.orbit":true}}];
|
|
35
35
|
window.entrypoints = ["tsparticles.updater.orbit","tsparticles.updater.orbit.min"];
|
|
36
36
|
window.defaultSizes = "parsed";
|
|
37
37
|
</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.0
|
|
7
|
+
* v3.1.0
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -146,8 +146,11 @@ class Orbit {
|
|
|
146
146
|
}
|
|
147
147
|
;// CONCATENATED MODULE: ./dist/browser/Utils.js
|
|
148
148
|
|
|
149
|
+
const minWidth = 0,
|
|
150
|
+
half = 0.5,
|
|
151
|
+
Utils_double = 2;
|
|
149
152
|
function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
150
|
-
if (width <=
|
|
153
|
+
if (width <= minWidth) {
|
|
151
154
|
return;
|
|
152
155
|
}
|
|
153
156
|
const pos = particle.getPosition();
|
|
@@ -155,15 +158,25 @@ function drawEllipse(context, particle, fillColorValue, radius, opacity, width,
|
|
|
155
158
|
context.strokeStyle = (0,engine_root_window_.getStyleFromHsl)(fillColorValue, opacity);
|
|
156
159
|
}
|
|
157
160
|
context.lineWidth = width;
|
|
158
|
-
const rotationRadian = rotation
|
|
161
|
+
const rotationRadian = (0,engine_root_window_.degToRad)(rotation);
|
|
159
162
|
context.beginPath();
|
|
160
|
-
context.ellipse(pos.x, pos.y, radius
|
|
163
|
+
context.ellipse(pos.x, pos.y, radius * half, radius * Utils_double, rotationRadian, start, end);
|
|
161
164
|
context.stroke();
|
|
162
165
|
}
|
|
163
166
|
;// CONCATENATED MODULE: ./dist/browser/OrbitUpdater.js
|
|
164
167
|
|
|
165
168
|
|
|
166
169
|
|
|
170
|
+
const OrbitUpdater_double = 2,
|
|
171
|
+
OrbitUpdater_half = 0.5,
|
|
172
|
+
doublePI = Math.PI * OrbitUpdater_double,
|
|
173
|
+
defaultOrbitSpeed = 0,
|
|
174
|
+
halfPI = Math.PI * OrbitUpdater_half,
|
|
175
|
+
piAndAHalf = Math.PI + halfPI,
|
|
176
|
+
startAngle = 0,
|
|
177
|
+
defaultOpacity = 1,
|
|
178
|
+
defaultWidth = 1,
|
|
179
|
+
defaultRotation = 0;
|
|
167
180
|
class OrbitUpdater {
|
|
168
181
|
constructor(container) {
|
|
169
182
|
this.container = container;
|
|
@@ -185,19 +198,19 @@ class OrbitUpdater {
|
|
|
185
198
|
let start, end;
|
|
186
199
|
switch (type) {
|
|
187
200
|
case "back":
|
|
188
|
-
start =
|
|
189
|
-
end =
|
|
201
|
+
start = halfPI;
|
|
202
|
+
end = piAndAHalf;
|
|
190
203
|
break;
|
|
191
204
|
case "front":
|
|
192
|
-
start =
|
|
193
|
-
end =
|
|
205
|
+
start = piAndAHalf;
|
|
206
|
+
end = halfPI;
|
|
194
207
|
break;
|
|
195
208
|
default:
|
|
196
|
-
start =
|
|
197
|
-
end =
|
|
209
|
+
start = startAngle;
|
|
210
|
+
end = doublePI;
|
|
198
211
|
}
|
|
199
212
|
container.canvas.draw(ctx => {
|
|
200
|
-
drawEllipse(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ??
|
|
213
|
+
drawEllipse(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);
|
|
201
214
|
});
|
|
202
215
|
}
|
|
203
216
|
init(particle) {
|
|
@@ -211,7 +224,7 @@ class OrbitUpdater {
|
|
|
211
224
|
particle.orbitColor = (0,engine_root_window_.rangeColorToHsl)(orbitOptions.color);
|
|
212
225
|
particle.retina.orbitRadius = orbitOptions.radius !== undefined ? (0,engine_root_window_.getRangeValue)(orbitOptions.radius) * container.retina.pixelRatio : undefined;
|
|
213
226
|
container.retina.orbitRadius = particle.retina.orbitRadius;
|
|
214
|
-
particle.orbitAnimationSpeed = orbitOptions.animation.enable ? (0,engine_root_window_.getRangeValue)(orbitOptions.animation.speed) :
|
|
227
|
+
particle.orbitAnimationSpeed = orbitOptions.animation.enable ? (0,engine_root_window_.getRangeValue)(orbitOptions.animation.speed) : defaultOrbitSpeed;
|
|
215
228
|
particle.orbitWidth = (0,engine_root_window_.getRangeValue)(orbitOptions.width);
|
|
216
229
|
particle.orbitOpacity = (0,engine_root_window_.getRangeValue)(orbitOptions.opacity);
|
|
217
230
|
}
|
|
@@ -232,9 +245,9 @@ class OrbitUpdater {
|
|
|
232
245
|
return;
|
|
233
246
|
}
|
|
234
247
|
if (particle.orbitRotation === undefined) {
|
|
235
|
-
particle.orbitRotation =
|
|
248
|
+
particle.orbitRotation = defaultRotation;
|
|
236
249
|
}
|
|
237
|
-
particle.orbitRotation += (particle.orbitAnimationSpeed ??
|
|
250
|
+
particle.orbitRotation += (particle.orbitAnimationSpeed ?? defaultOrbitSpeed / doublePI) * delta.factor;
|
|
238
251
|
}
|
|
239
252
|
}
|
|
240
253
|
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.updater.orbit.min.js.LICENSE.txt */
|
|
2
|
-
!function(t,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],o);else{var
|
|
2
|
+
!function(t,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],o);else{var e="object"==typeof exports?o(require("@tsparticles/engine")):o(t.window);for(var i in e)("object"==typeof exports?exports:t)[i]=e[i]}}(this,(t=>(()=>{"use strict";var o={533:o=>{o.exports=t}},e={};function i(t){var a=e[t];if(void 0!==a)return a.exports;var r=e[t]={exports:{}};return o[t](r,r.exports,i),r.exports}i.d=(t,o)=>{for(var e in o)i.o(o,e)&&!i.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:o[e]})},i.o=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var a={};return(()=>{i.r(a),i.d(a,{loadOrbitUpdater:()=>l});var t=i(533);class o extends t.ValueWithRandom{constructor(){super(),this.value=45}load(t){void 0!==t&&super.load(t)}}class e{constructor(){this.animation=new t.AnimationOptions,this.enable=!1,this.opacity=1,this.rotation=new o,this.width=1}load(o){o&&(this.animation.load(o.animation),this.rotation.load(o.rotation),void 0!==o.enable&&(this.enable=o.enable),void 0!==o.opacity&&(this.opacity=(0,t.setRangeValue)(o.opacity)),void 0!==o.width&&(this.width=(0,t.setRangeValue)(o.width)),void 0!==o.radius&&(this.radius=(0,t.setRangeValue)(o.radius)),void 0!==o.color&&(this.color=t.OptionsColor.create(this.color,o.color)))}}const r=2*Math.PI,n=.5*Math.PI,s=Math.PI+n;class d{constructor(t){this.container=t}afterDraw(t){const o=t.options.orbit;o?.enable&&this.drawOrbit(t,"front")}beforeDraw(t){const o=t.options.orbit;o?.enable&&this.drawOrbit(t,"back")}drawOrbit(o,e){const i=this.container;let a,d;switch(e){case"back":a=n,d=s;break;case"front":a=s,d=n;break;default:a=0,d=r}i.canvas.draw((e=>{!function(o,e,i,a,r,n,s,d,l){if(n<=0)return;const c=e.getPosition();i&&(o.strokeStyle=(0,t.getStyleFromHsl)(i,r)),o.lineWidth=n;const b=(0,t.degToRad)(s);o.beginPath(),o.ellipse(c.x,c.y,.5*a,2*a,b,d,l),o.stroke()}(e,o,o.orbitColor??o.getFillColor(),o.retina.orbitRadius??i.retina.orbitRadius??o.getRadius(),o.orbitOpacity??1,o.orbitWidth??1,(o.orbitRotation??0)*i.retina.pixelRatio,a,d)}))}init(o){const e=this.container,i=o.options.orbit;i?.enable&&(o.orbitRotation=(0,t.getRangeValue)(i.rotation.value),o.orbitColor=(0,t.rangeColorToHsl)(i.color),o.retina.orbitRadius=void 0!==i.radius?(0,t.getRangeValue)(i.radius)*e.retina.pixelRatio:void 0,e.retina.orbitRadius=o.retina.orbitRadius,o.orbitAnimationSpeed=i.animation.enable?(0,t.getRangeValue)(i.animation.speed):0,o.orbitWidth=(0,t.getRangeValue)(i.width),o.orbitOpacity=(0,t.getRangeValue)(i.opacity))}isEnabled(t){const o=t.options.orbit?.animation;return!t.destroyed&&!t.spawning&&!!o?.enable}loadOptions(t,...o){t.orbit||(t.orbit=new e);for(const e of o)t.orbit.load(e?.orbit)}update(t,o){this.isEnabled(t)&&(void 0===t.orbitRotation&&(t.orbitRotation=0),t.orbitRotation+=(t.orbitAnimationSpeed??0/r)*o.factor)}}async function l(t,o=!0){await t.addParticleUpdater("orbit",(t=>new d(t)),o)}})(),a})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Orbit Updater v3.0
|
|
1
|
+
/*! tsParticles Orbit Updater v3.1.0 by Matteo Bruni */
|
package/umd/OrbitUpdater.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const Orbit_js_1 = require("./Options/Classes/Orbit.js");
|
|
15
15
|
const Utils_js_1 = require("./Utils.js");
|
|
16
|
+
const double = 2, half = 0.5, doublePI = Math.PI * double, defaultOrbitSpeed = 0, halfPI = Math.PI * half, piAndAHalf = Math.PI + halfPI, startAngle = 0, defaultOpacity = 1, defaultWidth = 1, defaultRotation = 0;
|
|
16
17
|
class OrbitUpdater {
|
|
17
18
|
constructor(container) {
|
|
18
19
|
this.container = container;
|
|
@@ -34,19 +35,19 @@
|
|
|
34
35
|
let start, end;
|
|
35
36
|
switch (type) {
|
|
36
37
|
case "back":
|
|
37
|
-
start =
|
|
38
|
-
end =
|
|
38
|
+
start = halfPI;
|
|
39
|
+
end = piAndAHalf;
|
|
39
40
|
break;
|
|
40
41
|
case "front":
|
|
41
|
-
start =
|
|
42
|
-
end =
|
|
42
|
+
start = piAndAHalf;
|
|
43
|
+
end = halfPI;
|
|
43
44
|
break;
|
|
44
45
|
default:
|
|
45
|
-
start =
|
|
46
|
-
end =
|
|
46
|
+
start = startAngle;
|
|
47
|
+
end = doublePI;
|
|
47
48
|
}
|
|
48
49
|
container.canvas.draw((ctx) => {
|
|
49
|
-
(0, Utils_js_1.drawEllipse)(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ??
|
|
50
|
+
(0, Utils_js_1.drawEllipse)(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
init(particle) {
|
|
@@ -61,7 +62,9 @@
|
|
|
61
62
|
? (0, engine_1.getRangeValue)(orbitOptions.radius) * container.retina.pixelRatio
|
|
62
63
|
: undefined;
|
|
63
64
|
container.retina.orbitRadius = particle.retina.orbitRadius;
|
|
64
|
-
particle.orbitAnimationSpeed = orbitOptions.animation.enable
|
|
65
|
+
particle.orbitAnimationSpeed = orbitOptions.animation.enable
|
|
66
|
+
? (0, engine_1.getRangeValue)(orbitOptions.animation.speed)
|
|
67
|
+
: defaultOrbitSpeed;
|
|
65
68
|
particle.orbitWidth = (0, engine_1.getRangeValue)(orbitOptions.width);
|
|
66
69
|
particle.orbitOpacity = (0, engine_1.getRangeValue)(orbitOptions.opacity);
|
|
67
70
|
}
|
|
@@ -82,9 +85,9 @@
|
|
|
82
85
|
return;
|
|
83
86
|
}
|
|
84
87
|
if (particle.orbitRotation === undefined) {
|
|
85
|
-
particle.orbitRotation =
|
|
88
|
+
particle.orbitRotation = defaultRotation;
|
|
86
89
|
}
|
|
87
|
-
particle.orbitRotation += (particle.orbitAnimationSpeed ??
|
|
90
|
+
particle.orbitRotation += (particle.orbitAnimationSpeed ?? defaultOrbitSpeed / doublePI) * delta.factor;
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
exports.OrbitUpdater = OrbitUpdater;
|
package/umd/Utils.js
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.drawEllipse = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
const minWidth = 0, half = 0.5, double = 2;
|
|
14
15
|
function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
15
|
-
if (width <=
|
|
16
|
+
if (width <= minWidth) {
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
19
|
const pos = particle.getPosition();
|
|
@@ -20,9 +21,9 @@
|
|
|
20
21
|
context.strokeStyle = (0, engine_1.getStyleFromHsl)(fillColorValue, opacity);
|
|
21
22
|
}
|
|
22
23
|
context.lineWidth = width;
|
|
23
|
-
const rotationRadian = (
|
|
24
|
+
const rotationRadian = (0, engine_1.degToRad)(rotation);
|
|
24
25
|
context.beginPath();
|
|
25
|
-
context.ellipse(pos.x, pos.y, radius
|
|
26
|
+
context.ellipse(pos.x, pos.y, radius * half, radius * double, rotationRadian, start, end);
|
|
26
27
|
context.stroke();
|
|
27
28
|
}
|
|
28
29
|
exports.drawEllipse = drawEllipse;
|