Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
_josch

Changing y-value in ScrollTrigger not possible, x-value is possible..

Go to solution Solved by OSUblake,

Recommended Posts

Hello!

Does someone know why it's not possible entering a y-value other than 0 in this code (picture 1)? It's a rather simple animation, the title should move up on the y-axis as the user scrolls. However, when entering a value for y, this error comes up (picture 2), x-values work however...

 

What's weird is that a rather similar animation just below that works perfectly fine with y-values (picture 3). Does anyone know how to fix the issue of not being able to work with y-values in the first animation?

yissue.PNG

yissue2.PNG

yissue3.PNG

Link to comment
Share on other sites

  • Solution

You should not animate a pin.

 

Quote

Warning don't animate the pinned element itself because that will throw off the measurements (ScrollTrigger is highly optimized for performance and pre-calculates as much as possible). Instead, you could nest things such that you're animating only elements INSIDE the pinned element.

 

  • Like 1
Link to comment
Share on other sites

Thanks for the answer @OSUblake!

Instead of animating the pin I split up the animation in 2 different timelines, and because I'm new to JavaScript and GSAP I'm wondering if that's an optimal way to do it? It definitely results in the diresired animation. This is the screen capture because of the file size limit I can't upload it here as a png: https://gyazo.com/f21f698b7ba3b7fab84a07e922b36467

 

Thank you for your help!

Link to comment
Share on other sites

Yep, there's nothing wrong with creating additional timelines with the same trigger. 😉

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