@remotion/paths 3.2.12-crf.6 → 3.2.13
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/package.json +2 -2
- package/dist/arc.d.ts +0 -12
- package/dist/arc.js +0 -231
- package/dist/bezier-functions.d.ts +0 -11
- package/dist/bezier-functions.js +0 -138
- package/dist/bezier-values.d.ts +0 -3
- package/dist/bezier-values.js +0 -693
- package/dist/bezier.d.ts +0 -26
- package/dist/bezier.js +0 -81
- package/dist/construct.d.ts +0 -7
- package/dist/construct.js +0 -308
- package/dist/get-part-at-length.d.ts +0 -4
- package/dist/get-part-at-length.js +0 -20
- package/dist/get-properties-at-length.d.ts +0 -1
- package/dist/get-properties-at-length.js +0 -23
- package/dist/get-reversed-path.d.ts +0 -12
- package/dist/get-reversed-path.js +0 -159
- package/dist/linear.d.ts +0 -7
- package/dist/linear.js +0 -31
- package/dist/parse.d.ts +0 -2
- package/dist/parse.js +0 -48
- package/dist/types.d.ts +0 -26
- package/dist/types.js +0 -2
package/dist/linear.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeLinearPosition = void 0;
|
|
4
|
-
const makeLinearPosition = (x0, x1, y0, y1) => {
|
|
5
|
-
const getTotalLength = () => {
|
|
6
|
-
return Math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2);
|
|
7
|
-
};
|
|
8
|
-
const getPointAtLength = (pos) => {
|
|
9
|
-
let fraction = pos / Math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2);
|
|
10
|
-
fraction = Number.isNaN(fraction) ? 1 : fraction;
|
|
11
|
-
const newDeltaX = (x1 - x0) * fraction;
|
|
12
|
-
const newDeltaY = (y1 - y0) * fraction;
|
|
13
|
-
return { x: x0 + newDeltaX, y: y0 + newDeltaY };
|
|
14
|
-
};
|
|
15
|
-
const getTangentAtLength = () => {
|
|
16
|
-
const module = Math.sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
|
|
17
|
-
return { x: (x1 - x0) / module, y: (y1 - y0) / module };
|
|
18
|
-
};
|
|
19
|
-
const getPropertiesAtLength = (pos) => {
|
|
20
|
-
const point = getPointAtLength(pos);
|
|
21
|
-
const tangent = getTangentAtLength();
|
|
22
|
-
return { x: point.x, y: point.y, tangentX: tangent.x, tangentY: tangent.y };
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
getTotalLength,
|
|
26
|
-
getPointAtLength,
|
|
27
|
-
getTangentAtLength,
|
|
28
|
-
getPropertiesAtLength,
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
exports.makeLinearPosition = makeLinearPosition;
|
package/dist/parse.d.ts
DELETED
package/dist/parse.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const length = {
|
|
4
|
-
a: 7,
|
|
5
|
-
c: 6,
|
|
6
|
-
h: 1,
|
|
7
|
-
l: 2,
|
|
8
|
-
m: 2,
|
|
9
|
-
q: 4,
|
|
10
|
-
s: 4,
|
|
11
|
-
t: 2,
|
|
12
|
-
v: 1,
|
|
13
|
-
z: 0
|
|
14
|
-
};
|
|
15
|
-
const segmentRegExp = /([astvzqmhlc])([^astvzqmhlc]*)/gi;
|
|
16
|
-
const numberRegExp = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;
|
|
17
|
-
exports.default = (path) => {
|
|
18
|
-
const segments = (path && path.length > 0 ? path : "M0,0").match(segmentRegExp);
|
|
19
|
-
if (!segments) {
|
|
20
|
-
throw new Error(`No path elements found in string ${path}`);
|
|
21
|
-
}
|
|
22
|
-
return segments.reduce((segmentsArray, segmentString) => {
|
|
23
|
-
let command = segmentString.charAt(0);
|
|
24
|
-
let type = command.toLowerCase();
|
|
25
|
-
const args = parseValues(segmentString.substr(1));
|
|
26
|
-
// overloaded moveTo
|
|
27
|
-
if (type === "m" && args.length > 2) {
|
|
28
|
-
segmentsArray.push([command, ...args.splice(0, 2)]);
|
|
29
|
-
type = "l";
|
|
30
|
-
command = command === "m" ? "l" : "L";
|
|
31
|
-
}
|
|
32
|
-
while (args.length >= 0) {
|
|
33
|
-
if (args.length === length[type]) {
|
|
34
|
-
segmentsArray.push([command, ...args.splice(0, length[type])]);
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
if (args.length < length[type]) {
|
|
38
|
-
throw new Error(`Malformed path data: "${command}" must have ${length[type]} elements and has ${args.length}: ${segmentString}`);
|
|
39
|
-
}
|
|
40
|
-
segmentsArray.push([command, ...args.splice(0, length[type])]);
|
|
41
|
-
}
|
|
42
|
-
return segmentsArray;
|
|
43
|
-
}, []);
|
|
44
|
-
};
|
|
45
|
-
const parseValues = (args) => {
|
|
46
|
-
const numbers = args.match(numberRegExp);
|
|
47
|
-
return numbers ? numbers.map(Number) : [];
|
|
48
|
-
};
|
package/dist/types.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export interface Properties {
|
|
2
|
-
getTotalLength(): number;
|
|
3
|
-
getPointAtLength(pos: number): Point;
|
|
4
|
-
getTangentAtLength(pos: number): Point;
|
|
5
|
-
getPropertiesAtLength(pos: number): PointProperties;
|
|
6
|
-
}
|
|
7
|
-
export interface PartProperties {
|
|
8
|
-
start: Point;
|
|
9
|
-
end: Point;
|
|
10
|
-
length: number;
|
|
11
|
-
getPointAtLength(pos: number): Point;
|
|
12
|
-
getTangentAtLength(pos: number): Point;
|
|
13
|
-
getPropertiesAtLength(pos: number): PointProperties;
|
|
14
|
-
}
|
|
15
|
-
export interface Point {
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
|
-
}
|
|
19
|
-
export declare type PointArray = [number, number];
|
|
20
|
-
export interface PointProperties {
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
tangentX: number;
|
|
24
|
-
tangentY: number;
|
|
25
|
-
}
|
|
26
|
-
export declare type pathOrders = "a" | "c" | "h" | "l" | "m" | "q" | "s" | "t" | "v" | "z";
|
package/dist/types.js
DELETED