remotion 4.0.538 → 4.0.539

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.
@@ -477,7 +477,7 @@ function spring({
477
477
  frame: durationProcessed,
478
478
  config
479
479
  });
480
- const inner = config.overshootClamping ? to >= from ? Math.min(spr.current, to) : Math.max(spr.current, to) : spr.current;
480
+ const inner = config.overshootClamping ? Math.min(spr.current, 1) : spr.current;
481
481
  const interpolated = from === 0 && to === 1 ? inner : interpolate(inner, [0, 1], [from, to]);
482
482
  return interpolated;
483
483
  }
@@ -1019,6 +1019,20 @@ var interpolateSegment = ({
1019
1019
  output
1020
1020
  });
1021
1021
  };
1022
+ var getInputForInterpolation = ({
1023
+ input,
1024
+ inputRange,
1025
+ options
1026
+ }) => {
1027
+ const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1028
+ const inputMin = inputRange[0];
1029
+ const inputMax = inputRange[inputRange.length - 1];
1030
+ if (inputRange.length === 1 || !(posterizedInput < inputMin && options?.extrapolateLeft === "wrap" || posterizedInput > inputMax && options?.extrapolateRight === "wrap")) {
1031
+ return posterizedInput;
1032
+ }
1033
+ const range = inputMax - inputMin;
1034
+ return ((posterizedInput - inputMin) % range + range) % range + inputMin;
1035
+ };
1022
1036
  var interpolateNumber = ({
1023
1037
  input,
1024
1038
  inputRange,
@@ -1038,14 +1052,18 @@ var interpolateNumber = ({
1038
1052
  if (options?.extrapolateRight !== undefined) {
1039
1053
  extrapolateRight = options.extrapolateRight;
1040
1054
  }
1041
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1042
- const range = findRange(posterizedInput, inputRange);
1055
+ const resolvedInput = getInputForInterpolation({
1056
+ input,
1057
+ inputRange,
1058
+ options: options ?? null
1059
+ });
1060
+ const range = findRange(resolvedInput, inputRange);
1043
1061
  const easing = resolveEasingForSegment({
1044
1062
  easing: easingOption,
1045
1063
  segmentIndex: range
1046
1064
  });
1047
1065
  let result = interpolateSegment({
1048
- input: posterizedInput,
1066
+ input: resolvedInput,
1049
1067
  inputRange: [inputRange[range], inputRange[range + 1]],
1050
1068
  outputRange: [outputRange[range], outputRange[range + 1]],
1051
1069
  easing,
@@ -1062,11 +1080,11 @@ var interpolateNumber = ({
1062
1080
  continue;
1063
1081
  }
1064
1082
  const previousSegmentEnd = inputRange[segmentIndex + 1];
1065
- if (posterizedInput <= previousSegmentEnd) {
1083
+ if (resolvedInput <= previousSegmentEnd) {
1066
1084
  continue;
1067
1085
  }
1068
1086
  const continuedSegmentValue = interpolateSegment({
1069
- input: posterizedInput,
1087
+ input: resolvedInput,
1070
1088
  inputRange: [inputRange[segmentIndex], previousSegmentEnd],
1071
1089
  outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
1072
1090
  easing: previousEasing,
@@ -1087,8 +1105,12 @@ var interpolateString = ({
1087
1105
  }) => {
1088
1106
  const initiallyParsedOutputRange = outputRange.map((output) => parseStringInterpolationValue(output, outputType));
1089
1107
  const hasAxisRotation = initiallyParsedOutputRange.some((parsed) => parsed.axisRotation);
1090
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1091
- const segmentIndex = inputRange.length === 1 ? 0 : findRange(posterizedInput, inputRange);
1108
+ const resolvedInput = getInputForInterpolation({
1109
+ input,
1110
+ inputRange,
1111
+ options: options ?? null
1112
+ });
1113
+ const segmentIndex = inputRange.length === 1 ? 0 : findRange(resolvedInput, inputRange);
1092
1114
  const parsedOutputRange = hasAxisRotation ? initiallyParsedOutputRange.map((parsed, index) => {
1093
1115
  if (parsed.kind !== "rotate") {
1094
1116
  return parsed;
@@ -1212,31 +1234,24 @@ var interpolateDiscreteValue = ({
1212
1234
  throw new TypeError(typeof outputRange[0] === "boolean" ? "Booleans can only be interpolated using Easing.step1" : "Non-numeric strings can only be interpolated using Easing.step1");
1213
1235
  }
1214
1236
  }
1215
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
1237
+ const resolvedInput = getInputForInterpolation({
1238
+ input,
1239
+ inputRange,
1240
+ options: options ?? null
1241
+ });
1216
1242
  const inputMin = inputRange[0];
1217
1243
  const inputMax = inputRange[inputRange.length - 1];
1218
- let resolvedInput = posterizedInput;
1219
1244
  if (resolvedInput < inputMin) {
1220
1245
  if (options?.extrapolateLeft === "identity") {
1221
1246
  throw new TypeError(typeof outputRange[0] === "boolean" ? 'extrapolateLeft: "identity" is not supported for booleans' : 'extrapolateLeft: "identity" is not supported for non-numeric strings');
1222
1247
  }
1223
- if (options?.extrapolateLeft === "wrap") {
1224
- const wrapRange = inputMax - inputMin;
1225
- resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
1226
- } else {
1227
- return outputRange[0];
1228
- }
1248
+ return outputRange[0];
1229
1249
  }
1230
1250
  if (resolvedInput > inputMax) {
1231
1251
  if (options?.extrapolateRight === "identity") {
1232
1252
  throw new TypeError(typeof outputRange[0] === "boolean" ? 'extrapolateRight: "identity" is not supported for booleans' : 'extrapolateRight: "identity" is not supported for non-numeric strings');
1233
1253
  }
1234
- if (options?.extrapolateRight === "wrap") {
1235
- const wrapRange = inputMax - inputMin;
1236
- resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
1237
- } else {
1238
- return outputRange[outputRange.length - 1];
1239
- }
1254
+ return outputRange[outputRange.length - 1];
1240
1255
  }
1241
1256
  const range = findRange(resolvedInput, inputRange);
1242
1257
  return resolvedInput >= inputRange[range + 1] ? outputRange[range + 1] : outputRange[range];
@@ -2054,14 +2069,16 @@ function parseModernComponent(str, percentScale) {
2054
2069
  function parseHueAngle(str) {
2055
2070
  if (str === "none")
2056
2071
  return 0;
2057
- if (str.endsWith("rad")) {
2058
- return Number.parseFloat(str) * 180 / Math.PI;
2059
- }
2060
- if (str.endsWith("grad"))
2061
- return Number.parseFloat(str) * 0.9;
2062
- if (str.endsWith("turn"))
2063
- return Number.parseFloat(str) * 360;
2064
- return Number.parseFloat(str);
2072
+ let degrees = Number.parseFloat(str);
2073
+ if (str.endsWith("grad")) {
2074
+ degrees *= 0.9;
2075
+ } else if (str.endsWith("rad")) {
2076
+ degrees = degrees * 180 / Math.PI;
2077
+ } else if (str.endsWith("turn")) {
2078
+ degrees *= 360;
2079
+ }
2080
+ const normalized = degrees % 360;
2081
+ return normalized < 0 ? (normalized + 360) % 360 : normalized;
2065
2082
  }
2066
2083
  function parseModernAlpha(str) {
2067
2084
  if (str === undefined || str === "none")
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.538";
2
+ var VERSION = "4.0.539";
3
3
  export {
4
4
  VERSION
5
5
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
4
4
  },
5
5
  "name": "remotion",
6
- "version": "4.0.538",
6
+ "version": "4.0.539",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "react-dom": "19.2.3",
36
36
  "webpack": "5.105.0",
37
37
  "zod": "4.5.4",
38
- "@remotion/eslint-config-internal": "4.0.538",
38
+ "@remotion/eslint-config-internal": "4.0.539",
39
39
  "eslint": "9.19.0",
40
40
  "typescript": "7.1.0-beta"
41
41
  },