Jump to content
Search Community

Get translate3d values from ScrollTrigger

Archetype test
Moderator Tag

Recommended Posts

Hi everyone,

 

I'm trying to get the value of the translate3d used on the element a ScrollTrigger is active on using the onUpdate method. I know you can get the scroll progress value but I don't know how to get the translate3d value.
 

ScrollTrigger.create({
  trigger: '.trigger',
  pin: true,
  start: 'center center',
  end: '+=300',
  onUpdate({ progress, scroll }) {
    console.log(progress);
    console.log(scroll());
    // How do you get the translate3d (x, y) values?
  }
});

 

Link to comment
Share on other sites

2 hours ago, mikel said:

Hey @Archetype,

 

Do you mean 'getBoundingClientRect'?

 

 

 

 

Happy tweening ...

Mikel

 

 

Hi Mikel. Thanks for this, this would work. I've noticed that the onUpdate doesn't continue firing while scrub is set to 1 and the animation is catching up, it stops firing as soon as you stop scrolling. Do you know how I could continue firing onUpdate while the animation is catching up with scrub?

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...