@remotion/paths 4.0.0-webhook.27 → 4.1.0-alpha1
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/LICENSE.md +1 -1
- package/README.md +1 -2
- package/dist/evolve-path.d.ts +2 -2
- package/dist/evolve-path.js +2 -2
- package/dist/extend-viewbox.d.ts +2 -2
- package/dist/extend-viewbox.js +2 -2
- package/dist/get-bounding-box.d.ts +8 -0
- package/dist/get-bounding-box.js +185 -0
- package/dist/get-length.d.ts +2 -2
- package/dist/get-length.js +2 -2
- package/dist/get-point-at-length.d.ts +2 -2
- package/dist/get-point-at-length.js +2 -2
- package/dist/get-subpaths.d.ts +6 -0
- package/dist/get-subpaths.js +19 -0
- package/dist/get-tangent-at-length.d.ts +2 -2
- package/dist/get-tangent-at-length.js +2 -2
- package/dist/helpers/arc.d.ts +0 -0
- package/dist/helpers/arc.js +0 -0
- package/dist/helpers/bezier-functions.d.ts +0 -0
- package/dist/helpers/bezier-functions.js +0 -0
- package/dist/helpers/bezier-values.d.ts +0 -0
- package/dist/helpers/bezier-values.js +0 -0
- package/dist/helpers/bezier.d.ts +0 -0
- package/dist/helpers/bezier.js +0 -0
- package/dist/helpers/construct.d.ts +9 -1
- package/dist/helpers/construct.js +218 -128
- package/dist/helpers/get-part-at-length.d.ts +0 -0
- package/dist/helpers/get-part-at-length.js +0 -0
- package/dist/helpers/iterate.d.ts +14 -0
- package/dist/helpers/iterate.js +95 -0
- package/dist/helpers/linear.d.ts +6 -1
- package/dist/helpers/linear.js +1 -1
- package/dist/helpers/remove-a-s-t-curves.d.ts +2 -0
- package/dist/helpers/remove-a-s-t-curves.js +271 -0
- package/dist/helpers/split-curve.d.ts +1 -1
- package/dist/helpers/split-curve.js +0 -0
- package/dist/helpers/types.d.ts +109 -2
- package/dist/helpers/types.js +0 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +19 -3
- package/dist/interpolate-path.d.ts +2 -2
- package/dist/interpolate-path.js +2 -2
- package/dist/normalize-path.d.ts +4 -2
- package/dist/normalize-path.js +141 -277
- package/dist/parse-path.d.ts +8 -0
- package/dist/parse-path.js +265 -0
- package/dist/reduce-instructions.d.ts +7 -0
- package/dist/reduce-instructions.js +15 -0
- package/dist/reset-path.d.ts +6 -0
- package/dist/reset-path.js +15 -0
- package/dist/reverse-path.d.ts +2 -2
- package/dist/reverse-path.js +73 -118
- package/dist/scale-path.d.ts +10 -0
- package/dist/scale-path.js +180 -0
- package/dist/serialize-instructions.d.ts +2 -0
- package/dist/serialize-instructions.js +78 -0
- package/dist/translate-path.d.ts +11 -0
- package/dist/translate-path.js +116 -0
- package/dist/warp-path/index.d.ts +10 -0
- package/dist/warp-path/index.js +26 -0
- package/dist/warp-path/warp-helpers.d.ts +14 -0
- package/dist/warp-path/warp-helpers.js +229 -0
- package/package.json +38 -38
- package/.prettierrc.js +0 -14
- package/dist/get-parts.d.ts +0 -7
- package/dist/get-parts.js +0 -31
- package/dist/helpers/parse.d.ts +0 -2
- package/dist/helpers/parse.js +0 -49
- package/tsconfig.json +0 -9
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeATSHVInstructions = void 0;
|
|
4
|
+
const iterate_1 = require("./iterate");
|
|
5
|
+
const TAU = Math.PI * 2;
|
|
6
|
+
function approximate_unit_arc(theta1, delta_theta) {
|
|
7
|
+
const alpha = (4 / 3) * Math.tan(delta_theta / 4);
|
|
8
|
+
const x1 = Math.cos(theta1);
|
|
9
|
+
const y1 = Math.sin(theta1);
|
|
10
|
+
const x2 = Math.cos(theta1 + delta_theta);
|
|
11
|
+
const y2 = Math.sin(theta1 + delta_theta);
|
|
12
|
+
return [
|
|
13
|
+
x1,
|
|
14
|
+
y1,
|
|
15
|
+
x1 - y1 * alpha,
|
|
16
|
+
y1 + x1 * alpha,
|
|
17
|
+
x2 + y2 * alpha,
|
|
18
|
+
y2 - x2 * alpha,
|
|
19
|
+
x2,
|
|
20
|
+
y2,
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
function arcToCircle({ x1, y1, x2, y2, largeArcFlag, sweepFlag, rx, ry, phi, }) {
|
|
24
|
+
const sin_phi = Math.sin((phi * TAU) / 360);
|
|
25
|
+
const cos_phi = Math.cos((phi * TAU) / 360);
|
|
26
|
+
// Make sure radii are valid
|
|
27
|
+
//
|
|
28
|
+
const x1p = (cos_phi * (x1 - x2)) / 2 + (sin_phi * (y1 - y2)) / 2;
|
|
29
|
+
const y1p = (-sin_phi * (x1 - x2)) / 2 + (cos_phi * (y1 - y2)) / 2;
|
|
30
|
+
if (x1p === 0 && y1p === 0) {
|
|
31
|
+
// we're asked to draw line to itself
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
if (rx === 0 || ry === 0) {
|
|
35
|
+
// one of the radii is zero
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
// Compensate out-of-range radii
|
|
39
|
+
//
|
|
40
|
+
rx = Math.abs(rx);
|
|
41
|
+
ry = Math.abs(ry);
|
|
42
|
+
const lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry);
|
|
43
|
+
if (lambda > 1) {
|
|
44
|
+
rx *= Math.sqrt(lambda);
|
|
45
|
+
ry *= Math.sqrt(lambda);
|
|
46
|
+
}
|
|
47
|
+
// Get center parameters (cx, cy, theta1, delta_theta)
|
|
48
|
+
//
|
|
49
|
+
const cc = get_arc_center({
|
|
50
|
+
x1,
|
|
51
|
+
y1,
|
|
52
|
+
x2,
|
|
53
|
+
y2,
|
|
54
|
+
largeArcFlag,
|
|
55
|
+
sweepFlag,
|
|
56
|
+
rx,
|
|
57
|
+
ry,
|
|
58
|
+
sin_phi,
|
|
59
|
+
cos_phi,
|
|
60
|
+
});
|
|
61
|
+
const result = [];
|
|
62
|
+
let theta1 = cc[2];
|
|
63
|
+
let delta_theta = cc[3];
|
|
64
|
+
// Split an arc to multiple segments, so each segment
|
|
65
|
+
// will be less than τ/4 (= 90°)
|
|
66
|
+
//
|
|
67
|
+
const segments = Math.max(Math.ceil(Math.abs(delta_theta) / (TAU / 4)), 1);
|
|
68
|
+
delta_theta /= segments;
|
|
69
|
+
for (let i = 0; i < segments; i++) {
|
|
70
|
+
result.push(approximate_unit_arc(theta1, delta_theta));
|
|
71
|
+
theta1 += delta_theta;
|
|
72
|
+
}
|
|
73
|
+
// We have a bezier approximation of a unit circle,
|
|
74
|
+
// now need to transform back to the original ellipse
|
|
75
|
+
//
|
|
76
|
+
return result.map((curve) => {
|
|
77
|
+
for (let i = 0; i < curve.length; i += 2) {
|
|
78
|
+
let x = curve[i + 0];
|
|
79
|
+
let y = curve[i + 1];
|
|
80
|
+
// scale
|
|
81
|
+
x *= rx;
|
|
82
|
+
y *= ry;
|
|
83
|
+
// rotate
|
|
84
|
+
const xp = cos_phi * x - sin_phi * y;
|
|
85
|
+
const yp = sin_phi * x + cos_phi * y;
|
|
86
|
+
// translate
|
|
87
|
+
curve[i + 0] = xp + cc[0];
|
|
88
|
+
curve[i + 1] = yp + cc[1];
|
|
89
|
+
}
|
|
90
|
+
return curve;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
// Requires path to be normalized
|
|
94
|
+
const removeATSHVInstructions = (segments) => {
|
|
95
|
+
return (0, iterate_1.iterateOverSegments)({
|
|
96
|
+
segments,
|
|
97
|
+
iterate: ({ segment, prevSegment, x, y, cpX, cpY }) => {
|
|
98
|
+
if (segment.type === 'H') {
|
|
99
|
+
return [{ type: 'L', x: segment.x, y }];
|
|
100
|
+
}
|
|
101
|
+
if (segment.type === 'V') {
|
|
102
|
+
return [{ type: 'L', x, y: segment.y }];
|
|
103
|
+
}
|
|
104
|
+
if (segment.type === 'A') {
|
|
105
|
+
const nextX = segment.x;
|
|
106
|
+
const nextY = segment.y;
|
|
107
|
+
const new_segments = arcToCircle({
|
|
108
|
+
x1: x,
|
|
109
|
+
y1: y,
|
|
110
|
+
x2: nextX,
|
|
111
|
+
y2: nextY,
|
|
112
|
+
largeArcFlag: segment.largeArcFlag,
|
|
113
|
+
sweepFlag: segment.sweepFlag,
|
|
114
|
+
rx: segment.rx,
|
|
115
|
+
ry: segment.ry,
|
|
116
|
+
phi: segment.xAxisRotation,
|
|
117
|
+
});
|
|
118
|
+
// Degenerated arcs can be ignored by renderer, but should not be dropped
|
|
119
|
+
// to avoid collisions with `S A S` and so on. Replace with empty line.
|
|
120
|
+
if (new_segments.length === 0) {
|
|
121
|
+
return [
|
|
122
|
+
{
|
|
123
|
+
type: 'L',
|
|
124
|
+
x: segment.x,
|
|
125
|
+
y: segment.y,
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
const result = new_segments.map((_s) => {
|
|
130
|
+
return {
|
|
131
|
+
type: 'C',
|
|
132
|
+
cp1x: _s[2],
|
|
133
|
+
cp1y: _s[3],
|
|
134
|
+
cp2x: _s[4],
|
|
135
|
+
cp2y: _s[5],
|
|
136
|
+
x: _s[6],
|
|
137
|
+
y: _s[7],
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
if (segment.type === 'T') {
|
|
143
|
+
let prevControlX = 0;
|
|
144
|
+
let prevControlY = 0;
|
|
145
|
+
if (prevSegment &&
|
|
146
|
+
(prevSegment.type === 'Q' || prevSegment.type === 'T')) {
|
|
147
|
+
prevControlX = cpX;
|
|
148
|
+
prevControlY = cpY;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
prevControlX = x;
|
|
152
|
+
prevControlY = y;
|
|
153
|
+
}
|
|
154
|
+
// New first control point is reflection of previous second control point
|
|
155
|
+
const vectorX = prevControlX - x;
|
|
156
|
+
const vectorY = prevControlY - y;
|
|
157
|
+
const newControlX = x - vectorX;
|
|
158
|
+
const newControlY = y - vectorY;
|
|
159
|
+
return [
|
|
160
|
+
{
|
|
161
|
+
type: 'Q',
|
|
162
|
+
cpx: newControlX,
|
|
163
|
+
cpy: newControlY,
|
|
164
|
+
x: segment.x,
|
|
165
|
+
y: segment.y,
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
if (segment.type === 'S') {
|
|
170
|
+
let prevControlX = 0;
|
|
171
|
+
let prevControlY = 0;
|
|
172
|
+
if (prevSegment && prevSegment.type === 'C') {
|
|
173
|
+
prevControlX = prevSegment.cp2x;
|
|
174
|
+
prevControlY = prevSegment.cp2y;
|
|
175
|
+
}
|
|
176
|
+
else if (prevSegment && prevSegment.type === 'S') {
|
|
177
|
+
prevControlX = prevSegment.cpx;
|
|
178
|
+
prevControlY = prevSegment.cpy;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
prevControlX = x;
|
|
182
|
+
prevControlY = y;
|
|
183
|
+
}
|
|
184
|
+
// New first control point is reflection of previous second control point
|
|
185
|
+
const vectorX = prevControlX - x;
|
|
186
|
+
const vectorY = prevControlY - y;
|
|
187
|
+
const newControlX = x - vectorX;
|
|
188
|
+
const newControlY = y - vectorY;
|
|
189
|
+
return [
|
|
190
|
+
{
|
|
191
|
+
type: 'C',
|
|
192
|
+
cp1x: newControlX,
|
|
193
|
+
cp1y: newControlY,
|
|
194
|
+
cp2x: segment.cpx,
|
|
195
|
+
cp2y: segment.cpy,
|
|
196
|
+
x: segment.x,
|
|
197
|
+
y: segment.y,
|
|
198
|
+
},
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
return [segment];
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
exports.removeATSHVInstructions = removeATSHVInstructions;
|
|
206
|
+
function get_arc_center({ x1, y1, x2, y2, largeArcFlag, sweepFlag, rx, ry, sin_phi, cos_phi, }) {
|
|
207
|
+
// Step 1.
|
|
208
|
+
//
|
|
209
|
+
// Moving an ellipse so origin will be the middlepoint between our two
|
|
210
|
+
// points. After that, rotate it to line up ellipse axes with coordinate
|
|
211
|
+
// axes.
|
|
212
|
+
//
|
|
213
|
+
const x1p = (cos_phi * (x1 - x2)) / 2 + (sin_phi * (y1 - y2)) / 2;
|
|
214
|
+
const y1p = (-sin_phi * (x1 - x2)) / 2 + (cos_phi * (y1 - y2)) / 2;
|
|
215
|
+
const rx_sq = rx * rx;
|
|
216
|
+
const ry_sq = ry * ry;
|
|
217
|
+
const x1p_sq = x1p * x1p;
|
|
218
|
+
const y1p_sq = y1p * y1p;
|
|
219
|
+
// Step 2.
|
|
220
|
+
//
|
|
221
|
+
// Compute coordinates of the centre of this ellipse (cx', cy')
|
|
222
|
+
// in the new coordinate system.
|
|
223
|
+
//
|
|
224
|
+
let radicant = rx_sq * ry_sq - rx_sq * y1p_sq - ry_sq * x1p_sq;
|
|
225
|
+
if (radicant < 0) {
|
|
226
|
+
// due to rounding errors it might be e.g. -1.3877787807814457e-17
|
|
227
|
+
radicant = 0;
|
|
228
|
+
}
|
|
229
|
+
radicant /= rx_sq * y1p_sq + ry_sq * x1p_sq;
|
|
230
|
+
radicant = Math.sqrt(radicant) * (largeArcFlag === sweepFlag ? -1 : 1);
|
|
231
|
+
const cxp = ((radicant * rx) / ry) * y1p;
|
|
232
|
+
const cyp = ((radicant * -ry) / rx) * x1p;
|
|
233
|
+
// Step 3.
|
|
234
|
+
//
|
|
235
|
+
// Transform back to get centre coordinates (cx, cy) in the original
|
|
236
|
+
// coordinate system.
|
|
237
|
+
//
|
|
238
|
+
const cx = cos_phi * cxp - sin_phi * cyp + (x1 + x2) / 2;
|
|
239
|
+
const cy = sin_phi * cxp + cos_phi * cyp + (y1 + y2) / 2;
|
|
240
|
+
// Step 4.
|
|
241
|
+
//
|
|
242
|
+
// Compute angles (theta1, delta_theta).
|
|
243
|
+
//
|
|
244
|
+
const v1x = (x1p - cxp) / rx;
|
|
245
|
+
const v1y = (y1p - cyp) / ry;
|
|
246
|
+
const v2x = (-x1p - cxp) / rx;
|
|
247
|
+
const v2y = (-y1p - cyp) / ry;
|
|
248
|
+
const theta1 = unit_vector_angle(1, 0, v1x, v1y);
|
|
249
|
+
let delta_theta = unit_vector_angle(v1x, v1y, v2x, v2y);
|
|
250
|
+
if (sweepFlag === false && delta_theta > 0) {
|
|
251
|
+
delta_theta -= TAU;
|
|
252
|
+
}
|
|
253
|
+
if (sweepFlag === true && delta_theta < 0) {
|
|
254
|
+
delta_theta += TAU;
|
|
255
|
+
}
|
|
256
|
+
return [cx, cy, theta1, delta_theta];
|
|
257
|
+
}
|
|
258
|
+
function unit_vector_angle(ux, uy, vx, vy) {
|
|
259
|
+
const sign = ux * vy - uy * vx < 0 ? -1 : 1;
|
|
260
|
+
let dot = ux * vx + uy * vy;
|
|
261
|
+
// Add this to work with arbitrary vectors:
|
|
262
|
+
// dot /= Math.sqrt(ux * ux + uy * uy) * Math.sqrt(vx * vx + vy * vy);
|
|
263
|
+
// rounding errors, e.g. -1.0000000000000002 can screw up this
|
|
264
|
+
if (dot > 1.0) {
|
|
265
|
+
dot = 1.0;
|
|
266
|
+
}
|
|
267
|
+
if (dot < -1.0) {
|
|
268
|
+
dot = -1.0;
|
|
269
|
+
}
|
|
270
|
+
return sign * Math.acos(dot);
|
|
271
|
+
}
|
|
File without changes
|
package/dist/helpers/types.d.ts
CHANGED
|
@@ -14,9 +14,116 @@ export interface Point {
|
|
|
14
14
|
x: number;
|
|
15
15
|
y: number;
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export type PointArray = [number, number];
|
|
18
18
|
export interface PointProperties {
|
|
19
19
|
tangentX: number;
|
|
20
20
|
tangentY: number;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export type BoundingBox = {
|
|
23
|
+
x1: number;
|
|
24
|
+
y1: number;
|
|
25
|
+
x2: number;
|
|
26
|
+
y2: number;
|
|
27
|
+
viewBox: string;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
31
|
+
export type ReducedInstruction = {
|
|
32
|
+
type: 'M';
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
} | {
|
|
36
|
+
type: 'L';
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'C';
|
|
41
|
+
cp1x: number;
|
|
42
|
+
cp1y: number;
|
|
43
|
+
cp2x: number;
|
|
44
|
+
cp2y: number;
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
} | {
|
|
48
|
+
type: 'Q';
|
|
49
|
+
cpx: number;
|
|
50
|
+
cpy: number;
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'Z';
|
|
55
|
+
};
|
|
56
|
+
export type AbsoluteInstruction = ReducedInstruction | {
|
|
57
|
+
type: 'A';
|
|
58
|
+
rx: number;
|
|
59
|
+
ry: number;
|
|
60
|
+
xAxisRotation: number;
|
|
61
|
+
largeArcFlag: boolean;
|
|
62
|
+
sweepFlag: boolean;
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
} | {
|
|
66
|
+
type: 'S';
|
|
67
|
+
cpx: number;
|
|
68
|
+
cpy: number;
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
} | {
|
|
72
|
+
type: 'T';
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
} | {
|
|
76
|
+
type: 'H';
|
|
77
|
+
x: number;
|
|
78
|
+
} | {
|
|
79
|
+
type: 'V';
|
|
80
|
+
y: number;
|
|
81
|
+
};
|
|
82
|
+
export type Instruction = AbsoluteInstruction | {
|
|
83
|
+
type: 'm';
|
|
84
|
+
dx: number;
|
|
85
|
+
dy: number;
|
|
86
|
+
} | {
|
|
87
|
+
type: 'l';
|
|
88
|
+
dx: number;
|
|
89
|
+
dy: number;
|
|
90
|
+
} | {
|
|
91
|
+
type: 'h';
|
|
92
|
+
dx: number;
|
|
93
|
+
} | {
|
|
94
|
+
type: 'v';
|
|
95
|
+
dy: number;
|
|
96
|
+
} | {
|
|
97
|
+
type: 'c';
|
|
98
|
+
cp1dx: number;
|
|
99
|
+
cp1dy: number;
|
|
100
|
+
cp2dx: number;
|
|
101
|
+
cp2dy: number;
|
|
102
|
+
dx: number;
|
|
103
|
+
dy: number;
|
|
104
|
+
} | {
|
|
105
|
+
type: 's';
|
|
106
|
+
cpdx: number;
|
|
107
|
+
cpdy: number;
|
|
108
|
+
dx: number;
|
|
109
|
+
dy: number;
|
|
110
|
+
} | {
|
|
111
|
+
type: 'q';
|
|
112
|
+
cpdx: number;
|
|
113
|
+
cpdy: number;
|
|
114
|
+
dx: number;
|
|
115
|
+
dy: number;
|
|
116
|
+
} | {
|
|
117
|
+
type: 't';
|
|
118
|
+
dx: number;
|
|
119
|
+
dy: number;
|
|
120
|
+
} | {
|
|
121
|
+
type: 'a';
|
|
122
|
+
rx: number;
|
|
123
|
+
ry: number;
|
|
124
|
+
xAxisRotation: number;
|
|
125
|
+
largeArcFlag: boolean;
|
|
126
|
+
sweepFlag: boolean;
|
|
127
|
+
dx: number;
|
|
128
|
+
dy: number;
|
|
129
|
+
};
|
package/dist/helpers/types.js
CHANGED
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
export { evolvePath } from './evolve-path';
|
|
2
2
|
export { extendViewBox } from './extend-viewbox';
|
|
3
|
+
export { getBoundingBox } from './get-bounding-box';
|
|
3
4
|
export { getLength } from './get-length';
|
|
4
|
-
export { getParts } from './get-parts';
|
|
5
5
|
export { getPointAtLength } from './get-point-at-length';
|
|
6
|
+
export { getSubpaths } from './get-subpaths';
|
|
6
7
|
export { getTangentAtLength } from './get-tangent-at-length';
|
|
7
|
-
export { Part } from './helpers/types';
|
|
8
|
+
export { AbsoluteInstruction, BoundingBox, Instruction, Part, ReducedInstruction, } from './helpers/types';
|
|
8
9
|
export { interpolatePath } from './interpolate-path';
|
|
9
10
|
export { normalizePath } from './normalize-path';
|
|
11
|
+
export { parsePath } from './parse-path';
|
|
12
|
+
export { reduceInstructions } from './reduce-instructions';
|
|
13
|
+
export { resetPath } from './reset-path';
|
|
10
14
|
export { reversePath } from './reverse-path';
|
|
15
|
+
export { scalePath } from './scale-path';
|
|
16
|
+
export { serializeInstructions } from './serialize-instructions';
|
|
17
|
+
export { translatePath } from './translate-path';
|
|
18
|
+
export { warpPath, WarpPathFn } from './warp-path';
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reversePath = exports.normalizePath = exports.interpolatePath = exports.getTangentAtLength = exports.
|
|
3
|
+
exports.warpPath = exports.translatePath = exports.serializeInstructions = exports.scalePath = exports.reversePath = exports.resetPath = exports.reduceInstructions = exports.parsePath = exports.normalizePath = exports.interpolatePath = exports.getTangentAtLength = exports.getSubpaths = exports.getPointAtLength = exports.getLength = exports.getBoundingBox = exports.extendViewBox = exports.evolvePath = void 0;
|
|
4
4
|
var evolve_path_1 = require("./evolve-path");
|
|
5
5
|
Object.defineProperty(exports, "evolvePath", { enumerable: true, get: function () { return evolve_path_1.evolvePath; } });
|
|
6
6
|
var extend_viewbox_1 = require("./extend-viewbox");
|
|
7
7
|
Object.defineProperty(exports, "extendViewBox", { enumerable: true, get: function () { return extend_viewbox_1.extendViewBox; } });
|
|
8
|
+
var get_bounding_box_1 = require("./get-bounding-box");
|
|
9
|
+
Object.defineProperty(exports, "getBoundingBox", { enumerable: true, get: function () { return get_bounding_box_1.getBoundingBox; } });
|
|
8
10
|
var get_length_1 = require("./get-length");
|
|
9
11
|
Object.defineProperty(exports, "getLength", { enumerable: true, get: function () { return get_length_1.getLength; } });
|
|
10
|
-
var get_parts_1 = require("./get-parts");
|
|
11
|
-
Object.defineProperty(exports, "getParts", { enumerable: true, get: function () { return get_parts_1.getParts; } });
|
|
12
12
|
var get_point_at_length_1 = require("./get-point-at-length");
|
|
13
13
|
Object.defineProperty(exports, "getPointAtLength", { enumerable: true, get: function () { return get_point_at_length_1.getPointAtLength; } });
|
|
14
|
+
var get_subpaths_1 = require("./get-subpaths");
|
|
15
|
+
Object.defineProperty(exports, "getSubpaths", { enumerable: true, get: function () { return get_subpaths_1.getSubpaths; } });
|
|
14
16
|
var get_tangent_at_length_1 = require("./get-tangent-at-length");
|
|
15
17
|
Object.defineProperty(exports, "getTangentAtLength", { enumerable: true, get: function () { return get_tangent_at_length_1.getTangentAtLength; } });
|
|
16
18
|
var interpolate_path_1 = require("./interpolate-path");
|
|
17
19
|
Object.defineProperty(exports, "interpolatePath", { enumerable: true, get: function () { return interpolate_path_1.interpolatePath; } });
|
|
18
20
|
var normalize_path_1 = require("./normalize-path");
|
|
19
21
|
Object.defineProperty(exports, "normalizePath", { enumerable: true, get: function () { return normalize_path_1.normalizePath; } });
|
|
22
|
+
var parse_path_1 = require("./parse-path");
|
|
23
|
+
Object.defineProperty(exports, "parsePath", { enumerable: true, get: function () { return parse_path_1.parsePath; } });
|
|
24
|
+
var reduce_instructions_1 = require("./reduce-instructions");
|
|
25
|
+
Object.defineProperty(exports, "reduceInstructions", { enumerable: true, get: function () { return reduce_instructions_1.reduceInstructions; } });
|
|
26
|
+
var reset_path_1 = require("./reset-path");
|
|
27
|
+
Object.defineProperty(exports, "resetPath", { enumerable: true, get: function () { return reset_path_1.resetPath; } });
|
|
20
28
|
var reverse_path_1 = require("./reverse-path");
|
|
21
29
|
Object.defineProperty(exports, "reversePath", { enumerable: true, get: function () { return reverse_path_1.reversePath; } });
|
|
30
|
+
var scale_path_1 = require("./scale-path");
|
|
31
|
+
Object.defineProperty(exports, "scalePath", { enumerable: true, get: function () { return scale_path_1.scalePath; } });
|
|
32
|
+
var serialize_instructions_1 = require("./serialize-instructions");
|
|
33
|
+
Object.defineProperty(exports, "serializeInstructions", { enumerable: true, get: function () { return serialize_instructions_1.serializeInstructions; } });
|
|
34
|
+
var translate_path_1 = require("./translate-path");
|
|
35
|
+
Object.defineProperty(exports, "translatePath", { enumerable: true, get: function () { return translate_path_1.translatePath; } });
|
|
36
|
+
var warp_path_1 = require("./warp-path");
|
|
37
|
+
Object.defineProperty(exports, "warpPath", { enumerable: true, get: function () { return warp_path_1.warpPath; } });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Interpolates between two SVG paths.
|
|
2
|
+
* @description Interpolates between two SVG paths.
|
|
3
3
|
* @param {number} value A number - 0 means first path, 1 means second path, any other values will be interpolated
|
|
4
4
|
* @param {string} firstPath The first valid SVG path
|
|
5
5
|
* @param {string} secondPath The second valid SVG path
|
|
6
|
-
* @
|
|
6
|
+
* @see [Documentation](https://remotion.dev/docs/paths/interpolate-path)
|
|
7
7
|
*/
|
|
8
8
|
export declare const interpolatePath: (value: number, firstPath: string, secondPath: string) => string;
|
package/dist/interpolate-path.js
CHANGED
|
@@ -332,11 +332,11 @@ function interpolatePathCommands(aCommandsInput, bCommandsInput) {
|
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
334
|
/**
|
|
335
|
-
* Interpolates between two SVG paths.
|
|
335
|
+
* @description Interpolates between two SVG paths.
|
|
336
336
|
* @param {number} value A number - 0 means first path, 1 means second path, any other values will be interpolated
|
|
337
337
|
* @param {string} firstPath The first valid SVG path
|
|
338
338
|
* @param {string} secondPath The second valid SVG path
|
|
339
|
-
* @
|
|
339
|
+
* @see [Documentation](https://remotion.dev/docs/paths/interpolate-path)
|
|
340
340
|
*/
|
|
341
341
|
const interpolatePath = (value, firstPath, secondPath) => {
|
|
342
342
|
// at 1 return the final value without the extensions used during interpolation
|
package/dist/normalize-path.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { AbsoluteInstruction, Instruction } from './helpers/types';
|
|
1
2
|
/**
|
|
2
|
-
* Removes all relative coordinates from an SVG path and converts them into absolute coordinates.
|
|
3
|
+
* @description Removes all relative coordinates from an SVG path and converts them into absolute coordinates.
|
|
3
4
|
* @param {string} path A valid SVG path
|
|
4
|
-
* @
|
|
5
|
+
* @see [Documentation](https://remotion.dev/docs/paths/normalize-path)
|
|
5
6
|
*/
|
|
6
7
|
export declare const normalizePath: (path: string) => string;
|
|
8
|
+
export declare const normalizeInstructions: (instructions: Instruction[]) => AbsoluteInstruction[];
|