@remotion/animation-utils 4.0.469 → 4.0.470

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.
@@ -1,6 +1,7 @@
1
1
  // src/transformation-helpers/interpolate-styles/index.tsx
2
2
  import {
3
3
  assertValidInterpolateEasingOption,
4
+ assertValidInterpolatePosterizeOption,
4
5
  interpolate,
5
6
  interpolateColors
6
7
  } from "remotion";
@@ -316,7 +317,9 @@ var interpolateStyles = (input, inputRange, outputStylesRange, options) => {
316
317
  }
317
318
  checkInputRange(inputRange);
318
319
  checkStylesRange(outputStylesRange);
319
- let startIndex = inputRange.findIndex((step) => input < step) - 1;
320
+ assertValidInterpolatePosterizeOption(options?.posterize);
321
+ const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
322
+ let startIndex = inputRange.findIndex((step) => posterizedInput < step) - 1;
320
323
  if (startIndex === -1) {
321
324
  startIndex = 0;
322
325
  }
@@ -334,7 +337,7 @@ var interpolateStyles = (input, inputRange, outputStylesRange, options) => {
334
337
  const extrapolateLeft = options?.extrapolateLeft ?? "extend";
335
338
  const extrapolateRight = options?.extrapolateRight ?? "extend";
336
339
  return interpolateStylesFunction({
337
- inputValue: input,
340
+ inputValue: posterizedInput,
338
341
  inputRange: [startingValue, endingValue],
339
342
  initialStyle,
340
343
  finalStyle,
@@ -3,4 +3,5 @@ export declare const interpolateStyles: (input: number, inputRange: number[], ou
3
3
  easing: EasingFunction | readonly EasingFunction[];
4
4
  extrapolateLeft: ExtrapolateType;
5
5
  extrapolateRight: ExtrapolateType;
6
+ posterize: number;
6
7
  }> | undefined) => import("react").CSSProperties;
@@ -165,7 +165,11 @@ const interpolateStyles = (input, inputRange, outputStylesRange, options) => {
165
165
  }
166
166
  checkInputRange(inputRange);
167
167
  checkStylesRange(outputStylesRange);
168
- let startIndex = inputRange.findIndex((step) => input < step) - 1;
168
+ (0, remotion_1.assertValidInterpolatePosterizeOption)(options === null || options === void 0 ? void 0 : options.posterize);
169
+ const posterizedInput = (options === null || options === void 0 ? void 0 : options.posterize) === undefined
170
+ ? input
171
+ : Math.floor(input / options.posterize) * options.posterize;
172
+ let startIndex = inputRange.findIndex((step) => posterizedInput < step) - 1;
169
173
  if (startIndex === -1) {
170
174
  startIndex = 0;
171
175
  }
@@ -187,7 +191,7 @@ const interpolateStyles = (input, inputRange, outputStylesRange, options) => {
187
191
  const extrapolateLeft = (_a = options === null || options === void 0 ? void 0 : options.extrapolateLeft) !== null && _a !== void 0 ? _a : 'extend';
188
192
  const extrapolateRight = (_b = options === null || options === void 0 ? void 0 : options.extrapolateRight) !== null && _b !== void 0 ? _b : 'extend';
189
193
  return interpolateStylesFunction({
190
- inputValue: input,
194
+ inputValue: posterizedInput,
191
195
  inputRange: [startingValue, endingValue],
192
196
  initialStyle,
193
197
  finalStyle,
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "name": "Chetan Karwa",
8
8
  "email": "cbkarwa@gmail.com"
9
9
  },
10
- "version": "4.0.469",
10
+ "version": "4.0.470",
11
11
  "description": "Helpers for animating CSS properties",
12
12
  "main": "./dist/index.js",
13
13
  "module": "./dist/index.mjs",
@@ -20,7 +20,7 @@
20
20
  "test": "bun test src"
21
21
  },
22
22
  "dependencies": {
23
- "remotion": "4.0.469"
23
+ "remotion": "4.0.470"
24
24
  },
25
25
  "files": [
26
26
  "dist",
@@ -31,7 +31,7 @@
31
31
  "react-dom": ">=16.8.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@remotion/eslint-config-internal": "4.0.469",
34
+ "@remotion/eslint-config-internal": "4.0.470",
35
35
  "eslint": "9.19.0",
36
36
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
37
37
  },