@tsparticles/shape-path 3.0.3 → 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/Utils.js +19 -13
- package/cjs/Utils.js +19 -13
- package/esm/Utils.js +19 -13
- package/package.json +2 -2
- package/report.html +2 -2
- package/tsparticles.shape.path.js +29 -14
- package/tsparticles.shape.path.min.js +1 -1
- package/tsparticles.shape.path.min.js.LICENSE.txt +1 -1
- package/umd/Utils.js +19 -13
package/browser/Utils.js
CHANGED
|
@@ -1,38 +1,44 @@
|
|
|
1
1
|
export function drawPath(ctx, radius, path) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const firstIndex = 0, firstSegment = path.segments[firstIndex], firstValue = firstSegment.values[firstIndex];
|
|
3
|
+
ctx.moveTo(firstValue.x * radius, firstValue.y * radius);
|
|
4
|
+
for (const segment of path.segments) {
|
|
5
|
+
const value = segment.values[firstIndex], index2 = 1, index3 = 2, index4 = 3;
|
|
5
6
|
switch (segment.type) {
|
|
6
7
|
case "line":
|
|
7
|
-
ctx.lineTo(
|
|
8
|
+
ctx.lineTo(value.x * radius, value.y * radius);
|
|
8
9
|
break;
|
|
9
10
|
case "bezier":
|
|
10
|
-
ctx.bezierCurveTo(segment.values[
|
|
11
|
+
ctx.bezierCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius, segment.values[index4].x * radius, segment.values[index4].y * radius);
|
|
11
12
|
break;
|
|
12
13
|
case "quadratic":
|
|
13
|
-
ctx.quadraticCurveTo(segment.values[
|
|
14
|
+
ctx.quadraticCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius);
|
|
14
15
|
break;
|
|
15
16
|
case "arc":
|
|
16
|
-
ctx.arc(
|
|
17
|
+
ctx.arc(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index3].x, segment.values[index3].y);
|
|
17
18
|
break;
|
|
18
19
|
case "ellipse":
|
|
19
|
-
ctx.ellipse(
|
|
20
|
+
ctx.ellipse(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x, segment.values[index4].x, segment.values[index4].y);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
if (!path.half) {
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
const lengthOffset = 1, minLength = 0;
|
|
27
|
+
for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {
|
|
28
|
+
const segment = path.segments[i], value = segment.values[firstIndex], index2 = 1, index3 = 2;
|
|
27
29
|
switch (segment.type) {
|
|
28
30
|
case "line":
|
|
29
|
-
ctx.lineTo(
|
|
31
|
+
ctx.lineTo(value.x * -radius, value.y * radius);
|
|
30
32
|
break;
|
|
31
33
|
case "bezier":
|
|
32
|
-
ctx.bezierCurveTo(-segment.values[
|
|
34
|
+
ctx.bezierCurveTo(-segment.values[index3].x * radius, segment.values[index3].y * radius, -segment.values[index2].x * radius, segment.values[index2].y * radius, value.x * radius, value.y * radius);
|
|
33
35
|
break;
|
|
34
36
|
case "quadratic":
|
|
35
|
-
ctx.quadraticCurveTo(-segment.values[
|
|
37
|
+
ctx.quadraticCurveTo(-segment.values[index2].x * radius, segment.values[index2].y * radius, -segment.values[index3].x * radius, segment.values[index3].y * radius);
|
|
38
|
+
break;
|
|
39
|
+
case "arc":
|
|
40
|
+
case "ellipse":
|
|
41
|
+
default:
|
|
36
42
|
break;
|
|
37
43
|
}
|
|
38
44
|
}
|
package/cjs/Utils.js
CHANGED
|
@@ -2,40 +2,46 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.drawPath = void 0;
|
|
4
4
|
function drawPath(ctx, radius, path) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const firstIndex = 0, firstSegment = path.segments[firstIndex], firstValue = firstSegment.values[firstIndex];
|
|
6
|
+
ctx.moveTo(firstValue.x * radius, firstValue.y * radius);
|
|
7
|
+
for (const segment of path.segments) {
|
|
8
|
+
const value = segment.values[firstIndex], index2 = 1, index3 = 2, index4 = 3;
|
|
8
9
|
switch (segment.type) {
|
|
9
10
|
case "line":
|
|
10
|
-
ctx.lineTo(
|
|
11
|
+
ctx.lineTo(value.x * radius, value.y * radius);
|
|
11
12
|
break;
|
|
12
13
|
case "bezier":
|
|
13
|
-
ctx.bezierCurveTo(segment.values[
|
|
14
|
+
ctx.bezierCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius, segment.values[index4].x * radius, segment.values[index4].y * radius);
|
|
14
15
|
break;
|
|
15
16
|
case "quadratic":
|
|
16
|
-
ctx.quadraticCurveTo(segment.values[
|
|
17
|
+
ctx.quadraticCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius);
|
|
17
18
|
break;
|
|
18
19
|
case "arc":
|
|
19
|
-
ctx.arc(
|
|
20
|
+
ctx.arc(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index3].x, segment.values[index3].y);
|
|
20
21
|
break;
|
|
21
22
|
case "ellipse":
|
|
22
|
-
ctx.ellipse(
|
|
23
|
+
ctx.ellipse(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x, segment.values[index4].x, segment.values[index4].y);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
if (!path.half) {
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const lengthOffset = 1, minLength = 0;
|
|
30
|
+
for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {
|
|
31
|
+
const segment = path.segments[i], value = segment.values[firstIndex], index2 = 1, index3 = 2;
|
|
30
32
|
switch (segment.type) {
|
|
31
33
|
case "line":
|
|
32
|
-
ctx.lineTo(
|
|
34
|
+
ctx.lineTo(value.x * -radius, value.y * radius);
|
|
33
35
|
break;
|
|
34
36
|
case "bezier":
|
|
35
|
-
ctx.bezierCurveTo(-segment.values[
|
|
37
|
+
ctx.bezierCurveTo(-segment.values[index3].x * radius, segment.values[index3].y * radius, -segment.values[index2].x * radius, segment.values[index2].y * radius, value.x * radius, value.y * radius);
|
|
36
38
|
break;
|
|
37
39
|
case "quadratic":
|
|
38
|
-
ctx.quadraticCurveTo(-segment.values[
|
|
40
|
+
ctx.quadraticCurveTo(-segment.values[index2].x * radius, segment.values[index2].y * radius, -segment.values[index3].x * radius, segment.values[index3].y * radius);
|
|
41
|
+
break;
|
|
42
|
+
case "arc":
|
|
43
|
+
case "ellipse":
|
|
44
|
+
default:
|
|
39
45
|
break;
|
|
40
46
|
}
|
|
41
47
|
}
|
package/esm/Utils.js
CHANGED
|
@@ -1,38 +1,44 @@
|
|
|
1
1
|
export function drawPath(ctx, radius, path) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const firstIndex = 0, firstSegment = path.segments[firstIndex], firstValue = firstSegment.values[firstIndex];
|
|
3
|
+
ctx.moveTo(firstValue.x * radius, firstValue.y * radius);
|
|
4
|
+
for (const segment of path.segments) {
|
|
5
|
+
const value = segment.values[firstIndex], index2 = 1, index3 = 2, index4 = 3;
|
|
5
6
|
switch (segment.type) {
|
|
6
7
|
case "line":
|
|
7
|
-
ctx.lineTo(
|
|
8
|
+
ctx.lineTo(value.x * radius, value.y * radius);
|
|
8
9
|
break;
|
|
9
10
|
case "bezier":
|
|
10
|
-
ctx.bezierCurveTo(segment.values[
|
|
11
|
+
ctx.bezierCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius, segment.values[index4].x * radius, segment.values[index4].y * radius);
|
|
11
12
|
break;
|
|
12
13
|
case "quadratic":
|
|
13
|
-
ctx.quadraticCurveTo(segment.values[
|
|
14
|
+
ctx.quadraticCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius);
|
|
14
15
|
break;
|
|
15
16
|
case "arc":
|
|
16
|
-
ctx.arc(
|
|
17
|
+
ctx.arc(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index3].x, segment.values[index3].y);
|
|
17
18
|
break;
|
|
18
19
|
case "ellipse":
|
|
19
|
-
ctx.ellipse(
|
|
20
|
+
ctx.ellipse(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x, segment.values[index4].x, segment.values[index4].y);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
if (!path.half) {
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
const lengthOffset = 1, minLength = 0;
|
|
27
|
+
for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {
|
|
28
|
+
const segment = path.segments[i], value = segment.values[firstIndex], index2 = 1, index3 = 2;
|
|
27
29
|
switch (segment.type) {
|
|
28
30
|
case "line":
|
|
29
|
-
ctx.lineTo(
|
|
31
|
+
ctx.lineTo(value.x * -radius, value.y * radius);
|
|
30
32
|
break;
|
|
31
33
|
case "bezier":
|
|
32
|
-
ctx.bezierCurveTo(-segment.values[
|
|
34
|
+
ctx.bezierCurveTo(-segment.values[index3].x * radius, segment.values[index3].y * radius, -segment.values[index2].x * radius, segment.values[index2].y * radius, value.x * radius, value.y * radius);
|
|
33
35
|
break;
|
|
34
36
|
case "quadratic":
|
|
35
|
-
ctx.quadraticCurveTo(-segment.values[
|
|
37
|
+
ctx.quadraticCurveTo(-segment.values[index2].x * radius, segment.values[index2].y * radius, -segment.values[index3].x * radius, segment.values[index3].y * radius);
|
|
38
|
+
break;
|
|
39
|
+
case "arc":
|
|
40
|
+
case "ellipse":
|
|
41
|
+
default:
|
|
36
42
|
break;
|
|
37
43
|
}
|
|
38
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/shape-path",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "tsParticles path shape",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"./package.json": "./package.json"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@tsparticles/engine": "^3.0
|
|
103
|
+
"@tsparticles/engine": "^3.1.0"
|
|
104
104
|
},
|
|
105
105
|
"publishConfig": {
|
|
106
106
|
"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/shape-path [
|
|
6
|
+
<title>@tsparticles/shape-path [13 Jan 2024 at 23:06]</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.shape.path.js","isAsset":true,"statSize":
|
|
34
|
+
window.chartData = [{"label":"tsparticles.shape.path.js","isAsset":true,"statSize":2982,"parsedSize":6785,"gzipSize":1911,"groups":[{"label":"dist/browser","path":"./dist/browser","statSize":2940,"groups":[{"id":334,"label":"index.js + 2 modules (concatenated)","path":"./dist/browser/index.js + 2 modules (concatenated)","statSize":2940,"parsedSize":6785,"gzipSize":1911,"concatenated":true,"groups":[{"label":"dist/browser","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser","statSize":2940,"groups":[{"id":null,"label":"index.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/index.js","statSize":169,"parsedSize":390,"gzipSize":109,"inaccurateSizes":true},{"id":null,"label":"PathDrawer.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/PathDrawer.js","statSize":470,"parsedSize":1084,"gzipSize":305,"inaccurateSizes":true},{"id":null,"label":"Utils.js","path":"./dist/browser/index.js + 2 modules (concatenated)/dist/browser/Utils.js","statSize":2301,"parsedSize":5310,"gzipSize":1495,"inaccurateSizes":true}],"parsedSize":6785,"gzipSize":1911,"inaccurateSizes":true}]}],"parsedSize":6785,"gzipSize":1911},{"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.shape.path":true}}];
|
|
35
35
|
window.entrypoints = ["tsparticles.shape.path","tsparticles.shape.path.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')
|
|
@@ -98,40 +98,55 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
98
98
|
var engine_root_window_ = __webpack_require__(533);
|
|
99
99
|
;// CONCATENATED MODULE: ./dist/browser/Utils.js
|
|
100
100
|
function drawPath(ctx, radius, path) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
const firstIndex = 0,
|
|
102
|
+
firstSegment = path.segments[firstIndex],
|
|
103
|
+
firstValue = firstSegment.values[firstIndex];
|
|
104
|
+
ctx.moveTo(firstValue.x * radius, firstValue.y * radius);
|
|
105
|
+
for (const segment of path.segments) {
|
|
106
|
+
const value = segment.values[firstIndex],
|
|
107
|
+
index2 = 1,
|
|
108
|
+
index3 = 2,
|
|
109
|
+
index4 = 3;
|
|
104
110
|
switch (segment.type) {
|
|
105
111
|
case "line":
|
|
106
|
-
ctx.lineTo(
|
|
112
|
+
ctx.lineTo(value.x * radius, value.y * radius);
|
|
107
113
|
break;
|
|
108
114
|
case "bezier":
|
|
109
|
-
ctx.bezierCurveTo(segment.values[
|
|
115
|
+
ctx.bezierCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius, segment.values[index4].x * radius, segment.values[index4].y * radius);
|
|
110
116
|
break;
|
|
111
117
|
case "quadratic":
|
|
112
|
-
ctx.quadraticCurveTo(segment.values[
|
|
118
|
+
ctx.quadraticCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius);
|
|
113
119
|
break;
|
|
114
120
|
case "arc":
|
|
115
|
-
ctx.arc(
|
|
121
|
+
ctx.arc(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index3].x, segment.values[index3].y);
|
|
116
122
|
break;
|
|
117
123
|
case "ellipse":
|
|
118
|
-
ctx.ellipse(
|
|
124
|
+
ctx.ellipse(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x, segment.values[index4].x, segment.values[index4].y);
|
|
119
125
|
}
|
|
120
126
|
}
|
|
121
127
|
if (!path.half) {
|
|
122
128
|
return;
|
|
123
129
|
}
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
const lengthOffset = 1,
|
|
131
|
+
minLength = 0;
|
|
132
|
+
for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {
|
|
133
|
+
const segment = path.segments[i],
|
|
134
|
+
value = segment.values[firstIndex],
|
|
135
|
+
index2 = 1,
|
|
136
|
+
index3 = 2;
|
|
126
137
|
switch (segment.type) {
|
|
127
138
|
case "line":
|
|
128
|
-
ctx.lineTo(
|
|
139
|
+
ctx.lineTo(value.x * -radius, value.y * radius);
|
|
129
140
|
break;
|
|
130
141
|
case "bezier":
|
|
131
|
-
ctx.bezierCurveTo(-segment.values[
|
|
142
|
+
ctx.bezierCurveTo(-segment.values[index3].x * radius, segment.values[index3].y * radius, -segment.values[index2].x * radius, segment.values[index2].y * radius, value.x * radius, value.y * radius);
|
|
132
143
|
break;
|
|
133
144
|
case "quadratic":
|
|
134
|
-
ctx.quadraticCurveTo(-segment.values[
|
|
145
|
+
ctx.quadraticCurveTo(-segment.values[index2].x * radius, segment.values[index2].y * radius, -segment.values[index3].x * radius, segment.values[index3].y * radius);
|
|
146
|
+
break;
|
|
147
|
+
case "arc":
|
|
148
|
+
case "ellipse":
|
|
149
|
+
default:
|
|
135
150
|
break;
|
|
136
151
|
}
|
|
137
152
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.shape.path.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,a){if("object"==typeof exports&&"object"==typeof module)module.exports=a(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],a);else{var
|
|
2
|
+
!function(e,a){if("object"==typeof exports&&"object"==typeof module)module.exports=a(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],a);else{var t="object"==typeof exports?a(require("@tsparticles/engine")):a(e.window);for(var s in t)("object"==typeof exports?exports:e)[s]=t[s]}}(this,(e=>(()=>{"use strict";var a={533:a=>{a.exports=e}},t={};function s(e){var r=t[e];if(void 0!==r)return r.exports;var o=t[e]={exports:{}};return a[e](o,o.exports,s),o.exports}s.d=(e,a)=>{for(var t in a)s.o(a,t)&&!s.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:a[t]})},s.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{s.r(r),s.d(r,{loadPathShape:()=>t});var e=s(533);class a{draw(e){const{context:a,particle:t,radius:s}=e;t.pathData&&function(e,a,t){const s=t.segments[0].values[0];e.moveTo(s.x*a,s.y*a);for(const s of t.segments){const t=s.values[0],r=1,o=2,l=3;switch(s.type){case"line":e.lineTo(t.x*a,t.y*a);break;case"bezier":e.bezierCurveTo(s.values[r].x*a,s.values[r].y*a,s.values[o].x*a,s.values[o].y*a,s.values[l].x*a,s.values[l].y*a);break;case"quadratic":e.quadraticCurveTo(s.values[r].x*a,s.values[r].y*a,s.values[o].x*a,s.values[o].y*a);break;case"arc":e.arc(t.x*a,t.y*a,s.values[r].x*a,s.values[o].x,s.values[o].y);break;case"ellipse":e.ellipse(t.x*a,t.y*a,s.values[r].x*a,s.values[r].y*a,s.values[o].x,s.values[l].x,s.values[l].y)}}if(!t.half)return;for(let s=t.segments.length-1;s>=0;s--){const r=t.segments[s],o=r.values[0],l=1,u=2;switch(r.type){case"line":e.lineTo(o.x*-a,o.y*a);break;case"bezier":e.bezierCurveTo(-r.values[u].x*a,r.values[u].y*a,-r.values[l].x*a,r.values[l].y*a,o.x*a,o.y*a);break;case"quadratic":e.quadraticCurveTo(-r.values[l].x*a,r.values[l].y*a,-r.values[u].x*a,r.values[u].y*a)}}}(a,s,t.pathData)}particleInit(a,t){const s=t.shapeData;s&&(t.pathData=(0,e.deepExtend)({},s))}}async function t(e,t=!0){await e.addShape("path",new a,t)}})(),r})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Path Shape v3.0
|
|
1
|
+
/*! tsParticles Path Shape v3.1.0 by Matteo Bruni */
|
package/umd/Utils.js
CHANGED
|
@@ -11,40 +11,46 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.drawPath = void 0;
|
|
13
13
|
function drawPath(ctx, radius, path) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const firstIndex = 0, firstSegment = path.segments[firstIndex], firstValue = firstSegment.values[firstIndex];
|
|
15
|
+
ctx.moveTo(firstValue.x * radius, firstValue.y * radius);
|
|
16
|
+
for (const segment of path.segments) {
|
|
17
|
+
const value = segment.values[firstIndex], index2 = 1, index3 = 2, index4 = 3;
|
|
17
18
|
switch (segment.type) {
|
|
18
19
|
case "line":
|
|
19
|
-
ctx.lineTo(
|
|
20
|
+
ctx.lineTo(value.x * radius, value.y * radius);
|
|
20
21
|
break;
|
|
21
22
|
case "bezier":
|
|
22
|
-
ctx.bezierCurveTo(segment.values[
|
|
23
|
+
ctx.bezierCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius, segment.values[index4].x * radius, segment.values[index4].y * radius);
|
|
23
24
|
break;
|
|
24
25
|
case "quadratic":
|
|
25
|
-
ctx.quadraticCurveTo(segment.values[
|
|
26
|
+
ctx.quadraticCurveTo(segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x * radius, segment.values[index3].y * radius);
|
|
26
27
|
break;
|
|
27
28
|
case "arc":
|
|
28
|
-
ctx.arc(
|
|
29
|
+
ctx.arc(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index3].x, segment.values[index3].y);
|
|
29
30
|
break;
|
|
30
31
|
case "ellipse":
|
|
31
|
-
ctx.ellipse(
|
|
32
|
+
ctx.ellipse(value.x * radius, value.y * radius, segment.values[index2].x * radius, segment.values[index2].y * radius, segment.values[index3].x, segment.values[index4].x, segment.values[index4].y);
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
if (!path.half) {
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const lengthOffset = 1, minLength = 0;
|
|
39
|
+
for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {
|
|
40
|
+
const segment = path.segments[i], value = segment.values[firstIndex], index2 = 1, index3 = 2;
|
|
39
41
|
switch (segment.type) {
|
|
40
42
|
case "line":
|
|
41
|
-
ctx.lineTo(
|
|
43
|
+
ctx.lineTo(value.x * -radius, value.y * radius);
|
|
42
44
|
break;
|
|
43
45
|
case "bezier":
|
|
44
|
-
ctx.bezierCurveTo(-segment.values[
|
|
46
|
+
ctx.bezierCurveTo(-segment.values[index3].x * radius, segment.values[index3].y * radius, -segment.values[index2].x * radius, segment.values[index2].y * radius, value.x * radius, value.y * radius);
|
|
45
47
|
break;
|
|
46
48
|
case "quadratic":
|
|
47
|
-
ctx.quadraticCurveTo(-segment.values[
|
|
49
|
+
ctx.quadraticCurveTo(-segment.values[index2].x * radius, segment.values[index2].y * radius, -segment.values[index3].x * radius, segment.values[index3].y * radius);
|
|
50
|
+
break;
|
|
51
|
+
case "arc":
|
|
52
|
+
case "ellipse":
|
|
53
|
+
default:
|
|
48
54
|
break;
|
|
49
55
|
}
|
|
50
56
|
}
|