@remotion/vercel 4.0.482 → 4.0.484

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 +122 -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,
@@ -1921,6 +1971,35 @@ function findRange(input, inputRange) {
1921
1971
  return i - 1;
1922
1972
  }
1923
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
+ };
1924
2003
  var interpolateNumber = ({
1925
2004
  input,
1926
2005
  inputRange,
@@ -1931,15 +2010,6 @@ var interpolateNumber = ({
1931
2010
  return outputRange[0];
1932
2011
  }
1933
2012
  const easingOption = options?.easing;
1934
- const resolveEasingForSegment = (segmentIndex) => {
1935
- if (easingOption === undefined) {
1936
- return defaultEasing;
1937
- }
1938
- if (typeof easingOption === "function") {
1939
- return easingOption;
1940
- }
1941
- return easingOption[segmentIndex];
1942
- };
1943
2013
  let extrapolateLeft = "extend";
1944
2014
  if (options?.extrapolateLeft !== undefined) {
1945
2015
  extrapolateLeft = options.extrapolateLeft;
@@ -1950,11 +2020,41 @@ var interpolateNumber = ({
1950
2020
  }
1951
2021
  const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1952
2022
  const range = findRange(posterizedInput, inputRange);
1953
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
1954
- 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,
1955
2032
  extrapolateLeft,
1956
2033
  extrapolateRight
1957
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;
1958
2058
  };
1959
2059
  var interpolateString = ({
1960
2060
  input,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/vercel",
3
- "version": "4.0.482",
3
+ "version": "4.0.484",
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.482",
27
- "remotion": "4.0.482"
26
+ "@remotion/renderer": "4.0.484",
27
+ "remotion": "4.0.484"
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.482",
41
+ "@remotion/eslint-config-internal": "4.0.484",
42
42
  "@vercel/blob": "2.3.0",
43
43
  "@vercel/sandbox": "1.6.0",
44
44
  "eslint": "9.19.0",