Jump to content
Search Community

ScrollTrigger get Scrub value

Gxneral test
Moderator Tag

Go to solution Solved by Gxneral,

Recommended Posts

I am building a website using React and I need to trigger an animation in a component that will affect the state of another component. I want to set scrub: true,

start: "top bottom",

end: "bottom top",

The problem is I want to get the value of how far into the animation am I in.

I want to log a value from 0% at the start to 100% at the end and transfer this value to another component. How do I get this value?

Link to comment
Share on other sites

  • Solution

Oh I figured it out. Idk how did I miss the .progress in the docs 

this is what I was looking for

ScrollTrigger.create({
  trigger: ".trigger",
  start: "top bottom",
  end: "bottom top",
  onUpdate: self => console.log("progress:", self.progress)
});

 

  • Like 2
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...