@remotion/vercel 4.0.481 → 4.0.483

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 (2) hide show
  1. package/dist/esm/index.mjs +140 -22
  2. package/package.json +4 -4
@@ -410,6 +410,35 @@ function findRange(input, inputRange) {
410
410
  return i - 1;
411
411
  }
412
412
  var defaultEasing = (num) => num;
413
+ var shouldExtendRightForEasing = (easing) => {
414
+ return easing.remotionShouldExtendRight === true;
415
+ };
416
+ var resolveEasingForSegment = ({
417
+ easing,
418
+ segmentIndex
419
+ }) => {
420
+ if (easing === undefined) {
421
+ return defaultEasing;
422
+ }
423
+ if (typeof easing === "function") {
424
+ return easing;
425
+ }
426
+ return easing[segmentIndex];
427
+ };
428
+ var interpolateSegment = ({
429
+ input,
430
+ inputRange,
431
+ outputRange,
432
+ easing,
433
+ extrapolateLeft,
434
+ extrapolateRight
435
+ }) => {
436
+ return interpolateFunction(input, inputRange, outputRange, {
437
+ easing,
438
+ extrapolateLeft,
439
+ extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing(easing) ? "extend" : extrapolateRight
440
+ });
441
+ };
413
442
  var interpolateNumber = ({
414
443
  input,
415
444
  inputRange,
@@ -420,15 +449,6 @@ var interpolateNumber = ({
420
449
  return outputRange[0];
421
450
  }
422
451
  const easingOption = options?.easing;
423
- const resolveEasingForSegment = (segmentIndex) => {
424
- if (easingOption === undefined) {
425
- return defaultEasing;
426
- }
427
- if (typeof easingOption === "function") {
428
- return easingOption;
429
- }
430
- return easingOption[segmentIndex];
431
- };
432
452
  let extrapolateLeft = "extend";
433
453
  if (options?.extrapolateLeft !== undefined) {
434
454
  extrapolateLeft = options.extrapolateLeft;
@@ -439,11 +459,41 @@ var interpolateNumber = ({
439
459
  }
440
460
  const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
441
461
  const range = findRange(posterizedInput, inputRange);
442
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
443
- easing: resolveEasingForSegment(range),
462
+ const easing = resolveEasingForSegment({
463
+ easing: easingOption,
464
+ segmentIndex: range
465
+ });
466
+ let result = interpolateSegment({
467
+ input: posterizedInput,
468
+ inputRange: [inputRange[range], inputRange[range + 1]],
469
+ outputRange: [outputRange[range], outputRange[range + 1]],
470
+ easing,
444
471
  extrapolateLeft,
445
472
  extrapolateRight
446
473
  });
474
+ for (let segmentIndex = 0;segmentIndex < range; segmentIndex++) {
475
+ const previousEasing = resolveEasingForSegment({
476
+ easing: easingOption,
477
+ segmentIndex
478
+ });
479
+ if (!shouldExtendRightForEasing(previousEasing)) {
480
+ continue;
481
+ }
482
+ const previousSegmentEnd = inputRange[segmentIndex + 1];
483
+ if (posterizedInput <= previousSegmentEnd) {
484
+ continue;
485
+ }
486
+ const continuedSegmentValue = interpolateSegment({
487
+ input: posterizedInput,
488
+ inputRange: [inputRange[segmentIndex], previousSegmentEnd],
489
+ outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
490
+ easing: previousEasing,
491
+ extrapolateLeft,
492
+ extrapolateRight: "extend"
493
+ });
494
+ result += continuedSegmentValue - outputRange[segmentIndex + 1];
495
+ }
496
+ return result;
447
497
  };
448
498
  var interpolateString = ({
449
499
  input,
@@ -796,6 +846,13 @@ var fromField = {
796
846
  step: 1,
797
847
  hiddenFromList: true
798
848
  };
849
+ var trimBeforeField = {
850
+ type: "number",
851
+ default: 0,
852
+ min: 0,
853
+ step: 1,
854
+ hiddenFromList: true
855
+ };
799
856
  var freezeField = {
800
857
  type: "number",
801
858
  default: null,
@@ -805,6 +862,7 @@ var freezeField = {
805
862
  var baseSchema = {
806
863
  durationInFrames: durationInFramesField,
807
864
  from: fromField,
865
+ trimBefore: trimBeforeField,
808
866
  freeze: freezeField,
809
867
  hidden: hiddenField,
810
868
  name: sequenceNameField,
@@ -824,6 +882,7 @@ var sequenceSchema = {
824
882
  };
825
883
  var baseSchemaWithoutFrom = {
826
884
  durationInFrames: durationInFramesField,
885
+ trimBefore: trimBeforeField,
827
886
  freeze: freezeField,
828
887
  hidden: hiddenField,
829
888
  name: sequenceNameField,
@@ -1912,6 +1971,35 @@ function findRange(input, inputRange) {
1912
1971
  return i - 1;
1913
1972
  }
1914
1973
  var defaultEasing = (num) => num;
1974
+ var shouldExtendRightForEasing = (easing) => {
1975
+ return easing.remotionShouldExtendRight === true;
1976
+ };
1977
+ var resolveEasingForSegment = ({
1978
+ easing,
1979
+ segmentIndex
1980
+ }) => {
1981
+ if (easing === undefined) {
1982
+ return defaultEasing;
1983
+ }
1984
+ if (typeof easing === "function") {
1985
+ return easing;
1986
+ }
1987
+ return easing[segmentIndex];
1988
+ };
1989
+ var interpolateSegment = ({
1990
+ input,
1991
+ inputRange,
1992
+ outputRange,
1993
+ easing,
1994
+ extrapolateLeft,
1995
+ extrapolateRight
1996
+ }) => {
1997
+ return interpolateFunction(input, inputRange, outputRange, {
1998
+ easing,
1999
+ extrapolateLeft,
2000
+ extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing(easing) ? "extend" : extrapolateRight
2001
+ });
2002
+ };
1915
2003
  var interpolateNumber = ({
1916
2004
  input,
1917
2005
  inputRange,
@@ -1922,15 +2010,6 @@ var interpolateNumber = ({
1922
2010
  return outputRange[0];
1923
2011
  }
1924
2012
  const easingOption = options?.easing;
1925
- const resolveEasingForSegment = (segmentIndex) => {
1926
- if (easingOption === undefined) {
1927
- return defaultEasing;
1928
- }
1929
- if (typeof easingOption === "function") {
1930
- return easingOption;
1931
- }
1932
- return easingOption[segmentIndex];
1933
- };
1934
2013
  let extrapolateLeft = "extend";
1935
2014
  if (options?.extrapolateLeft !== undefined) {
1936
2015
  extrapolateLeft = options.extrapolateLeft;
@@ -1941,11 +2020,41 @@ var interpolateNumber = ({
1941
2020
  }
1942
2021
  const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1943
2022
  const range = findRange(posterizedInput, inputRange);
1944
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
1945
- easing: resolveEasingForSegment(range),
2023
+ const easing = resolveEasingForSegment({
2024
+ easing: easingOption,
2025
+ segmentIndex: range
2026
+ });
2027
+ let result = interpolateSegment({
2028
+ input: posterizedInput,
2029
+ inputRange: [inputRange[range], inputRange[range + 1]],
2030
+ outputRange: [outputRange[range], outputRange[range + 1]],
2031
+ easing,
1946
2032
  extrapolateLeft,
1947
2033
  extrapolateRight
1948
2034
  });
2035
+ for (let segmentIndex = 0;segmentIndex < range; segmentIndex++) {
2036
+ const previousEasing = resolveEasingForSegment({
2037
+ easing: easingOption,
2038
+ segmentIndex
2039
+ });
2040
+ if (!shouldExtendRightForEasing(previousEasing)) {
2041
+ continue;
2042
+ }
2043
+ const previousSegmentEnd = inputRange[segmentIndex + 1];
2044
+ if (posterizedInput <= previousSegmentEnd) {
2045
+ continue;
2046
+ }
2047
+ const continuedSegmentValue = interpolateSegment({
2048
+ input: posterizedInput,
2049
+ inputRange: [inputRange[segmentIndex], previousSegmentEnd],
2050
+ outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
2051
+ easing: previousEasing,
2052
+ extrapolateLeft,
2053
+ extrapolateRight: "extend"
2054
+ });
2055
+ result += continuedSegmentValue - outputRange[segmentIndex + 1];
2056
+ }
2057
+ return result;
1949
2058
  };
1950
2059
  var interpolateString = ({
1951
2060
  input,
@@ -2298,6 +2407,13 @@ var fromField = {
2298
2407
  step: 1,
2299
2408
  hiddenFromList: true
2300
2409
  };
2410
+ var trimBeforeField = {
2411
+ type: "number",
2412
+ default: 0,
2413
+ min: 0,
2414
+ step: 1,
2415
+ hiddenFromList: true
2416
+ };
2301
2417
  var freezeField = {
2302
2418
  type: "number",
2303
2419
  default: null,
@@ -2307,6 +2423,7 @@ var freezeField = {
2307
2423
  var baseSchema = {
2308
2424
  durationInFrames: durationInFramesField,
2309
2425
  from: fromField,
2426
+ trimBefore: trimBeforeField,
2310
2427
  freeze: freezeField,
2311
2428
  hidden: hiddenField,
2312
2429
  name: sequenceNameField,
@@ -2326,6 +2443,7 @@ var sequenceSchema = {
2326
2443
  };
2327
2444
  var baseSchemaWithoutFrom = {
2328
2445
  durationInFrames: durationInFramesField,
2446
+ trimBefore: trimBeforeField,
2329
2447
  freeze: freezeField,
2330
2448
  hidden: hiddenField,
2331
2449
  name: sequenceNameField,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/vercel",
3
- "version": "4.0.481",
3
+ "version": "4.0.483",
4
4
  "description": "Render Remotion videos on Vercel Sandbox",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,8 +23,8 @@
23
23
  "url": "https://github.com/remotion-dev/remotion/issues"
24
24
  },
25
25
  "dependencies": {
26
- "@remotion/renderer": "4.0.481",
27
- "remotion": "4.0.481"
26
+ "@remotion/renderer": "4.0.483",
27
+ "remotion": "4.0.483"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@vercel/sandbox": ">=1.0.0"
@@ -38,7 +38,7 @@
38
38
  "./package.json": "./package.json"
39
39
  },
40
40
  "devDependencies": {
41
- "@remotion/eslint-config-internal": "4.0.481",
41
+ "@remotion/eslint-config-internal": "4.0.483",
42
42
  "@vercel/blob": "2.3.0",
43
43
  "@vercel/sandbox": "1.6.0",
44
44
  "eslint": "9.19.0",