🎥 Make videos programmatically with React
`@remotion/animation-utils`: Apply easing to colors in `interpolateStyles()`
Rup Sarmah0015da7dc1a1
diff --git a/packages/animation-utils/src/test/interpolate-styles.test.ts b/packages/animation-utils/src/test/interpolate-styles.test.tsindex daf932cb78..7ee1810019 100644--- a/packages/animation-utils/src/test/interpolate-styles.test.ts+++ b/packages/animation-utils/src/test/interpolate-styles.test.ts@@ -363,3 +363,25 @@ test("Should assign proper start value from interpolate's inputRange array if fi),).toEqual({opacity: -0.5});});++test('Should apply easing to colors', () => {+ expect(+ interpolateStyles(+ 0.5,+ [0, 1],+ [+ {+ color: 'rgb(0, 0, 0)',+ opacity: 0,+ },+ {+ color: 'rgb(200, 200, 200)',+ opacity: 200,+ },+ ],+ {+ easing: Easing.in(Easing.quad),+ },+ ),+ ).toEqual({color: 'rgba(50, 50, 50, 1)', opacity: 50});+});diff --git a/packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx b/packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsxindex dd78fb334b..da790f6e5a 100644--- a/packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx+++ b/packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx@@ -51,10 +51,12 @@ const interpolatedPropertyPart = ({);}- const interpolatedColor = interpolateColors(inputValue, inputRange, [- initialStylePropertyPart.color,- finalStylePropertyPart.color as string,- ]);+ const interpolatedColor = interpolateColors(+ inputValue,+ inputRange,+ [initialStylePropertyPart.color, finalStylePropertyPart.color as string],+ {easing: options.easing},+ );return `${interpolatedColor}`;}