Jump to content
Search Community

GSAP Horizontal ScrollTrigger behaving weirdly

Tony Geek test
Moderator Tag

Go to solution Solved by Tony Geek,

Recommended Posts

Hi there,

It's been a while since I've touched GSAP and it's ScrollTrigger, and have gotten a bit stuck trying to do a ScrollTrigger.

I've attached a CodePen that illustrates what's going wrong. Of course, I'm not expecting the transition to play out like that. What I'm trying to achieve is something more like this 

See the Pen KKBLqdN by PaulettePaillette (@PaulettePaillette) on CodePen

 - Where you horizontally scroll through each element, all inline. Instead, mine seems to zip off the screen with increasing speed. I recognize it's likely something to do with my maths somewhere, but I'm struggling to figure out where the issue is.

Any help would be much appreciated.

 

Thanks

See the Pen bGmMMMr by tonycre8-the-bold (@tonycre8-the-bold) on CodePen

Link to comment
Share on other sites

Hi Cassie,

Thanks a lot for the update. Not sure why I thought it wasn't possible by just copying the code 😂

Mind you, at the minute it ends on the last one. Is there any way for it to end on the last 4? I'm assuming that would be something to do with the end point, but not sure how I would adjust it. Or it could be the xPercentage, but again I'm not sure how I would do the maths on that as every time I've tried it hasn't quite filled in.

Thanks

Link to comment
Share on other sites

  • Solution

Alright I managed to figure it out. Don't know why I didn't clock it sooner.
Change: xPercent: -100 * (teamMembers.length - 1),
To: xPercent: -100 * (teamMembers.length - 4),
Thanks a lot for your help Cassie!

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