@remotion/animation-utils 4.0.207 → 4.0.209
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/README.md +1 -1
- package/dist/esm/index.mjs +50 -50
- package/package.json +3 -2
package/README.md
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -9,10 +9,10 @@ var NUMBER = "[-+]?\\d*\\.?\\d+";
|
|
|
9
9
|
var PERCENTAGE = NUMBER + "%";
|
|
10
10
|
|
|
11
11
|
// src/transformation-helpers/interpolate-styles/utils.ts
|
|
12
|
-
|
|
12
|
+
function call(...args) {
|
|
13
13
|
return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
|
|
14
|
-
}
|
|
15
|
-
|
|
14
|
+
}
|
|
15
|
+
function getColorMatchers() {
|
|
16
16
|
const cachedMatchers = {
|
|
17
17
|
rgb: undefined,
|
|
18
18
|
rgba: undefined,
|
|
@@ -35,7 +35,7 @@ var getColorMatchers = function() {
|
|
|
35
35
|
cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
36
36
|
}
|
|
37
37
|
return cachedMatchers;
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
var extractOrderedPartsOfValue = (value) => {
|
|
40
40
|
const parts = [];
|
|
41
41
|
let remainingValue = value;
|
|
@@ -133,7 +133,7 @@ var breakDownValueIntoUnitNumberAndFunctions = (value) => {
|
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
// src/transformation-helpers/interpolate-styles/index.tsx
|
|
136
|
-
|
|
136
|
+
function checkInputRange(arr) {
|
|
137
137
|
if (arr.length < 2) {
|
|
138
138
|
throw new Error("inputRange must have at least 2 elements");
|
|
139
139
|
}
|
|
@@ -148,8 +148,8 @@ var checkInputRange = function(arr) {
|
|
|
148
148
|
throw new Error(`inputRange must be strictly monotonically non-decreasing but got [${arr.join(",")}]`);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
}
|
|
152
|
-
|
|
151
|
+
}
|
|
152
|
+
function checkStylesRange(arr) {
|
|
153
153
|
if (arr.length < 2) {
|
|
154
154
|
throw new Error("outputStyles must have at least 2 elements");
|
|
155
155
|
}
|
|
@@ -158,7 +158,7 @@ var checkStylesRange = function(arr) {
|
|
|
158
158
|
throw new Error("outputStyles must contain only objects");
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
}
|
|
161
|
+
}
|
|
162
162
|
var interpolatedPropertyPart = ({
|
|
163
163
|
inputValue,
|
|
164
164
|
inputRange,
|
|
@@ -374,7 +374,7 @@ var isUnitWithString = (input, units) => {
|
|
|
374
374
|
};
|
|
375
375
|
|
|
376
376
|
// src/transformation-helpers/make-transform/transform-functions.ts
|
|
377
|
-
|
|
377
|
+
function matrix(a, b, c, d, tx, ty) {
|
|
378
378
|
checkNumber({ num: a, param: "a", api: "matrix" });
|
|
379
379
|
checkNumber({ num: b, param: "b", api: "matrix" });
|
|
380
380
|
checkNumber({ num: c, param: "c", api: "matrix" });
|
|
@@ -382,8 +382,8 @@ var matrix = function(a, b, c, d, tx, ty) {
|
|
|
382
382
|
checkNumber({ num: tx, param: "tx", api: "matrix" });
|
|
383
383
|
checkNumber({ num: ty, param: "ty", api: "matrix" });
|
|
384
384
|
return `matrix(${a}, ${b}, ${c}, ${d}, ${tx}, ${ty})`;
|
|
385
|
-
}
|
|
386
|
-
|
|
385
|
+
}
|
|
386
|
+
function matrix3d(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4) {
|
|
387
387
|
checkNumber({ num: a1, param: "a1", api: "matrix3d" });
|
|
388
388
|
checkNumber({ num: b1, param: "b1", api: "matrix3d" });
|
|
389
389
|
checkNumber({ num: c1, param: "c1", api: "matrix3d" });
|
|
@@ -401,22 +401,22 @@ var matrix3d = function(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4,
|
|
|
401
401
|
checkNumber({ num: c4, param: "c4", api: "matrix3d" });
|
|
402
402
|
checkNumber({ num: d4, param: "d4", api: "matrix3d" });
|
|
403
403
|
return `matrix3d(${a1}, ${b1}, ${c1}, ${d1}, ${a2}, ${b2}, ${c2}, ${d2}, ${a3}, ${b3}, ${c3}, ${d3}, ${a4}, ${b4}, ${c4}, ${d4})`;
|
|
404
|
-
}
|
|
405
|
-
|
|
404
|
+
}
|
|
405
|
+
function perspective(length, unit = "px") {
|
|
406
406
|
if (isUnitWithString(length, lengthUnits)) {
|
|
407
407
|
return `perspective(${length})`;
|
|
408
408
|
}
|
|
409
409
|
checkNumber({ num: length, param: "length", api: "perspective" });
|
|
410
410
|
return `perspective(${length}${unit})`;
|
|
411
|
-
}
|
|
412
|
-
|
|
411
|
+
}
|
|
412
|
+
function rotate(angle, unit = "deg") {
|
|
413
413
|
if (isUnitWithString(angle, angleUnits)) {
|
|
414
414
|
return `rotate(${angle})`;
|
|
415
415
|
}
|
|
416
416
|
checkNumber({ num: angle, param: "angle", api: "rotate" });
|
|
417
417
|
return `rotate(${angle}${unit})`;
|
|
418
|
-
}
|
|
419
|
-
|
|
418
|
+
}
|
|
419
|
+
function rotate3d(x, y, z, angle, unit = "deg") {
|
|
420
420
|
checkNumber({ num: x, param: "x", api: "rotate3d" });
|
|
421
421
|
checkNumber({ num: y, param: "y", api: "rotate3d" });
|
|
422
422
|
checkNumber({ num: z, param: "z", api: "rotate3d" });
|
|
@@ -425,51 +425,51 @@ var rotate3d = function(x, y, z, angle, unit = "deg") {
|
|
|
425
425
|
}
|
|
426
426
|
checkNumber({ num: angle, param: "angle", api: "rotate3d" });
|
|
427
427
|
return `rotate3d(${x}, ${y}, ${z}, ${angle}${unit})`;
|
|
428
|
-
}
|
|
429
|
-
|
|
428
|
+
}
|
|
429
|
+
function rotateX(angle, unit = "deg") {
|
|
430
430
|
if (isUnitWithString(angle, angleUnits)) {
|
|
431
431
|
return `rotateX(${angle})`;
|
|
432
432
|
}
|
|
433
433
|
checkNumber({ num: angle, param: "angle", api: "rotateX" });
|
|
434
434
|
return `rotateX(${angle}${unit})`;
|
|
435
|
-
}
|
|
436
|
-
|
|
435
|
+
}
|
|
436
|
+
function rotateY(angle, unit = "deg") {
|
|
437
437
|
if (isUnitWithString(angle, angleUnits)) {
|
|
438
438
|
return `rotateY(${angle})`;
|
|
439
439
|
}
|
|
440
440
|
checkNumber({ num: angle, param: "angle", api: "rotateY" });
|
|
441
441
|
return `rotateY(${angle}${unit})`;
|
|
442
|
-
}
|
|
443
|
-
|
|
442
|
+
}
|
|
443
|
+
function rotateZ(angle, unit = "deg") {
|
|
444
444
|
if (isUnitWithString(angle, angleUnits)) {
|
|
445
445
|
return `rotateZ(${angle})`;
|
|
446
446
|
}
|
|
447
447
|
checkNumber({ num: angle, param: "angle", api: "rotateZ" });
|
|
448
448
|
return `rotateZ(${angle}${unit})`;
|
|
449
|
-
}
|
|
450
|
-
|
|
449
|
+
}
|
|
450
|
+
function scale(x, y = x) {
|
|
451
451
|
checkNumber({ num: x, param: "x", api: "scale" });
|
|
452
452
|
return `scale(${x}, ${y})`;
|
|
453
|
-
}
|
|
454
|
-
|
|
453
|
+
}
|
|
454
|
+
function scale3d(x, y, z) {
|
|
455
455
|
checkNumber({ num: x, param: "x", api: "scale3d" });
|
|
456
456
|
checkNumber({ num: y, param: "y", api: "scale3d" });
|
|
457
457
|
checkNumber({ num: z, param: "z", api: "scale3d" });
|
|
458
458
|
return `scale3d(${x}, ${y}, ${z})`;
|
|
459
|
-
}
|
|
460
|
-
|
|
459
|
+
}
|
|
460
|
+
function scaleX(x) {
|
|
461
461
|
checkNumber({ num: x, param: "x", api: "scaleX" });
|
|
462
462
|
return `scaleX(${x})`;
|
|
463
|
-
}
|
|
464
|
-
|
|
463
|
+
}
|
|
464
|
+
function scaleY(y) {
|
|
465
465
|
checkNumber({ num: y, param: "y", api: "scaleY" });
|
|
466
466
|
return `scaleY(${y})`;
|
|
467
|
-
}
|
|
468
|
-
|
|
467
|
+
}
|
|
468
|
+
function scaleZ(z) {
|
|
469
469
|
checkNumber({ num: z, param: "z", api: "scaleZ" });
|
|
470
470
|
return `scaleZ(${z})`;
|
|
471
|
-
}
|
|
472
|
-
|
|
471
|
+
}
|
|
472
|
+
function skew(...args) {
|
|
473
473
|
const [arg1, arg2, arg3, arg4] = args;
|
|
474
474
|
if (arguments.length === 1) {
|
|
475
475
|
if (isUnitWithString(arg1, angleUnits)) {
|
|
@@ -507,22 +507,22 @@ var skew = function(...args) {
|
|
|
507
507
|
"skew(angleX: number, angleY: number): string;",
|
|
508
508
|
"skew(angleX: number, unitX: AngleUnit, angleY: number, unitY: AngleUnit): string;"
|
|
509
509
|
].join("\n"));
|
|
510
|
-
}
|
|
511
|
-
|
|
510
|
+
}
|
|
511
|
+
function skewX(angle, unit = "deg") {
|
|
512
512
|
if (isUnitWithString(angle, angleUnits)) {
|
|
513
513
|
return `skewX(${angle})`;
|
|
514
514
|
}
|
|
515
515
|
checkNumber({ num: angle, param: "angle", api: "skewX" });
|
|
516
516
|
return `skewX(${angle}${unit})`;
|
|
517
|
-
}
|
|
518
|
-
|
|
517
|
+
}
|
|
518
|
+
function skewY(angle, unit = "deg") {
|
|
519
519
|
if (isUnitWithString(angle, angleUnits)) {
|
|
520
520
|
return `skewY(${angle})`;
|
|
521
521
|
}
|
|
522
522
|
checkNumber({ num: angle, param: "angle", api: "skewY" });
|
|
523
523
|
return `skewY(${angle}${unit})`;
|
|
524
|
-
}
|
|
525
|
-
|
|
524
|
+
}
|
|
525
|
+
function translate(...args) {
|
|
526
526
|
const [arg1, arg2, arg3, arg4] = args;
|
|
527
527
|
if (arguments.length === 1) {
|
|
528
528
|
if (isUnitWithString(arg1, lengthPercentageUnits)) {
|
|
@@ -560,8 +560,8 @@ var translate = function(...args) {
|
|
|
560
560
|
`translate(translation: number, unit: LengthPercentageUnit)`,
|
|
561
561
|
`translate(x: number, unitX: LengthPercentageUnit, y: number, unitY: LengthPercentageUnit): string;`
|
|
562
562
|
].join("\n"));
|
|
563
|
-
}
|
|
564
|
-
|
|
563
|
+
}
|
|
564
|
+
function translate3d(...args) {
|
|
565
565
|
if (arguments.length === 3) {
|
|
566
566
|
const [x, y, z] = args;
|
|
567
567
|
const vars = [x, y, z].map((arg, i) => {
|
|
@@ -594,28 +594,28 @@ var translate3d = function(...args) {
|
|
|
594
594
|
`translate3d(x: LengthPercentageUnitString, y: LengthPercentageUnitString, z: LengthPercentageUnitString)`,
|
|
595
595
|
`translate3d(x: number, unitX: LengthPercentageUnit, y: number, unitY: LengthPercentageUnit, z: number, unitZ: LengthUnit)`
|
|
596
596
|
].join("\n"));
|
|
597
|
-
}
|
|
598
|
-
|
|
597
|
+
}
|
|
598
|
+
function translateX(x, unit = "px") {
|
|
599
599
|
if (isUnitWithString(x, lengthPercentageUnits)) {
|
|
600
600
|
return `translateX(${x})`;
|
|
601
601
|
}
|
|
602
602
|
checkNumber({ num: x, param: "x", api: "translateX" });
|
|
603
603
|
return `translateX(${x}${unit})`;
|
|
604
|
-
}
|
|
605
|
-
|
|
604
|
+
}
|
|
605
|
+
function translateY(y, unit = "px") {
|
|
606
606
|
if (isUnitWithString(y, lengthPercentageUnits)) {
|
|
607
607
|
return `translateY(${y})`;
|
|
608
608
|
}
|
|
609
609
|
checkNumber({ num: y, param: "y", api: "translateY" });
|
|
610
610
|
return `translateY(${y}${unit})`;
|
|
611
|
-
}
|
|
612
|
-
|
|
611
|
+
}
|
|
612
|
+
function translateZ(z, unit = "px") {
|
|
613
613
|
if (isUnitWithString(z, lengthUnits)) {
|
|
614
614
|
return `translateZ(${z})`;
|
|
615
615
|
}
|
|
616
616
|
checkNumber({ num: z, param: "z", api: "translateZ" });
|
|
617
617
|
return `translateZ(${z}${unit})`;
|
|
618
|
-
}
|
|
618
|
+
}
|
|
619
619
|
var checkNumber = ({
|
|
620
620
|
num,
|
|
621
621
|
param,
|
package/package.json
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
"name": "Chetan Karwa",
|
|
8
8
|
"email": "cbkarwa@gmail.com"
|
|
9
9
|
},
|
|
10
|
-
"version": "4.0.
|
|
10
|
+
"version": "4.0.209",
|
|
11
11
|
"description": "Helpers for animating CSS properties",
|
|
12
12
|
"main": "./dist/index.js",
|
|
13
13
|
"module": "./dist/index.mjs",
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"remotion": "4.0.
|
|
16
|
+
"remotion": "4.0.209"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"remotion",
|
|
40
40
|
"animation-utils"
|
|
41
41
|
],
|
|
42
|
+
"homepage": "https://www.remotion.dev/docs/animation-utils/",
|
|
42
43
|
"scripts": {
|
|
43
44
|
"formatting": "prettier src --check",
|
|
44
45
|
"lint": "eslint src --ext ts,tsx",
|