@remotion/paths 4.0.163 → 4.0.165

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.
Files changed (30) hide show
  1. package/dist/debug-path.d.ts +6 -0
  2. package/dist/debug-path.js +57 -0
  3. package/dist/get-end-position.d.ts +2 -0
  4. package/dist/get-end-position.js +70 -0
  5. package/dist/helpers/types.d.ts +13 -12
  6. package/dist/index.d.ts +5 -1
  7. package/dist/index.js +3 -1
  8. package/dist/interpolate-path/convert-to-same-instruction-type.d.ts +22 -0
  9. package/dist/interpolate-path/convert-to-same-instruction-type.js +109 -0
  10. package/dist/interpolate-path/de-casteljau.d.ts +14 -0
  11. package/dist/interpolate-path/de-casteljau.js +44 -0
  12. package/dist/interpolate-path/extend-command.d.ts +11 -0
  13. package/dist/interpolate-path/extend-command.js +55 -0
  14. package/dist/interpolate-path/interpolate-instruction-of-same-kind.d.ts +2 -0
  15. package/dist/interpolate-path/interpolate-instruction-of-same-kind.js +73 -0
  16. package/dist/interpolate-path/interpolate-instructions.d.ts +16 -0
  17. package/dist/interpolate-path/interpolate-instructions.js +92 -0
  18. package/dist/interpolate-path/interpolate-path.d.ts +8 -0
  19. package/dist/interpolate-path/interpolate-path.js +66 -0
  20. package/dist/interpolate-path/points-to-command.d.ts +9 -0
  21. package/dist/interpolate-path/points-to-command.js +46 -0
  22. package/dist/interpolate-path/split-curve-as-points.d.ts +8 -0
  23. package/dist/interpolate-path/split-curve-as-points.js +40 -0
  24. package/dist/interpolate-path/split-curve.d.ts +11 -0
  25. package/dist/interpolate-path/split-curve.js +61 -0
  26. package/dist/interpolate-path/split-segment.d.ts +14 -0
  27. package/dist/interpolate-path/split-segment.js +41 -0
  28. package/dist/warp-path/warp-helpers.d.ts +0 -3
  29. package/dist/warp-path/warp-helpers.js +1 -4
  30. package/package.json +1 -1
@@ -0,0 +1,6 @@
1
+ type DebugInstruction = {
2
+ d: string;
3
+ color: string;
4
+ };
5
+ export declare const debugPath: (d: string) => DebugInstruction[];
6
+ export {};
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.debugPath = void 0;
4
+ const normalize_path_1 = require("./normalize-path");
5
+ const parse_path_1 = require("./parse-path");
6
+ const serialize_instructions_1 = require("./serialize-instructions");
7
+ const debugPath = (d) => {
8
+ const instructions = (0, normalize_path_1.normalizeInstructions)((0, parse_path_1.parsePath)(d));
9
+ return instructions
10
+ .map((inst, i) => {
11
+ if (inst.type === 'Z') {
12
+ return null;
13
+ }
14
+ if (inst.type === 'H' || inst.type === 'V') {
15
+ return null;
16
+ }
17
+ const topLeft = [inst.x - 5, inst.y - 5];
18
+ const topRight = [inst.x + 5, inst.y - 5];
19
+ const bottomLeft = [inst.x - 5, inst.y + 5];
20
+ const bottomRight = [inst.x + 5, inst.y + 5];
21
+ const triangle = [
22
+ {
23
+ type: 'M',
24
+ x: topLeft[0],
25
+ y: topLeft[1],
26
+ },
27
+ {
28
+ type: 'L',
29
+ x: topRight[0],
30
+ y: topRight[1],
31
+ },
32
+ {
33
+ type: 'L',
34
+ x: bottomRight[0],
35
+ y: bottomRight[1],
36
+ },
37
+ {
38
+ type: 'L',
39
+ x: bottomLeft[0],
40
+ y: bottomLeft[1],
41
+ },
42
+ {
43
+ type: 'Z',
44
+ },
45
+ ];
46
+ return {
47
+ d: (0, serialize_instructions_1.serializeInstructions)(triangle),
48
+ color: i === instructions.length - 1
49
+ ? 'red'
50
+ : inst.type === 'M'
51
+ ? 'blue'
52
+ : 'green',
53
+ };
54
+ })
55
+ .filter(Boolean);
56
+ };
57
+ exports.debugPath = debugPath;
@@ -0,0 +1,2 @@
1
+ import type { Instruction, Point } from './helpers/types';
2
+ export declare const getEndPosition: (instructions: Instruction[]) => Point;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEndPosition = void 0;
4
+ const getEndPosition = (instructions) => {
5
+ let x = 0;
6
+ let y = 0;
7
+ let moveX = 0;
8
+ let moveY = 0;
9
+ for (let i = 0; i < instructions.length; i++) {
10
+ const instruction = instructions[i];
11
+ if (instruction.type === 'M') {
12
+ moveX = instruction.x;
13
+ moveY = instruction.y;
14
+ }
15
+ else if (instruction.type === 'm') {
16
+ moveX += instruction.dx;
17
+ moveY += instruction.dy;
18
+ }
19
+ if (instruction.type === 'A' ||
20
+ instruction.type === 'C' ||
21
+ instruction.type === 'L' ||
22
+ instruction.type === 'M' ||
23
+ instruction.type === 'Q' ||
24
+ instruction.type === 'S' ||
25
+ instruction.type === 'T') {
26
+ x = instruction.x;
27
+ y = instruction.y;
28
+ continue;
29
+ }
30
+ if (instruction.type === 'a' ||
31
+ instruction.type === 'c' ||
32
+ instruction.type === 'l' ||
33
+ instruction.type === 'm' ||
34
+ instruction.type === 'q' ||
35
+ instruction.type === 's' ||
36
+ instruction.type === 't') {
37
+ x += instruction.dx;
38
+ y += instruction.dy;
39
+ continue;
40
+ }
41
+ if (instruction.type === 'H') {
42
+ x = instruction.x;
43
+ continue;
44
+ }
45
+ if (instruction.type === 'V') {
46
+ y = instruction.y;
47
+ continue;
48
+ }
49
+ if (instruction.type === 'Z') {
50
+ x = moveX;
51
+ y = moveY;
52
+ continue;
53
+ }
54
+ if (instruction.type === 'h') {
55
+ x += instruction.dx;
56
+ continue;
57
+ }
58
+ if (instruction.type === 'v') {
59
+ y += instruction.dy;
60
+ continue;
61
+ }
62
+ // @ts-expect-error
63
+ throw new Error('Unknown instruction type: ' + instruction.type);
64
+ }
65
+ return {
66
+ x,
67
+ y,
68
+ };
69
+ };
70
+ exports.getEndPosition = getEndPosition;
@@ -16,10 +16,6 @@ export interface Point {
16
16
  y: number;
17
17
  }
18
18
  export type PointArray = [number, number];
19
- export interface PointProperties {
20
- tangentX: number;
21
- tangentY: number;
22
- }
23
19
  export type BoundingBox = {
24
20
  x1: number;
25
21
  y1: number;
@@ -29,15 +25,12 @@ export type BoundingBox = {
29
25
  width: number;
30
26
  height: number;
31
27
  };
32
- export type ReducedInstruction = {
33
- type: 'M';
34
- x: number;
35
- y: number;
36
- } | {
28
+ export type LInstruction = {
37
29
  type: 'L';
38
30
  x: number;
39
31
  y: number;
40
- } | {
32
+ };
33
+ export type CInstruction = {
41
34
  type: 'C';
42
35
  cp1x: number;
43
36
  cp1y: number;
@@ -45,15 +38,23 @@ export type ReducedInstruction = {
45
38
  cp2y: number;
46
39
  x: number;
47
40
  y: number;
48
- } | {
41
+ };
42
+ export type MInstruction = {
43
+ type: 'M';
44
+ x: number;
45
+ y: number;
46
+ };
47
+ export type QInstruction = {
49
48
  type: 'Q';
50
49
  cpx: number;
51
50
  cpy: number;
52
51
  x: number;
53
52
  y: number;
54
- } | {
53
+ };
54
+ export type ZInstruction = {
55
55
  type: 'Z';
56
56
  };
57
+ export type ReducedInstruction = MInstruction | LInstruction | CInstruction | QInstruction | ZInstruction;
57
58
  export type AbsoluteInstruction = ReducedInstruction | {
58
59
  type: 'A';
59
60
  rx: number;
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { getPointAtLength } from './get-point-at-length';
7
7
  export { getSubpaths } from './get-subpaths';
8
8
  export { getTangentAtLength } from './get-tangent-at-length';
9
9
  export { AbsoluteInstruction, BoundingBox, Instruction, Part, ReducedInstruction, } from './helpers/types';
10
- export { interpolatePath } from './interpolate-path';
10
+ export { interpolatePath } from './interpolate-path/interpolate-path';
11
11
  export { normalizePath } from './normalize-path';
12
12
  export { parsePath } from './parse-path';
13
13
  export { reduceInstructions } from './reduce-instructions';
@@ -19,4 +19,8 @@ export { translatePath } from './translate-path';
19
19
  export { WarpPathFn, warpPath } from './warp-path';
20
20
  export declare const PathInternals: {
21
21
  getBoundingBoxFromInstructions: (instructions: import("./helpers/types").ReducedInstruction[]) => import("./helpers/types").BoundingBox;
22
+ debugPath: (d: string) => {
23
+ d: string;
24
+ color: string;
25
+ }[];
22
26
  };
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PathInternals = 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.getInstructionIndexAtLength = exports.getBoundingBox = exports.extendViewBox = exports.evolvePath = void 0;
4
4
  const get_bounding_box_1 = require("./get-bounding-box");
5
+ const debug_path_1 = require("./debug-path");
5
6
  var evolve_path_1 = require("./evolve-path");
6
7
  Object.defineProperty(exports, "evolvePath", { enumerable: true, get: function () { return evolve_path_1.evolvePath; } });
7
8
  var extend_viewbox_1 = require("./extend-viewbox");
@@ -18,7 +19,7 @@ var get_subpaths_1 = require("./get-subpaths");
18
19
  Object.defineProperty(exports, "getSubpaths", { enumerable: true, get: function () { return get_subpaths_1.getSubpaths; } });
19
20
  var get_tangent_at_length_1 = require("./get-tangent-at-length");
20
21
  Object.defineProperty(exports, "getTangentAtLength", { enumerable: true, get: function () { return get_tangent_at_length_1.getTangentAtLength; } });
21
- var interpolate_path_1 = require("./interpolate-path");
22
+ var interpolate_path_1 = require("./interpolate-path/interpolate-path");
22
23
  Object.defineProperty(exports, "interpolatePath", { enumerable: true, get: function () { return interpolate_path_1.interpolatePath; } });
23
24
  var normalize_path_1 = require("./normalize-path");
24
25
  Object.defineProperty(exports, "normalizePath", { enumerable: true, get: function () { return normalize_path_1.normalizePath; } });
@@ -40,4 +41,5 @@ var warp_path_1 = require("./warp-path");
40
41
  Object.defineProperty(exports, "warpPath", { enumerable: true, get: function () { return warp_path_1.warpPath; } });
41
42
  exports.PathInternals = {
42
43
  getBoundingBoxFromInstructions: get_bounding_box_1.getBoundingBoxFromInstructions,
44
+ debugPath: debug_path_1.debugPath,
43
45
  };
@@ -0,0 +1,22 @@
1
+ import type { Point, ReducedInstruction } from '../helpers/types';
2
+ /**
3
+ * Converts command A to have the same type as command B.
4
+ *
5
+ * e.g., L0,5 -> C0,5,0,5,0,5
6
+ *
7
+ * Uses these rules:
8
+ * x1 <- x
9
+ * x2 <- x
10
+ * y1 <- y
11
+ * y2 <- y
12
+ * rx <- 0
13
+ * ry <- 0
14
+ * xAxisRotation <- read from B
15
+ * largeArcFlag <- read from B
16
+ * sweepflag <- read from B
17
+ *
18
+ * @param {Object} aCommand Command object from path `d` attribute
19
+ * @param {Object} bCommand Command object from path `d` attribute to match against
20
+ * @return {Object} aCommand converted to type of bCommand
21
+ */
22
+ export declare function convertToSameInstructionType(aCommand: ReducedInstruction, bCommand: ReducedInstruction, currentPoint: Point): ReducedInstruction;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToSameInstructionType = void 0;
4
+ const convertToLCommand = (command) => {
5
+ if (command.type === 'M' || command.type === 'L' || command.type === 'Z') {
6
+ throw new Error('unexpected');
7
+ }
8
+ return {
9
+ type: 'L',
10
+ x: command.x,
11
+ y: command.y,
12
+ };
13
+ };
14
+ const convertToCCommand = (command, currentPoint) => {
15
+ if (command.type === 'M' || command.type === 'C' || command.type === 'Z') {
16
+ throw new Error('unexpected');
17
+ }
18
+ if (command.type === 'L') {
19
+ return {
20
+ type: 'C',
21
+ cp1x: currentPoint.x,
22
+ cp1y: currentPoint.y,
23
+ cp2x: command.x,
24
+ cp2y: command.y,
25
+ x: command.x,
26
+ y: command.y,
27
+ };
28
+ }
29
+ if (command.type === 'Q') {
30
+ return {
31
+ type: 'C',
32
+ cp1x: command.cpx,
33
+ cp1y: command.cpy,
34
+ cp2x: command.cpx,
35
+ cp2y: command.cpy,
36
+ x: command.x,
37
+ y: command.y,
38
+ };
39
+ }
40
+ throw new Error('all types should be handled');
41
+ };
42
+ const convertToQCommand = (command) => {
43
+ if (command.type === 'M' || command.type === 'Q' || command.type === 'Z') {
44
+ throw new Error('unexpected');
45
+ }
46
+ if (command.type === 'C') {
47
+ return {
48
+ type: 'Q',
49
+ cpx: command.cp1x,
50
+ cpy: command.cp1y,
51
+ x: command.x,
52
+ y: command.y,
53
+ };
54
+ }
55
+ if (command.type === 'L') {
56
+ return {
57
+ type: 'Q',
58
+ cpx: command.x,
59
+ cpy: command.y,
60
+ x: command.x,
61
+ y: command.y,
62
+ };
63
+ }
64
+ throw new Error('unhandled');
65
+ };
66
+ /**
67
+ * Converts command A to have the same type as command B.
68
+ *
69
+ * e.g., L0,5 -> C0,5,0,5,0,5
70
+ *
71
+ * Uses these rules:
72
+ * x1 <- x
73
+ * x2 <- x
74
+ * y1 <- y
75
+ * y2 <- y
76
+ * rx <- 0
77
+ * ry <- 0
78
+ * xAxisRotation <- read from B
79
+ * largeArcFlag <- read from B
80
+ * sweepflag <- read from B
81
+ *
82
+ * @param {Object} aCommand Command object from path `d` attribute
83
+ * @param {Object} bCommand Command object from path `d` attribute to match against
84
+ * @return {Object} aCommand converted to type of bCommand
85
+ */
86
+ function convertToSameInstructionType(aCommand, bCommand, currentPoint) {
87
+ if (aCommand.type === 'M' || bCommand.type === 'M') {
88
+ return { ...aCommand };
89
+ }
90
+ if (aCommand.type === bCommand.type) {
91
+ return { ...aCommand };
92
+ }
93
+ if (bCommand.type === 'C') {
94
+ return convertToCCommand(aCommand, currentPoint);
95
+ }
96
+ if (bCommand.type === 'L') {
97
+ return convertToLCommand(aCommand);
98
+ }
99
+ if (bCommand.type === 'Q') {
100
+ return convertToQCommand(aCommand);
101
+ }
102
+ if (bCommand.type === 'Z') {
103
+ return {
104
+ type: 'Z',
105
+ };
106
+ }
107
+ throw new TypeError('unhandled');
108
+ }
109
+ exports.convertToSameInstructionType = convertToSameInstructionType;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * de Casteljau's algorithm for drawing and splitting bezier curves.
3
+ * Inspired by https://pomax.github.io/bezierinfo/
4
+ *
5
+ * @param {Number[][]} points Array of [x,y] points: [start, control1, control2, ..., end]
6
+ * The original segment to split.
7
+ * @param {Number} t Where to split the curve (value between [0, 1])
8
+ * @return {Object} An object { left, right } where left is the segment from 0..t and
9
+ * right is the segment from t..1.
10
+ */
11
+ export declare function decasteljau(points: number[][], t: number): {
12
+ left: number[][];
13
+ right: number[][];
14
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decasteljau = void 0;
4
+ /**
5
+ * de Casteljau's algorithm for drawing and splitting bezier curves.
6
+ * Inspired by https://pomax.github.io/bezierinfo/
7
+ *
8
+ * @param {Number[][]} points Array of [x,y] points: [start, control1, control2, ..., end]
9
+ * The original segment to split.
10
+ * @param {Number} t Where to split the curve (value between [0, 1])
11
+ * @return {Object} An object { left, right } where left is the segment from 0..t and
12
+ * right is the segment from t..1.
13
+ */
14
+ function decasteljau(points, t) {
15
+ const left = [];
16
+ const right = [];
17
+ function decasteljauRecurse(_points, _t) {
18
+ if (_points.length === 1) {
19
+ left.push(_points[0]);
20
+ right.push(_points[0]);
21
+ }
22
+ else {
23
+ const newPoints = Array(_points.length - 1);
24
+ for (let i = 0; i < newPoints.length; i++) {
25
+ if (i === 0) {
26
+ left.push(_points[0]);
27
+ }
28
+ if (i === newPoints.length - 1) {
29
+ right.push(_points[i + 1]);
30
+ }
31
+ newPoints[i] = [
32
+ (1 - _t) * _points[i][0] + _t * _points[i + 1][0],
33
+ (1 - _t) * _points[i][1] + _t * _points[i + 1][1],
34
+ ];
35
+ }
36
+ decasteljauRecurse(newPoints, _t);
37
+ }
38
+ }
39
+ if (points.length) {
40
+ decasteljauRecurse(points, t);
41
+ }
42
+ return { left, right: right.reverse() };
43
+ }
44
+ exports.decasteljau = decasteljau;
@@ -0,0 +1,11 @@
1
+ import type { ReducedInstruction } from '../helpers/types';
2
+ /**
3
+ * Extends an array of commandsToExtend to the length of the referenceCommands by
4
+ * splitting segments until the number of commands match. Ensures all the actual
5
+ * points of commandsToExtend are in the extended array.
6
+ *
7
+ * @param {Object[]} commandsToExtend The command object array to extend
8
+ * @param {Object[]} referenceCommands The command object array to match in length
9
+ * @return {Object[]} The extended commandsToExtend array
10
+ */
11
+ export declare function extendInstruction(commandsToExtend: ReducedInstruction[], referenceCommands: ReducedInstruction[]): ReducedInstruction[];
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extendInstruction = void 0;
4
+ const split_segment_1 = require("./split-segment");
5
+ /**
6
+ * Extends an array of commandsToExtend to the length of the referenceCommands by
7
+ * splitting segments until the number of commands match. Ensures all the actual
8
+ * points of commandsToExtend are in the extended array.
9
+ *
10
+ * @param {Object[]} commandsToExtend The command object array to extend
11
+ * @param {Object[]} referenceCommands The command object array to match in length
12
+ * @return {Object[]} The extended commandsToExtend array
13
+ */
14
+ function extendInstruction(commandsToExtend, referenceCommands) {
15
+ // compute insertion points:
16
+ // number of segments in the path to extend
17
+ const numSegmentsToExtend = commandsToExtend.length - 1;
18
+ // number of segments in the reference path.
19
+ const numReferenceSegments = referenceCommands.length - 1;
20
+ // this value is always between [0, 1].
21
+ const segmentRatio = numSegmentsToExtend / numReferenceSegments;
22
+ // create a map, mapping segments in referenceCommands to how many points
23
+ // should be added in that segment (should always be >= 1 since we need each
24
+ // point itself).
25
+ // 0 = segment 0-1, 1 = segment 1-2, n-1 = last vertex
26
+ const countPointsPerSegment = new Array(numReferenceSegments)
27
+ .fill(undefined)
28
+ .reduce((accum, _d, i) => {
29
+ const insertIndex = Math.floor(segmentRatio * i);
30
+ accum[insertIndex] = (accum[insertIndex] || 0) + 1;
31
+ return accum;
32
+ }, []);
33
+ // extend each segment to have the correct number of points for a smooth interpolation
34
+ const extended = countPointsPerSegment.reduce((_extended, segmentCount, i) => {
35
+ // if last command, just add `segmentCount` number of times
36
+ if (i === commandsToExtend.length - 1) {
37
+ const lastCommandCopies = new Array(segmentCount).fill({
38
+ ...commandsToExtend[commandsToExtend.length - 1],
39
+ });
40
+ // convert M to L
41
+ if (lastCommandCopies[0].type === 'M') {
42
+ lastCommandCopies.forEach((d) => {
43
+ d.type = 'L';
44
+ });
45
+ }
46
+ return _extended.concat(lastCommandCopies);
47
+ }
48
+ // otherwise, split the segment segmentCount times.
49
+ return _extended.concat((0, split_segment_1.splitSegmentInstructions)(commandsToExtend[i], commandsToExtend[i + 1], segmentCount));
50
+ }, []);
51
+ // add in the very first point since splitSegment only adds in the ones after it
52
+ extended.unshift(commandsToExtend[0]);
53
+ return extended;
54
+ }
55
+ exports.extendInstruction = extendInstruction;
@@ -0,0 +1,2 @@
1
+ import type { CInstruction, LInstruction, MInstruction, QInstruction, ReducedInstruction, ZInstruction } from '../helpers/types';
2
+ export declare const interpolateInstructionOfSameKind: (t: number, first: ReducedInstruction, second: ReducedInstruction) => LInstruction | CInstruction | MInstruction | QInstruction | ZInstruction;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.interpolateInstructionOfSameKind = void 0;
4
+ const interpolateLInstruction = (t, first, second) => {
5
+ return {
6
+ type: 'L',
7
+ x: (1 - t) * first.x + t * second.x,
8
+ y: (1 - t) * first.y + t * second.y,
9
+ };
10
+ };
11
+ const interpolateCInstructions = (t, first, second) => {
12
+ return {
13
+ type: 'C',
14
+ cp1x: (1 - t) * first.cp1x + t * second.cp1x,
15
+ cp2x: (1 - t) * first.cp2x + t * second.cp2x,
16
+ cp1y: (1 - t) * first.cp1y + t * second.cp1y,
17
+ cp2y: (1 - t) * first.cp2y + t * second.cp2y,
18
+ x: (1 - t) * first.x + t * second.x,
19
+ y: (1 - t) * first.y + t * second.y,
20
+ };
21
+ };
22
+ const interpolateQInstructions = (t, first, second) => {
23
+ return {
24
+ type: 'Q',
25
+ cpx: (1 - t) * first.cpx + t * second.cpx,
26
+ cpy: (1 - t) * first.cpy + t * second.cpy,
27
+ x: (1 - t) * first.x + t * second.x,
28
+ y: (1 - t) * first.y + t * second.y,
29
+ };
30
+ };
31
+ const interpolateMInstructions = (t, first, second) => {
32
+ return {
33
+ type: 'M',
34
+ x: (1 - t) * first.x + t * second.x,
35
+ y: (1 - t) * first.y + t * second.y,
36
+ };
37
+ };
38
+ const interpolateInstructionOfSameKind = (t, first, second) => {
39
+ if (first.type === 'L') {
40
+ if (second.type !== 'L') {
41
+ throw new Error('mismatch');
42
+ }
43
+ return interpolateLInstruction(t, first, second);
44
+ }
45
+ if (first.type === 'C') {
46
+ if (second.type !== 'C') {
47
+ throw new Error('mismatch');
48
+ }
49
+ return interpolateCInstructions(t, first, second);
50
+ }
51
+ if (first.type === 'Q') {
52
+ if (second.type !== 'Q') {
53
+ throw new Error('mismatch');
54
+ }
55
+ return interpolateQInstructions(t, first, second);
56
+ }
57
+ if (first.type === 'M') {
58
+ if (second.type !== 'M') {
59
+ throw new Error('mismatch');
60
+ }
61
+ return interpolateMInstructions(t, first, second);
62
+ }
63
+ if (first.type === 'Z') {
64
+ if (second.type !== 'Z') {
65
+ throw new Error('mismatch');
66
+ }
67
+ return {
68
+ type: 'Z',
69
+ };
70
+ }
71
+ throw new Error('mismatch');
72
+ };
73
+ exports.interpolateInstructionOfSameKind = interpolateInstructionOfSameKind;
@@ -0,0 +1,16 @@
1
+ import type { ReducedInstruction } from '../helpers/types';
2
+ /**
3
+ * Interpolate from A to B by extending A and B during interpolation to have
4
+ * the same number of points. This allows for a smooth transition when they
5
+ * have a different number of points.
6
+ *
7
+ * Ignores the `Z` command in paths unless both A and B end with it.
8
+ *
9
+ * This function works directly with arrays of command objects instead of with
10
+ * path `d` strings (see interpolatePath for working with `d` strings).
11
+ *
12
+ * @param {Object[]} aCommandsInput Array of path commands
13
+ * @param {Object[]} bCommandsInput Array of path commands
14
+ * @returns {Function} Interpolation function that maps t ([0, 1]) to an array of path commands.
15
+ */
16
+ export declare function interpolateInstructions(aCommandsInput: ReducedInstruction[], bCommandsInput: ReducedInstruction[]): (t: number) => ReducedInstruction[];
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.interpolateInstructions = void 0;
4
+ const get_end_position_1 = require("../get-end-position");
5
+ const convert_to_same_instruction_type_1 = require("./convert-to-same-instruction-type");
6
+ const extend_command_1 = require("./extend-command");
7
+ const interpolate_instruction_of_same_kind_1 = require("./interpolate-instruction-of-same-kind");
8
+ /**
9
+ * Interpolate from A to B by extending A and B during interpolation to have
10
+ * the same number of points. This allows for a smooth transition when they
11
+ * have a different number of points.
12
+ *
13
+ * Ignores the `Z` command in paths unless both A and B end with it.
14
+ *
15
+ * This function works directly with arrays of command objects instead of with
16
+ * path `d` strings (see interpolatePath for working with `d` strings).
17
+ *
18
+ * @param {Object[]} aCommandsInput Array of path commands
19
+ * @param {Object[]} bCommandsInput Array of path commands
20
+ * @returns {Function} Interpolation function that maps t ([0, 1]) to an array of path commands.
21
+ */
22
+ function interpolateInstructions(aCommandsInput, bCommandsInput) {
23
+ // make a copy so we don't mess with the input arrays
24
+ let aCommands = aCommandsInput.slice();
25
+ let bCommands = bCommandsInput.slice();
26
+ // both input sets are empty, so we don't interpolate
27
+ if (!aCommands.length && !bCommands.length) {
28
+ return function () {
29
+ return [];
30
+ };
31
+ }
32
+ // do we add Z during interpolation? yes if both have it. (we'd expect both to have it or not)
33
+ const addZ = (aCommands.length === 0 || aCommands[aCommands.length - 1].type === 'Z') &&
34
+ (bCommands.length === 0 || bCommands[bCommands.length - 1].type === 'Z');
35
+ // we temporarily remove Z
36
+ if (aCommands.length > 0 && aCommands[aCommands.length - 1].type === 'Z') {
37
+ aCommands.pop();
38
+ }
39
+ if (bCommands.length > 0 && bCommands[bCommands.length - 1].type === 'Z') {
40
+ bCommands.pop();
41
+ }
42
+ // if A is empty, treat it as if it used to contain just the first point
43
+ // of B. This makes it so the line extends out of from that first point.
44
+ if (!aCommands.length) {
45
+ aCommands.push(bCommands[0]);
46
+ // otherwise if B is empty, treat it as if it contains the first point
47
+ // of A. This makes it so the line retracts into the first point.
48
+ }
49
+ else if (!bCommands.length) {
50
+ bCommands.push(aCommands[0]);
51
+ }
52
+ // extend to match equal size
53
+ const numPointsToExtend = Math.abs(bCommands.length - aCommands.length);
54
+ if (numPointsToExtend !== 0) {
55
+ // B has more points than A, so add points to A before interpolating
56
+ if (bCommands.length > aCommands.length) {
57
+ aCommands = (0, extend_command_1.extendInstruction)(aCommands, bCommands);
58
+ // else if A has more points than B, add more points to B
59
+ }
60
+ else if (bCommands.length < aCommands.length) {
61
+ bCommands = (0, extend_command_1.extendInstruction)(bCommands, aCommands);
62
+ }
63
+ }
64
+ // commands have same length now.
65
+ // convert commands in A to the same type as those in B
66
+ const aSameType = aCommands.map((aCommand, i) => {
67
+ const commandsUntilNow = aCommands.slice(0, i);
68
+ const point = (0, get_end_position_1.getEndPosition)(commandsUntilNow);
69
+ return (0, convert_to_same_instruction_type_1.convertToSameInstructionType)(aCommand, bCommands[i], point);
70
+ });
71
+ const interpolatedCommands = [];
72
+ if (addZ) {
73
+ aSameType.push({ type: 'Z' }); // required for when returning at t == 0
74
+ bCommands.push({ type: 'Z' });
75
+ }
76
+ return function (t) {
77
+ // at 1 return the final value without the extensions used during interpolation
78
+ if (t === 1) {
79
+ return bCommandsInput;
80
+ }
81
+ // work with aCommands directly since interpolatedCommands are mutated
82
+ if (t === 0) {
83
+ return aSameType;
84
+ }
85
+ // interpolate the commands using the mutable interpolated command objs
86
+ for (let i = 0; i < aSameType.length; ++i) {
87
+ interpolatedCommands.push((0, interpolate_instruction_of_same_kind_1.interpolateInstructionOfSameKind)(t, aSameType[i], bCommands[i]));
88
+ }
89
+ return interpolatedCommands;
90
+ };
91
+ }
92
+ exports.interpolateInstructions = interpolateInstructions;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @description Interpolates between two SVG paths.
3
+ * @param {number} value A number - 0 means first path, 1 means second path, any other values will be interpolated
4
+ * @param {string} firstPath The first valid SVG path
5
+ * @param {string} secondPath The second valid SVG path
6
+ * @see [Documentation](https://remotion.dev/docs/paths/interpolate-path)
7
+ */
8
+ export declare const interpolatePath: (value: number, firstPath: string, secondPath: string) => string;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /*
3
+
4
+ Copied and adapted from https://github.com/pbeshai/d3-interpolate-path:
5
+ Copyright 2016, Peter Beshai
6
+ All rights reserved.
7
+
8
+ Redistribution and use in source and binary forms, with or without modification,
9
+ are permitted provided that the following conditions are met:
10
+
11
+ * Redistributions of source code must retain the above copyright notice, this
12
+ list of conditions and the following disclaimer.
13
+
14
+ * Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution.
17
+
18
+ * Neither the name of the author nor the names of contributors may be used to
19
+ endorse or promote products derived from this software without specific prior
20
+ written permission.
21
+
22
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
26
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+
33
+ */
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.interpolatePath = void 0;
36
+ const parse_path_1 = require("../parse-path");
37
+ const reduce_instructions_1 = require("../reduce-instructions");
38
+ const serialize_instructions_1 = require("../serialize-instructions");
39
+ const interpolate_instructions_1 = require("./interpolate-instructions");
40
+ /**
41
+ * @description Interpolates between two SVG paths.
42
+ * @param {number} value A number - 0 means first path, 1 means second path, any other values will be interpolated
43
+ * @param {string} firstPath The first valid SVG path
44
+ * @param {string} secondPath The second valid SVG path
45
+ * @see [Documentation](https://remotion.dev/docs/paths/interpolate-path)
46
+ */
47
+ const interpolatePath = (value, firstPath, secondPath) => {
48
+ // at 1 return the final value without the extensions used during interpolation
49
+ if (value === 1) {
50
+ return secondPath;
51
+ }
52
+ if (value === 0) {
53
+ return firstPath;
54
+ }
55
+ const aCommands = (0, reduce_instructions_1.reduceInstructions)((0, parse_path_1.parsePath)(firstPath));
56
+ if (aCommands.length === 0) {
57
+ throw new TypeError(`SVG Path "${firstPath}" is not valid`);
58
+ }
59
+ const bCommands = (0, reduce_instructions_1.reduceInstructions)((0, parse_path_1.parsePath)(secondPath));
60
+ if (bCommands.length === 0) {
61
+ throw new TypeError(`SVG Path "${secondPath}" is not valid`);
62
+ }
63
+ const commandInterpolator = (0, interpolate_instructions_1.interpolateInstructions)(aCommands, bCommands);
64
+ return (0, serialize_instructions_1.serializeInstructions)(commandInterpolator(value));
65
+ };
66
+ exports.interpolatePath = interpolatePath;
@@ -0,0 +1,9 @@
1
+ import type { ReducedInstruction } from '../helpers/types';
2
+ /**
3
+ * Convert segments represented as points back into a command object
4
+ *
5
+ * @param {Number[][]} points Array of [x,y] points: [start, control1, control2, ..., end]
6
+ * Represents a segment
7
+ * @return {Object} A command object representing the segment.
8
+ */
9
+ export declare function pointsToInstruction(points: number[][]): ReducedInstruction;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pointsToInstruction = void 0;
4
+ /**
5
+ * Convert segments represented as points back into a command object
6
+ *
7
+ * @param {Number[][]} points Array of [x,y] points: [start, control1, control2, ..., end]
8
+ * Represents a segment
9
+ * @return {Object} A command object representing the segment.
10
+ */
11
+ function pointsToInstruction(points) {
12
+ const x = points[points.length - 1][0];
13
+ const y = points[points.length - 1][1];
14
+ if (points.length === 4) {
15
+ const x1 = points[1][0];
16
+ const y1 = points[1][1];
17
+ const x2 = points[2][0];
18
+ const y2 = points[2][1];
19
+ return {
20
+ type: 'C',
21
+ cp1x: x1,
22
+ cp1y: y1,
23
+ cp2x: x2,
24
+ cp2y: y2,
25
+ x,
26
+ y,
27
+ };
28
+ }
29
+ if (points.length === 3) {
30
+ const x1 = points[1][0];
31
+ const y1 = points[1][1];
32
+ return {
33
+ type: 'Q',
34
+ cpx: x1,
35
+ cpy: y1,
36
+ x,
37
+ y,
38
+ };
39
+ }
40
+ return {
41
+ type: 'L',
42
+ x,
43
+ y,
44
+ };
45
+ }
46
+ exports.pointsToInstruction = pointsToInstruction;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Runs de Casteljau's algorithm enough times to produce the desired number of segments.
3
+ *
4
+ * @param {Number[][]} points Array of [x,y] points for de Casteljau (the initial segment to split)
5
+ * @param {Number} segmentCount Number of segments to split the original into
6
+ * @return {Number[][][]} Array of segments
7
+ */
8
+ export declare function splitCurveAsPoints(points: number[][], segmentCount?: number): number[][][];
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.splitCurveAsPoints = void 0;
4
+ const de_casteljau_1 = require("./de-casteljau");
5
+ /**
6
+ * Runs de Casteljau's algorithm enough times to produce the desired number of segments.
7
+ *
8
+ * @param {Number[][]} points Array of [x,y] points for de Casteljau (the initial segment to split)
9
+ * @param {Number} segmentCount Number of segments to split the original into
10
+ * @return {Number[][][]} Array of segments
11
+ */
12
+ function splitCurveAsPoints(points, segmentCount = 2) {
13
+ const segments = [];
14
+ let remainingCurve = points;
15
+ const tIncrement = 1 / segmentCount;
16
+ // x-----x-----x-----x
17
+ // t= 0.33 0.66 1
18
+ // x-----o-----------x
19
+ // r= 0.33
20
+ // x-----o-----x
21
+ // r= 0.5 (0.33 / (1 - 0.33)) === tIncrement / (1 - (tIncrement * (i - 1))
22
+ // x-----x-----x-----x----x
23
+ // t= 0.25 0.5 0.75 1
24
+ // x-----o----------------x
25
+ // r= 0.25
26
+ // x-----o----------x
27
+ // r= 0.33 (0.25 / (1 - 0.25))
28
+ // x-----o----x
29
+ // r= 0.5 (0.25 / (1 - 0.5))
30
+ for (let i = 0; i < segmentCount - 1; i++) {
31
+ const tRelative = tIncrement / (1 - tIncrement * i);
32
+ const split = (0, de_casteljau_1.decasteljau)(remainingCurve, tRelative);
33
+ segments.push(split.left);
34
+ remainingCurve = split.right;
35
+ }
36
+ // last segment is just to the end from the last point
37
+ segments.push(remainingCurve);
38
+ return segments;
39
+ }
40
+ exports.splitCurveAsPoints = splitCurveAsPoints;
@@ -0,0 +1,11 @@
1
+ import type { CInstruction, LInstruction, QInstruction, ReducedInstruction } from '../helpers/types';
2
+ /**
3
+ * Convert command objects to arrays of points, run de Casteljau's algorithm on it
4
+ * to split into to the desired number of segments.
5
+ *
6
+ * @param {Object} commandStart The start command object
7
+ * @param {Object} instructionEnd The end command object
8
+ * @param {Number} segmentCount The number of segments to create
9
+ * @return {Object[]} An array of commands representing the segments in sequence
10
+ */
11
+ export declare const splitCurveInstructions: (instructionStartX: number, instructionStartY: number, instructionEnd: LInstruction | QInstruction | CInstruction, segmentCount: number) => ReducedInstruction[];
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /*
3
+
4
+ Copied and adapted from https://github.com/pbeshai/d3-interpolate-path:
5
+ Copyright 2016, Peter Beshai
6
+ All rights reserved.
7
+
8
+ Redistribution and use in source and binary forms, with or without modification,
9
+ are permitted provided that the following conditions are met:
10
+
11
+ * Redistributions of source code must retain the above copyright notice, this
12
+ list of conditions and the following disclaimer.
13
+
14
+ * Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution.
17
+
18
+ * Neither the name of the author nor the names of contributors may be used to
19
+ endorse or promote products derived from this software without specific prior
20
+ written permission.
21
+
22
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
26
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+
33
+ */
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.splitCurveInstructions = void 0;
36
+ const points_to_command_1 = require("./points-to-command");
37
+ const split_curve_as_points_1 = require("./split-curve-as-points");
38
+ /**
39
+ * Convert command objects to arrays of points, run de Casteljau's algorithm on it
40
+ * to split into to the desired number of segments.
41
+ *
42
+ * @param {Object} commandStart The start command object
43
+ * @param {Object} instructionEnd The end command object
44
+ * @param {Number} segmentCount The number of segments to create
45
+ * @return {Object[]} An array of commands representing the segments in sequence
46
+ */
47
+ const splitCurveInstructions = (instructionStartX, instructionStartY, instructionEnd, segmentCount) => {
48
+ const points = [[instructionStartX, instructionStartY]];
49
+ if (instructionEnd.type === 'Q') {
50
+ points.push([instructionEnd.cpx, instructionEnd.cpy]);
51
+ }
52
+ if (instructionEnd.type === 'C') {
53
+ points.push([instructionEnd.cp1x, instructionEnd.cp1y]);
54
+ points.push([instructionEnd.cp2x, instructionEnd.cp2y]);
55
+ }
56
+ points.push([instructionEnd.x, instructionEnd.y]);
57
+ return (0, split_curve_as_points_1.splitCurveAsPoints)(points, segmentCount).map((p) => {
58
+ return (0, points_to_command_1.pointsToInstruction)(p);
59
+ });
60
+ };
61
+ exports.splitCurveInstructions = splitCurveInstructions;
@@ -0,0 +1,14 @@
1
+ import type { ReducedInstruction } from '../helpers/types';
2
+ /**
3
+ * Interpolate between command objects commandStart and commandEnd segmentCount times.
4
+ * If the types are L, Q, or C then the curves are split as per de Casteljau's algorithm.
5
+ * Otherwise we just copy commandStart segmentCount - 1 times, finally ending with commandEnd.
6
+ *
7
+ * @param {Object} commandStart Command object at the beginning of the segment
8
+ * @param {Object} commandEnd Command object at the end of the segment
9
+ * @param {Number} segmentCount The number of segments to split this into. If only 1
10
+ * Then [commandEnd] is returned.
11
+ * @return {Object[]} Array of ~segmentCount command objects between commandStart and
12
+ * commandEnd. (Can be segmentCount+1 objects if commandStart is type M).
13
+ */
14
+ export declare function splitSegmentInstructions(commandStart: ReducedInstruction, commandEnd: ReducedInstruction, segmentCount: number): ReducedInstruction[];
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.splitSegmentInstructions = void 0;
4
+ const split_curve_1 = require("./split-curve");
5
+ /**
6
+ * Interpolate between command objects commandStart and commandEnd segmentCount times.
7
+ * If the types are L, Q, or C then the curves are split as per de Casteljau's algorithm.
8
+ * Otherwise we just copy commandStart segmentCount - 1 times, finally ending with commandEnd.
9
+ *
10
+ * @param {Object} commandStart Command object at the beginning of the segment
11
+ * @param {Object} commandEnd Command object at the end of the segment
12
+ * @param {Number} segmentCount The number of segments to split this into. If only 1
13
+ * Then [commandEnd] is returned.
14
+ * @return {Object[]} Array of ~segmentCount command objects between commandStart and
15
+ * commandEnd. (Can be segmentCount+1 objects if commandStart is type M).
16
+ */
17
+ function splitSegmentInstructions(commandStart, commandEnd, segmentCount) {
18
+ let segments = [];
19
+ // line, quadratic bezier, or cubic bezier
20
+ if (commandEnd.type === 'L' ||
21
+ commandEnd.type === 'Q' ||
22
+ commandEnd.type === 'C') {
23
+ if (commandStart.type !== 'Z') {
24
+ segments = segments.concat((0, split_curve_1.splitCurveInstructions)(commandStart.x, commandStart.y, commandEnd, segmentCount));
25
+ }
26
+ // general case - just copy the same point
27
+ }
28
+ else {
29
+ const copyCommand = commandStart.type === 'M'
30
+ ? {
31
+ type: 'L',
32
+ x: commandStart.x,
33
+ y: commandStart.y,
34
+ }
35
+ : commandStart;
36
+ segments = segments.concat(new Array(segmentCount - 1).fill(true).map(() => copyCommand));
37
+ segments.push(commandEnd);
38
+ }
39
+ return segments;
40
+ }
41
+ exports.splitSegmentInstructions = splitSegmentInstructions;
@@ -6,9 +6,6 @@ export type WarpPathFn = (point: {
6
6
  x: number;
7
7
  y: number;
8
8
  };
9
- export declare function split(p: number[][], t?: number): number[][][];
10
- export declare function interpolateUntil(points: [number, number][], threshold: number, deltaFunction?: (points: [number, number][]) => number): [number, number][][];
11
- export declare function createLineSegment(points: number[][]): ReducedInstruction;
12
9
  export declare function svgPathInterpolate(path: ReducedInstruction[], threshold: number): ReducedInstruction[];
13
10
  export declare const warpTransform: (path: ReducedInstruction[], transformer: WarpPathFn) => ReducedInstruction[];
14
11
  export declare const fixZInstruction: (instructions: ReducedInstruction[]) => ReducedInstruction[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fixZInstruction = exports.warpTransform = exports.svgPathInterpolate = exports.createLineSegment = exports.interpolateUntil = exports.split = void 0;
3
+ exports.fixZInstruction = exports.warpTransform = exports.svgPathInterpolate = void 0;
4
4
  const euclideanDistance = (points) => {
5
5
  const startPoint = points[0];
6
6
  const endPoint = points[points.length - 1];
@@ -38,7 +38,6 @@ function split(p, t = 0.5) {
38
38
  }
39
39
  return [seg0, seg1];
40
40
  }
41
- exports.split = split;
42
41
  function interpolateUntil(points, threshold, deltaFunction = euclideanDistance) {
43
42
  const stack = [points];
44
43
  const segments = [];
@@ -57,7 +56,6 @@ function interpolateUntil(points, threshold, deltaFunction = euclideanDistance)
57
56
  }
58
57
  return segments;
59
58
  }
60
- exports.interpolateUntil = interpolateUntil;
61
59
  function createLineSegment(points) {
62
60
  switch (points.length) {
63
61
  case 2:
@@ -88,7 +86,6 @@ function createLineSegment(points) {
88
86
  throw new Error('Expected 2, 3 or 4 points for a line segment, got ' + points.length);
89
87
  }
90
88
  }
91
- exports.createLineSegment = createLineSegment;
92
89
  function warpInterpolate(path, threshold, deltaFunction) {
93
90
  let prexX = 0;
94
91
  let prexY = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/paths",
3
- "version": "4.0.163",
3
+ "version": "4.0.165",
4
4
  "description": "Utility functions for SVG paths",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,