Jump to content
Search Community

Scroll Trigger Batch First time scroll and second time scroll problem

MaryamZafar test
Moderator Tag

Recommended Posts

Hello GSAP Gurus. 

 

Thank you for always helping me out.

 

I am playing around with the ScrollTrigger Batch code - On my pen, when I scroll down the first time (On Enter) the animation for the section after the image is different, then when I go back up, scroll back down again, it is different.

 

I want to behave like it does on the second time, which is fade in from the yaxis like it does the second time. 

I have played around with the gsap.to, and gsap.from methods, but don't understand what is different :-(

 

Many Regards,

MZ

See the Pen QWNEavE by meeyamzafar (@meeyamzafar) on CodePen

Link to comment
Share on other sites

Hey Maryam. This issue boils down to a misunderstanding of how tweens work. If you haven't already, I highly suggest going through the GSAP getting started article and video that covers the basics of tweening including the difference between .to, .from, and .fromTo:

 

In short, the first time you scroll down your tween animates the texts from their default value of y: 0 to a value of y: 0. So the animation doesn't move anything because the start and end values are the same. It works the way you want it to the second time because you set it to a different value in the onLeaveBack callback. 

 

There are a couple of ways you could fix it to work the way that you want to. I would suggest using .from tweens instead:

See the Pen poybqqr?editors=0010 by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

Thank you so much Zach - I had gone through the documentation, and was having a hard time understanding some of the things. I will go though it more in detail.

 

Can I just compliment on your friendly manner on the forum? I have gone through a number of posts over the last few days, and your replies are always so polite and helpful, with no judgments on anyone. Thank you always.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

28 minutes ago, MaryamZafar said:

Can I just compliment on your friendly manner on the forum? I have gone through a number of posts over the last few days, and your replies are always so polite and helpful, with no judgments on anyone. Thank you always.

Thanks for the complement! That's exactly how we want these forums to be :) 

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