@remotion/paths 4.0.0-webhook.27 → 4.1.0-alpha2

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 (69) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +1 -2
  3. package/dist/evolve-path.d.ts +2 -2
  4. package/dist/evolve-path.js +2 -2
  5. package/dist/extend-viewbox.d.ts +2 -2
  6. package/dist/extend-viewbox.js +2 -2
  7. package/dist/get-bounding-box.d.ts +8 -0
  8. package/dist/get-bounding-box.js +185 -0
  9. package/dist/get-length.d.ts +2 -2
  10. package/dist/get-length.js +2 -2
  11. package/dist/get-point-at-length.d.ts +2 -2
  12. package/dist/get-point-at-length.js +2 -2
  13. package/dist/get-subpaths.d.ts +6 -0
  14. package/dist/get-subpaths.js +19 -0
  15. package/dist/get-tangent-at-length.d.ts +2 -2
  16. package/dist/get-tangent-at-length.js +2 -2
  17. package/dist/helpers/arc.d.ts +0 -0
  18. package/dist/helpers/arc.js +0 -0
  19. package/dist/helpers/bezier-functions.d.ts +0 -0
  20. package/dist/helpers/bezier-functions.js +0 -0
  21. package/dist/helpers/bezier-values.d.ts +0 -0
  22. package/dist/helpers/bezier-values.js +0 -0
  23. package/dist/helpers/bezier.d.ts +0 -0
  24. package/dist/helpers/bezier.js +0 -0
  25. package/dist/helpers/construct.d.ts +9 -1
  26. package/dist/helpers/construct.js +218 -128
  27. package/dist/helpers/get-part-at-length.d.ts +0 -0
  28. package/dist/helpers/get-part-at-length.js +0 -0
  29. package/dist/helpers/iterate.d.ts +14 -0
  30. package/dist/helpers/iterate.js +95 -0
  31. package/dist/helpers/linear.d.ts +6 -1
  32. package/dist/helpers/linear.js +1 -1
  33. package/dist/helpers/remove-a-s-t-curves.d.ts +2 -0
  34. package/dist/helpers/remove-a-s-t-curves.js +271 -0
  35. package/dist/helpers/split-curve.d.ts +1 -1
  36. package/dist/helpers/split-curve.js +0 -0
  37. package/dist/helpers/types.d.ts +109 -2
  38. package/dist/helpers/types.js +0 -0
  39. package/dist/index.d.ts +10 -2
  40. package/dist/index.js +19 -3
  41. package/dist/interpolate-path.d.ts +2 -2
  42. package/dist/interpolate-path.js +2 -2
  43. package/dist/normalize-path.d.ts +4 -2
  44. package/dist/normalize-path.js +141 -277
  45. package/dist/parse-path.d.ts +8 -0
  46. package/dist/parse-path.js +265 -0
  47. package/dist/reduce-instructions.d.ts +7 -0
  48. package/dist/reduce-instructions.js +15 -0
  49. package/dist/reset-path.d.ts +6 -0
  50. package/dist/reset-path.js +15 -0
  51. package/dist/reverse-path.d.ts +2 -2
  52. package/dist/reverse-path.js +73 -118
  53. package/dist/scale-path.d.ts +10 -0
  54. package/dist/scale-path.js +180 -0
  55. package/dist/serialize-instructions.d.ts +2 -0
  56. package/dist/serialize-instructions.js +78 -0
  57. package/dist/translate-path.d.ts +11 -0
  58. package/dist/translate-path.js +116 -0
  59. package/dist/warp-path/index.d.ts +10 -0
  60. package/dist/warp-path/index.js +26 -0
  61. package/dist/warp-path/warp-helpers.d.ts +14 -0
  62. package/dist/warp-path/warp-helpers.js +229 -0
  63. package/package.json +38 -38
  64. package/.prettierrc.js +0 -14
  65. package/dist/get-parts.d.ts +0 -7
  66. package/dist/get-parts.js +0 -31
  67. package/dist/helpers/parse.d.ts +0 -2
  68. package/dist/helpers/parse.js +0 -49
  69. package/tsconfig.json +0 -9
@@ -0,0 +1,265 @@
1
+ "use strict";
2
+ // Copied from: https://github.com/rveciana/svg-path-properties
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.parsePath = void 0;
5
+ const length = {
6
+ a: 7,
7
+ A: 7,
8
+ C: 6,
9
+ c: 6,
10
+ H: 1,
11
+ h: 1,
12
+ L: 2,
13
+ l: 2,
14
+ M: 2,
15
+ m: 2,
16
+ Q: 4,
17
+ q: 4,
18
+ S: 4,
19
+ s: 4,
20
+ T: 2,
21
+ t: 2,
22
+ V: 1,
23
+ v: 1,
24
+ Z: 0,
25
+ z: 0,
26
+ };
27
+ const chunkExact = (array, instruction) => {
28
+ const chunks = [];
29
+ const expectedSize = length[instruction];
30
+ if (array.length % expectedSize !== 0) {
31
+ throw new Error(`Expected number of arguments of SVG instruction "${instruction} ${array.join(' ')}" to be a multiple of ${expectedSize}`);
32
+ }
33
+ for (let i = 0; i < array.length; i += expectedSize) {
34
+ chunks.push(array.slice(i, i + expectedSize));
35
+ }
36
+ return chunks;
37
+ };
38
+ const makeInstructions = (arr, instruction, cb) => {
39
+ return chunkExact(arr, instruction).map((args) => {
40
+ return cb(args);
41
+ });
42
+ };
43
+ const segmentRegExp = /([astvzqmhlc])([^astvzqmhlc]*)/gi;
44
+ const numberRegExp = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;
45
+ /**
46
+ * @description Parses an SVG string path into an array of Instruction's.
47
+ * @param {string} path
48
+ * @returns an array of objects containing the Instructions
49
+ * @see [Documentation](https://www.remotion.dev/docs/paths/parse-path)
50
+ */
51
+ const parsePath = (path) => {
52
+ if (!path) {
53
+ throw new Error('No path provided');
54
+ }
55
+ const segments = path.match(segmentRegExp);
56
+ if (!segments) {
57
+ throw new Error(`No path elements found in string ${path}`);
58
+ }
59
+ return segments
60
+ .map((segmentString) => {
61
+ const command = segmentString.charAt(0);
62
+ const args = parseValues(segmentString.substring(1), command);
63
+ // overloaded moveTo
64
+ if (command === 'M' && args.length > 2) {
65
+ const segmentsArray = [];
66
+ segmentsArray.push({
67
+ type: command,
68
+ x: args[0],
69
+ y: args[1],
70
+ });
71
+ segmentsArray.push(...makeInstructions(args.slice(2), 'L', (numbers) => ({
72
+ type: 'L',
73
+ x: numbers[0],
74
+ y: numbers[1],
75
+ })));
76
+ return segmentsArray;
77
+ }
78
+ if (command === 'm' && args.length > 2) {
79
+ const segmentsArray = [];
80
+ segmentsArray.push({
81
+ type: command,
82
+ dx: args[0],
83
+ dy: args[1],
84
+ });
85
+ segmentsArray.push(...makeInstructions(args.slice(2), 'l', (numbers) => ({
86
+ type: 'l',
87
+ dx: numbers[0],
88
+ dy: numbers[1],
89
+ })));
90
+ return segmentsArray;
91
+ }
92
+ if (command === 'Z' || command === 'z') {
93
+ return [
94
+ {
95
+ type: 'Z',
96
+ },
97
+ ];
98
+ }
99
+ if (command === 'A') {
100
+ return makeInstructions(args, command, (numbers) => ({
101
+ type: command,
102
+ rx: numbers[0],
103
+ ry: numbers[1],
104
+ xAxisRotation: numbers[2],
105
+ largeArcFlag: numbers[3] === 1,
106
+ sweepFlag: numbers[4] === 1,
107
+ x: numbers[5],
108
+ y: numbers[6],
109
+ }));
110
+ }
111
+ if (command === 'a') {
112
+ return makeInstructions(args, command, (numbers) => ({
113
+ type: command,
114
+ rx: numbers[0],
115
+ ry: numbers[1],
116
+ xAxisRotation: numbers[2],
117
+ largeArcFlag: numbers[3] === 1,
118
+ sweepFlag: numbers[4] === 1,
119
+ dx: numbers[5],
120
+ dy: numbers[6],
121
+ }));
122
+ }
123
+ if (command === 'C') {
124
+ return makeInstructions(args, command, (numbers) => ({
125
+ type: command,
126
+ cp1x: numbers[0],
127
+ cp1y: numbers[1],
128
+ cp2x: numbers[2],
129
+ cp2y: numbers[3],
130
+ x: numbers[4],
131
+ y: numbers[5],
132
+ }));
133
+ }
134
+ if (command === 'c') {
135
+ return makeInstructions(args, command, (numbers) => ({
136
+ type: command,
137
+ cp1dx: numbers[0],
138
+ cp1dy: numbers[1],
139
+ cp2dx: numbers[2],
140
+ cp2dy: numbers[3],
141
+ dx: numbers[4],
142
+ dy: numbers[5],
143
+ }));
144
+ }
145
+ if (command === 'S') {
146
+ return makeInstructions(args, command, (numbers) => ({
147
+ type: command,
148
+ cpx: numbers[0],
149
+ cpy: numbers[1],
150
+ x: numbers[2],
151
+ y: numbers[3],
152
+ }));
153
+ }
154
+ if (command === 's') {
155
+ return makeInstructions(args, command, (numbers) => ({
156
+ type: command,
157
+ cpdx: numbers[0],
158
+ cpdy: numbers[1],
159
+ dx: numbers[2],
160
+ dy: numbers[3],
161
+ }));
162
+ }
163
+ if (command === 'H') {
164
+ return makeInstructions(args, command, (numbers) => ({
165
+ type: command,
166
+ x: numbers[0],
167
+ }));
168
+ }
169
+ if (command === 'h') {
170
+ return makeInstructions(args, command, (numbers) => ({
171
+ type: command,
172
+ dx: numbers[0],
173
+ }));
174
+ }
175
+ if (command === 'V') {
176
+ return makeInstructions(args, command, (numbers) => ({
177
+ type: command,
178
+ y: numbers[0],
179
+ }));
180
+ }
181
+ if (command === 'v') {
182
+ return makeInstructions(args, command, (numbers) => ({
183
+ type: command,
184
+ dy: numbers[0],
185
+ }));
186
+ }
187
+ if (command === 'L') {
188
+ return makeInstructions(args, command, (numbers) => ({
189
+ type: command,
190
+ x: numbers[0],
191
+ y: numbers[1],
192
+ }));
193
+ }
194
+ if (command === 'M') {
195
+ return makeInstructions(args, command, (numbers) => ({
196
+ type: command,
197
+ x: numbers[0],
198
+ y: numbers[1],
199
+ }));
200
+ }
201
+ if (command === 'm') {
202
+ return makeInstructions(args, command, (numbers) => ({
203
+ type: command,
204
+ dx: numbers[0],
205
+ dy: numbers[1],
206
+ }));
207
+ }
208
+ if (command === 'l') {
209
+ return makeInstructions(args, command, (numbers) => ({
210
+ type: command,
211
+ dx: numbers[0],
212
+ dy: numbers[1],
213
+ }));
214
+ }
215
+ if (command === 'Q') {
216
+ return makeInstructions(args, command, (numbers) => ({
217
+ type: command,
218
+ cpx: numbers[0],
219
+ cpy: numbers[1],
220
+ x: numbers[2],
221
+ y: numbers[3],
222
+ }));
223
+ }
224
+ if (command === 'q') {
225
+ return makeInstructions(args, command, (numbers) => ({
226
+ type: command,
227
+ cpdx: numbers[0],
228
+ cpdy: numbers[1],
229
+ dx: numbers[2],
230
+ dy: numbers[3],
231
+ }));
232
+ }
233
+ if (command === 'T') {
234
+ return makeInstructions(args, command, (numbers) => ({
235
+ type: command,
236
+ x: numbers[0],
237
+ y: numbers[1],
238
+ }));
239
+ }
240
+ if (command === 't') {
241
+ return makeInstructions(args, command, (numbers) => ({
242
+ type: command,
243
+ dx: numbers[0],
244
+ dy: numbers[1],
245
+ }));
246
+ }
247
+ throw new Error(`Invalid path element ${segmentString}`);
248
+ }, [])
249
+ .flat(1);
250
+ };
251
+ exports.parsePath = parsePath;
252
+ const parseValues = (args, instructionType) => {
253
+ const numbers = args.match(numberRegExp);
254
+ if (!numbers) {
255
+ if (instructionType === 'Z' || instructionType === 'z') {
256
+ return [];
257
+ }
258
+ throw new Error(`Malformed path data: ${instructionType} was expected to have numbers afterwards`);
259
+ }
260
+ const expectedArguments = length[instructionType];
261
+ if (numbers.length % expectedArguments !== 0) {
262
+ throw new Error(`Malformed path data: ${instructionType} was expected to have a multiple of ${expectedArguments} numbers, but got "${instructionType} ${numbers.join(' ')} instead"`);
263
+ }
264
+ return numbers.map(Number);
265
+ };
@@ -0,0 +1,7 @@
1
+ import type { Instruction, ReducedInstruction } from './helpers/types';
2
+ /**
3
+ * @description Takes an array of Instruction's and reduces the amount of instruction types them so the path only consists of M, L, C, Q and Z instructions.
4
+ * @param {Array} instruction
5
+ * @see [Documentation](https://www.remotion.dev/docs/paths/reduce-instructions)
6
+ */
7
+ export declare const reduceInstructions: (instruction: Instruction[]) => ReducedInstruction[];
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reduceInstructions = void 0;
4
+ const remove_a_s_t_curves_1 = require("./helpers/remove-a-s-t-curves");
5
+ const normalize_path_1 = require("./normalize-path");
6
+ /**
7
+ * @description Takes an array of Instruction's and reduces the amount of instruction types them so the path only consists of M, L, C, Q and Z instructions.
8
+ * @param {Array} instruction
9
+ * @see [Documentation](https://www.remotion.dev/docs/paths/reduce-instructions)
10
+ */
11
+ const reduceInstructions = (instruction) => {
12
+ const simplified = (0, normalize_path_1.normalizeInstructions)(instruction);
13
+ return (0, remove_a_s_t_curves_1.removeATSHVInstructions)(simplified);
14
+ };
15
+ exports.reduceInstructions = reduceInstructions;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @description Translates an SVG path so that the top-left corner of the bounding box is at 0, 0.
3
+ * @param {string} d a valid SVG path
4
+ * @see [Documentation](https://www.remotion.dev/docs/paths/reset-path)
5
+ */
6
+ export declare const resetPath: (d: string) => string;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resetPath = void 0;
4
+ const get_bounding_box_1 = require("./get-bounding-box");
5
+ const translate_path_1 = require("./translate-path");
6
+ /**
7
+ * @description Translates an SVG path so that the top-left corner of the bounding box is at 0, 0.
8
+ * @param {string} d a valid SVG path
9
+ * @see [Documentation](https://www.remotion.dev/docs/paths/reset-path)
10
+ */
11
+ const resetPath = (d) => {
12
+ const box = (0, get_bounding_box_1.getBoundingBox)(d);
13
+ return (0, translate_path_1.translatePath)(d, -box.x1, -box.y1);
14
+ };
15
+ exports.resetPath = resetPath;
@@ -5,8 +5,8 @@
5
5
  * not recognise the public domain, where this code is MIT licensed.
6
6
  */
7
7
  /**
8
- * Reverses a path so the end and start are switched.
8
+ * @description Reverses a path so the end and start are switched.
9
9
  * @param {string} path A valid SVG path
10
- * @link https://remotion.dev/docs/paths/reverse-path
10
+ * @see [Documentation](https://remotion.dev/docs/paths/reverse-path)
11
11
  */
12
12
  export declare const reversePath: (path: string) => string;
@@ -7,139 +7,94 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.reversePath = void 0;
10
+ const construct_1 = require("./helpers/construct");
10
11
  const normalize_path_1 = require("./normalize-path");
11
- /**
12
- * Normalise an SVG path to absolute coordinates
13
- * and full commands, rather than relative coordinates
14
- * and/or shortcut commands.
15
- */
16
- /**
17
- * Reverse an SVG path.
18
- * As long as the input path is normalised, this is actually really
19
- * simple to do. As all pathing commands are symmetrical, meaning
20
- * that they render the same when you reverse the coordinate order,
21
- * the grand trick here is to reverse the path (making sure to keep
22
- * coordinates ordered pairwise) and shift the operators left by
23
- * one or two coordinate pairs depending on the operator:
24
- *
25
- * - Z is removed (after noting it existed),
26
- * - L moves to 2 spots earlier (skipping one coordinate),
27
- * - Q moves to 2 spots earlier (skipping one coordinate),
28
- * - C moves to 4 spots earlier (skipping two coordinates)
29
- * and its arguments get reversed,
30
- * - the path start becomes M.
31
- * - the path end becomes Z iff it was there to begin with.
32
- */
33
- function reverseNormalizedPath(normalized) {
34
- const terms = normalized.trim().split(' ');
35
- let term;
36
- const tlen = terms.length;
37
- const tlen1 = tlen - 1;
38
- let t;
12
+ const parse_path_1 = require("./parse-path");
13
+ const reduce_instructions_1 = require("./reduce-instructions");
14
+ const serialize_instructions_1 = require("./serialize-instructions");
15
+ function reverseNormalizedPath(instructions) {
39
16
  const reversed = [];
40
- let x;
41
- let y;
42
- let pair;
43
- let pairs;
44
- let shift;
45
- const matcher = /[QAZLCM]/;
46
- const closed = terms.slice(-1)[0].toUpperCase() === 'Z';
47
- for (t = 0; t < tlen; t++) {
48
- term = terms[t];
49
- // Is this an operator? If it is, run through its
50
- // argument list, which we know is fixed length.
51
- if (matcher.test(term)) {
52
- // Arc processing relies on not-just-coordinates
53
- if (term === 'A') {
54
- reversed.push(terms[t + 5] === '0' ? '1' : '0');
55
- reversed.push(terms[t + 4]);
56
- reversed.push(terms[t + 3]);
57
- reversed.push(terms[t + 2]);
58
- reversed.push(terms[t + 1]);
59
- reversed.push(term);
60
- reversed.push(terms[t + 7]);
61
- reversed.push(terms[t + 6]);
62
- t += 7;
63
- continue;
64
- }
65
- // how many coordinate pairs do we need to read,
66
- // and by how many pairs should this operator be
67
- // shifted left?
68
- else if (term === 'C') {
69
- pairs = 3;
70
- shift = 2;
71
- }
72
- else if (term === 'Q') {
73
- pairs = 2;
74
- shift = 1;
75
- }
76
- else if (term === 'L') {
77
- pairs = 1;
78
- shift = 1;
79
- }
80
- else if (term === 'M') {
81
- pairs = 1;
82
- shift = 0;
83
- }
84
- else {
85
- continue;
86
- }
87
- // do the argument reading and operator shifting
88
- if (pairs === shift) {
89
- reversed.push(term);
90
- }
91
- for (pair = 0; pair < pairs; pair++) {
92
- if (pair === shift) {
93
- reversed.push(term);
94
- }
95
- x = terms[++t];
96
- y = terms[++t];
97
- reversed.push(y);
98
- reversed.push(x);
99
- }
17
+ let nextX = 0;
18
+ let nextY = 0;
19
+ for (const term of instructions) {
20
+ if (term.type === 'A') {
21
+ reversed.unshift({
22
+ type: 'A',
23
+ largeArcFlag: term.largeArcFlag,
24
+ rx: term.rx,
25
+ ry: term.ry,
26
+ xAxisRotation: term.xAxisRotation,
27
+ sweepFlag: !term.sweepFlag,
28
+ x: nextX,
29
+ y: nextY,
30
+ });
31
+ }
32
+ else if (term.type === 'C') {
33
+ reversed.unshift({
34
+ type: 'C',
35
+ cp1x: term.cp2x,
36
+ cp1y: term.cp2y,
37
+ cp2x: term.cp1x,
38
+ cp2y: term.cp1y,
39
+ x: nextX,
40
+ y: nextY,
41
+ });
42
+ }
43
+ else if (term.type === 'Q') {
44
+ reversed.unshift({
45
+ type: 'Q',
46
+ cpx: term.cpx,
47
+ cpy: term.cpy,
48
+ x: nextX,
49
+ y: nextY,
50
+ });
51
+ }
52
+ else if (term.type === 'L') {
53
+ reversed.unshift({
54
+ type: 'L',
55
+ x: nextX,
56
+ y: nextY,
57
+ });
58
+ // Do nothing
59
+ }
60
+ else if (term.type === 'M') {
61
+ // Do nothing
62
+ }
63
+ else if (term.type === 'Z') {
64
+ // Do nothing
100
65
  }
101
- // the code has been set up so that every time we
102
- // iterate because of the for() operation, the term
103
- // we see is a pathing operator, not a number. As
104
- // such, if we get to this "else" the path is malformed.
105
66
  else {
106
- const pre = terms.slice(Math.max(t - 3, 0), 3).join(' ');
107
- const post = terms.slice(t + 1, Math.min(t + 4, tlen1)).join(' ');
108
- const range = pre + ' [' + term + '] ' + post;
109
- throw new Error('Error while trying to reverse normalized SVG path, at position ' +
110
- t +
111
- ' (' +
112
- range +
113
- ').\n' +
114
- "Either the path is not normalised, or it's malformed.");
67
+ throw new Error('unnormalized instruction ' + term.type);
68
+ }
69
+ if (term.type !== 'Z') {
70
+ nextX = term.x;
71
+ nextY = term.y;
115
72
  }
116
73
  }
117
- reversed.push('M');
118
- // generating the reversed path string involves
119
- // running through our transformed terms in reverse.
120
- let revstring = '';
121
- const rlen1 = reversed.length - 1;
122
- let r;
123
- for (r = rlen1; r > 0; r--) {
124
- revstring += reversed[r] + ' ';
125
- }
126
- if (closed)
74
+ reversed.unshift({
75
+ type: 'M',
76
+ x: nextX,
77
+ y: nextY,
78
+ });
79
+ let revstring = (0, serialize_instructions_1.serializeInstructions)(reversed);
80
+ if (instructions[instructions.length - 1].type === 'Z')
127
81
  revstring += 'Z';
128
82
  revstring = revstring.replace(/M M/g, 'Z M');
129
83
  return revstring;
130
84
  }
131
85
  /**
132
- * Reverses a path so the end and start are switched.
86
+ * @description Reverses a path so the end and start are switched.
133
87
  * @param {string} path A valid SVG path
134
- * @link https://remotion.dev/docs/paths/reverse-path
88
+ * @see [Documentation](https://remotion.dev/docs/paths/reverse-path)
135
89
  */
136
90
  const reversePath = (path) => {
137
- const normalizedPath = (0, normalize_path_1.normalizePath)(path);
138
- const paths = normalizedPath.replace(/M/g, '|M').split('|');
139
- paths.splice(0, 1);
140
- return paths
91
+ const parsed = (0, parse_path_1.parsePath)(path);
92
+ const normalized = (0, normalize_path_1.normalizeInstructions)(parsed);
93
+ const reduced = (0, reduce_instructions_1.reduceInstructions)(normalized);
94
+ const { segments } = (0, construct_1.constructFromInstructions)(reduced);
95
+ return segments
141
96
  .map((spath) => {
142
- return reverseNormalizedPath(spath.trim());
97
+ return reverseNormalizedPath(spath);
143
98
  })
144
99
  .join(' ')
145
100
  .replace(/ +/g, ' ')
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @description Allows you to grow or shrink the size of a path.
3
+ * @param {string} path A valid SVG path
4
+ * @param {string} d
5
+ * @param {Number} scaleX
6
+ * @param {Number} scaleY
7
+ * @returns a new path with respect to the scale values provided
8
+ * @see [Documentation](https://www.remotion.dev/docs/paths/scale-path)
9
+ */
10
+ export declare const scalePath: (d: string, scaleX: number, scaleY: number) => string;