🎥 Make videos programmatically with React
`@remotion/animation-utils`: Fix animating to 0 (falsy value)
Jonny Burgerdeba52f849ad
diff --git a/packages/animation-utils/src/test/interpolate-styles.test.ts b/packages/animation-utils/src/test/interpolate-styles.test.tsindex 5d6fe0d92e..cf8503cf23 100644--- a/packages/animation-utils/src/test/interpolate-styles.test.ts+++ b/packages/animation-utils/src/test/interpolate-styles.test.ts@@ -286,3 +286,22 @@ test('Should interpolate between negative values with units', () => {left: '-15px',});});++test('Should not ignore 0 values', () => {+ expect(+ interpolateStyles(+ 0.999,+ [0, 1],+ [+ {+ left: 1000,+ },+ {+ left: 0,+ },+ ],+ ),+ ).toEqual({+ left: 1,+ });+});diff --git a/packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx b/packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsxindex 883780a4e6..1b93ac42d3 100644--- a/packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx+++ b/packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx@@ -186,7 +186,8 @@ const interpolateStylesFunction = ({}): Style => {const [startingValue, endingValue] = inputRange;return Object.keys(initialStyle).reduce((acc, key) => {- if (!finalStyle[key as CSSPropertiesKey]) {+ const value = finalStyle[key as CSSPropertiesKey];+ if (value === undefined || value === null) {return {...acc,[key]: initialStyle[key as CSSPropertiesKey],