@remotion/animation-utils 4.0.460 → 4.0.462

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,5 +1,9 @@
1
1
  // src/transformation-helpers/interpolate-styles/index.tsx
2
- import { interpolate, interpolateColors } from "remotion";
2
+ import {
3
+ assertValidInterpolateEasingOption,
4
+ interpolate,
5
+ interpolateColors
6
+ } from "remotion";
3
7
 
4
8
  // src/transformation-helpers/interpolate-styles/utils.ts
5
9
  import { NoReactInternals } from "remotion/no-react";
@@ -324,7 +328,9 @@ var interpolateStyles = (input, inputRange, outputStylesRange, options) => {
324
328
  const endingValue = inputRange[endIndex];
325
329
  const initialStyle = outputStylesRange[startIndex];
326
330
  const finalStyle = outputStylesRange[endIndex];
327
- const easing = options?.easing ?? ((num) => num);
331
+ assertValidInterpolateEasingOption(options?.easing, inputRange.length);
332
+ const easingOption = options?.easing;
333
+ const segmentEasing = easingOption === undefined ? (num) => num : typeof easingOption === "function" ? easingOption : easingOption[startIndex];
328
334
  const extrapolateLeft = options?.extrapolateLeft ?? "extend";
329
335
  const extrapolateRight = options?.extrapolateRight ?? "extend";
330
336
  return interpolateStylesFunction({
@@ -333,7 +339,7 @@ var interpolateStyles = (input, inputRange, outputStylesRange, options) => {
333
339
  initialStyle,
334
340
  finalStyle,
335
341
  options: {
336
- easing,
342
+ easing: segmentEasing,
337
343
  extrapolateLeft,
338
344
  extrapolateRight
339
345
  }
@@ -1,6 +1,6 @@
1
- import type { ExtrapolateType } from 'remotion';
1
+ import { type EasingFunction, type ExtrapolateType } from 'remotion';
2
2
  export declare const interpolateStyles: (input: number, inputRange: number[], outputStylesRange: import("react").CSSProperties[], options?: Partial<{
3
- easing: import("remotion").EasingFunction;
3
+ easing: EasingFunction | readonly EasingFunction[];
4
4
  extrapolateLeft: ExtrapolateType;
5
5
  extrapolateRight: ExtrapolateType;
6
6
  }> | undefined) => import("react").CSSProperties;
@@ -146,7 +146,7 @@ function checkStylesRange(arr) {
146
146
  * @see [Documentation](https://remotion.dev/docs/animation-utils/interpolate-styles)
147
147
  */
148
148
  const interpolateStyles = (input, inputRange, outputStylesRange, options) => {
149
- var _a, _b, _c;
149
+ var _a, _b;
150
150
  if (typeof input === 'undefined') {
151
151
  throw new Error('input can not be undefined');
152
152
  }
@@ -177,16 +177,22 @@ const interpolateStyles = (input, inputRange, outputStylesRange, options) => {
177
177
  const endingValue = inputRange[endIndex];
178
178
  const initialStyle = outputStylesRange[startIndex];
179
179
  const finalStyle = outputStylesRange[endIndex];
180
- const easing = (_a = options === null || options === void 0 ? void 0 : options.easing) !== null && _a !== void 0 ? _a : ((num) => num);
181
- const extrapolateLeft = (_b = options === null || options === void 0 ? void 0 : options.extrapolateLeft) !== null && _b !== void 0 ? _b : 'extend';
182
- const extrapolateRight = (_c = options === null || options === void 0 ? void 0 : options.extrapolateRight) !== null && _c !== void 0 ? _c : 'extend';
180
+ (0, remotion_1.assertValidInterpolateEasingOption)(options === null || options === void 0 ? void 0 : options.easing, inputRange.length);
181
+ const easingOption = options === null || options === void 0 ? void 0 : options.easing;
182
+ const segmentEasing = easingOption === undefined
183
+ ? (num) => num
184
+ : typeof easingOption === 'function'
185
+ ? easingOption
186
+ : easingOption[startIndex];
187
+ const extrapolateLeft = (_a = options === null || options === void 0 ? void 0 : options.extrapolateLeft) !== null && _a !== void 0 ? _a : 'extend';
188
+ const extrapolateRight = (_b = options === null || options === void 0 ? void 0 : options.extrapolateRight) !== null && _b !== void 0 ? _b : 'extend';
183
189
  return interpolateStylesFunction({
184
190
  inputValue: input,
185
191
  inputRange: [startingValue, endingValue],
186
192
  initialStyle,
187
193
  finalStyle,
188
194
  options: {
189
- easing,
195
+ easing: segmentEasing,
190
196
  extrapolateLeft,
191
197
  extrapolateRight,
192
198
  },
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.460",
10
+ "version": "4.0.462",
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.460"
23
+ "remotion": "4.0.462"
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.460",
34
+ "@remotion/eslint-config-internal": "4.0.462",
35
35
  "eslint": "9.19.0",
36
36
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
37
37
  },