Jump to content
Search Community

Video animation with ScrollTrigger, GSAP and react

Andy1708 test
Moderator Tag

Recommended Posts

Hey Andy. Please do not create multiple threads for the same question. We will make sure that every post gets answered when we're able to answer them - reposting threads doesn't help :) 

 

The pen that you link to throws an error:

Quote

Uncaught TypeError: Failed to set the 'currentTime' property on 'HTMLMediaElement': The provided double value is non-finite.
    at pen.js:30

It'd be helpful if you changed the demo to make it reproduce the situation that you have.

 

Regardless, using a setTimeout and requestAnimationFrame is very likely a bad way to go about doing what you're trying to do. Why not set the video's current time inside of the ScrollTrigger's onUpdate? It'd perform better and likely be less buggy.

Link to comment
Share on other sites

  • 2 years later...

Hey there, welcome to the forums!

 

Tweens also have an onUpdate function, so you could create a timeline and pop the onUpdate logic into a tween on that timeline instead of on the timeline itself.

 

There are lots of forum posts dotted about with this same technique, so I suggest having a look around too
 



Hope this helps!

Link to comment
Share on other sites

  • 1 month later...

If you're trying to scrub video, the main issue is going to be the way you encode your video. Specifically how often you embed keyframes. You have to understand how video works (how it is encoded and decoded so you can make sure the playhead can move around FAST). It's not a GSAP issue. 

 

If you still need help, please make sure you provide a minimal demo and ask a GSAP-specific question and we'd be happy to jump in and help with those. 

 

Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen

 

If you're using something like React/Next/Nuxt/Gatsby or some other framework, you may find CodeSandbox easier to use. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...