@tsparticles/shape-path 4.0.0-alpha.5 → 4.0.0-beta.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/374.min.js +1 -0
- package/browser/PathDrawer.js +1 -4
- package/browser/index.js +6 -4
- package/cjs/PathDrawer.js +1 -4
- package/cjs/index.js +6 -4
- package/dist_browser_PathDrawer_js.js +2 -22
- package/esm/PathDrawer.js +1 -4
- package/esm/index.js +6 -4
- package/package.json +3 -2
- package/report.html +3 -3
- package/tsparticles.shape.path.js +45 -23
- package/tsparticles.shape.path.min.js +2 -2
- package/types/IShapePathData.d.ts +4 -0
- package/types/PathDrawer.d.ts +0 -1
- package/types/PathParticle.d.ts +2 -2
- package/umd/PathDrawer.js +3 -6
- package/umd/index.js +6 -4
- package/876.min.js +0 -2
- package/876.min.js.LICENSE.txt +0 -1
- package/browser/SegmentType.js +0 -8
- package/browser/Utils.js +0 -82
- package/cjs/SegmentType.js +0 -8
- package/cjs/Utils.js +0 -82
- package/esm/SegmentType.js +0 -8
- package/esm/Utils.js +0 -82
- package/tsparticles.shape.path.min.js.LICENSE.txt +0 -1
- package/types/IPathData.d.ts +0 -10
- package/types/SegmentType.d.ts +0 -7
- package/types/Utils.d.ts +0 -2
- package/umd/SegmentType.js +0 -21
- package/umd/Utils.js +0 -95
- /package/browser/{IPathData.js → IShapePathData.js} +0 -0
- /package/cjs/{IPathData.js → IShapePathData.js} +0 -0
- /package/esm/{IPathData.js → IShapePathData.js} +0 -0
- /package/umd/{IPathData.js → IShapePathData.js} +0 -0
package/umd/Utils.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "./SegmentType.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.drawPath = drawPath;
|
|
13
|
-
const SegmentType_js_1 = require("./SegmentType.js");
|
|
14
|
-
function drawPath(ctx, radius, path) {
|
|
15
|
-
const firstIndex = 0, firstSegment = path.segments[firstIndex];
|
|
16
|
-
if (!firstSegment) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const firstValue = firstSegment.values[firstIndex];
|
|
20
|
-
if (!firstValue) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
ctx.moveTo(firstValue.x * radius, firstValue.y * radius);
|
|
24
|
-
for (const segment of path.segments) {
|
|
25
|
-
const value = segment.values[firstIndex], index2 = 1, index3 = 2, index4 = 3;
|
|
26
|
-
if (!value) {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
const segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3], segmentValue4 = segment.values[index4];
|
|
30
|
-
switch (segment.type) {
|
|
31
|
-
case SegmentType_js_1.SegmentType.line:
|
|
32
|
-
ctx.lineTo(value.x * radius, value.y * radius);
|
|
33
|
-
break;
|
|
34
|
-
case SegmentType_js_1.SegmentType.bezier:
|
|
35
|
-
if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
ctx.bezierCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius, segmentValue4.x * radius, segmentValue4.y * radius);
|
|
39
|
-
break;
|
|
40
|
-
case SegmentType_js_1.SegmentType.quadratic:
|
|
41
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
ctx.quadraticCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius);
|
|
45
|
-
break;
|
|
46
|
-
case SegmentType_js_1.SegmentType.arc:
|
|
47
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
ctx.arc(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue3.x, segmentValue3.y);
|
|
51
|
-
break;
|
|
52
|
-
case SegmentType_js_1.SegmentType.ellipse:
|
|
53
|
-
if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
ctx.ellipse(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x, segmentValue4.x, segmentValue4.y);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (!path.half) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const lengthOffset = 1, minLength = 0;
|
|
63
|
-
for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {
|
|
64
|
-
const segment = path.segments[i];
|
|
65
|
-
if (!segment) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
const value = segment.values[firstIndex], index2 = 1, index3 = 2, segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3];
|
|
69
|
-
switch (segment.type) {
|
|
70
|
-
case SegmentType_js_1.SegmentType.line:
|
|
71
|
-
if (!value) {
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
ctx.lineTo(value.x * -radius, value.y * radius);
|
|
75
|
-
break;
|
|
76
|
-
case SegmentType_js_1.SegmentType.bezier:
|
|
77
|
-
if (!value || !segmentValue2 || !segmentValue3) {
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
ctx.bezierCurveTo(-segmentValue3.x * radius, segmentValue3.y * radius, -segmentValue2.x * radius, segmentValue2.y * radius, value.x * radius, value.y * radius);
|
|
81
|
-
break;
|
|
82
|
-
case SegmentType_js_1.SegmentType.quadratic:
|
|
83
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
ctx.quadraticCurveTo(-segmentValue2.x * radius, segmentValue2.y * radius, -segmentValue3.x * radius, segmentValue3.y * radius);
|
|
87
|
-
break;
|
|
88
|
-
case SegmentType_js_1.SegmentType.arc:
|
|
89
|
-
case SegmentType_js_1.SegmentType.ellipse:
|
|
90
|
-
default:
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|