remotion-dev / remotion

πŸŽ₯ Make videos programmatically with React
https://remotion.dev
Other
19.59k stars 955 forks source link

`interpolateStyles` throws `Cannot convert undefined or null to object` #3922

Closed thecmdrunner closed 1 month ago

thecmdrunner commented 1 month ago

Bug Report πŸ›

interpolateStyles throws a weird error when I use the following block to style one of the images in my composition:

    const lastImageExitStyle = interpolateStyles(
        frame,
        [eachImgDur * 2, eachImgDur * 3],
        [{opacity: 1}, {opacity: 0}]
    );

What I wanted to achieve:

  1. Fade in effect for when the first image shows up
  2. Fade out for the last image when the video ends

Expected output

A more helpful error about what's wrong :)

Current output

Cannot convert undefined or null to object

Here's my composition: Repro: https://stackblitz.com/edit/github-bpjydj?file=src%2FRoot.tsx,src%2FComposition.tsx

export const MyComposition = () => {
    const frame = useCurrentFrame();
    const {durationInFrames, fps} = useVideoConfig();

    const firstImageEnterStyle = interpolateStyles(
        frame,
        [0, fps / 2],
        [{opacity: 0}, {opacity: 1}]
    );

    const lastImageExitStyle = interpolateStyles(
        frame,
        [eachImgDur * 2, eachImgDur * 3],
        [{opacity: 1}, {opacity: 0}]
    );

    return ( <> a bunch of images here </> );
};
JonnyBurger commented 1 month ago

Thanks! This seems to throw:

interpolateStyles(
        frame,
        [eachImgDur * 2, eachImgDur * 3],
        [{opacity: 1}, {opacity: 0}]
    )

Who can reproduce this, write a test in https://github.com/remotion-dev/remotion/blob/c164b4cfcdc83e66ac8d2dd3c0d573aa926d6a65/packages/animation-utils/src/test/interpolate-styles.test.ts and make a fix?

Bounty

πŸ’Ž This issue has a bounty on it!

Read our contributing guidelines:

/bounty 80

algora-pbc[bot] commented 1 month ago

πŸ’Ž $80 bounty β€’ Remotion

Steps to solve:

  1. Get assigned: If you'd like to work on this issue, comment /attempt below to get assigned
  2. Submit work: Create a pull request including /claim #3922 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to remotion-dev/remotion!

Add a bounty β€’ Share on socials

abhishek818 commented 1 month ago

/attempt #3922

Algora profile Completed bounties Tech Active attempts Options
@abhishek818    1 remotion bounty
+ 2 bounties from 2 projects
JavaScript, TypeScript
Cancel attempt
algora-pbc[bot] commented 1 month ago

@abhishek818: The Remotion team prefers to assign a single contributor to the issue rather than let anyone attempt it right away. We recommend waiting for a confirmation from a member before getting started.

JonnyBurger commented 1 month ago

@abhishek818 Thanks for attempting and good luck!

eshugoel24 commented 1 month ago

@JonnyBurger Little help needed. I was trying to run the project on my local system by following all instructions mentioned over here https://www.remotion.dev/docs/contributing.

But I am always getting the error while doing the build "pnpm build" Project 'packages/core/tsconfig.json' is up to date because newest input 'packages/core/src/volume-position-state.ts' is older than output 'packages/core/dist/tsconfig.tsbuildinfo'

any specific node version to run this. I tried on node 18 and 20 both.

JonnyBurger commented 1 month ago

@eshugoel24 You are not assigned, so please don't submit for this bounty!

But I can help you resolve the setup issue - what you posted is not an error though, this should appear! Maybe post the full output in a separate issue?

springshine0925 commented 1 month ago

πŸ‘‹ Hi, I'm a full stack developer with 7+ years of experience in web development.

abhishek818 commented 1 month ago

hey, @JonnyBurger i have found out the issue and will push the fix in a while now..

algora-pbc[bot] commented 1 month ago

πŸ’‘ @abhishek818 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] commented 1 month ago

πŸŽ‰πŸŽˆ @abhishek818 has been awarded $80! 🎈🎊