Jump to content
Search Community

Horizontal ScrollTrigger animations

artvera test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

Hello,

 

I'm looking to replicate the following effect:

- When you arrive at the section, the scroll switches to horizontal mode (that's done).
- And most importantly, when each card passes the horizontal center of the section, it is given the class ".active".

Overall, I'd like to know how to add triggers in a horizontal mode.

 

Thank you in advance for your help, and I'm here to provide more details if needed.

 

image.thumb.png.25e2df8a5ab4ce60952d35607b544a6b.png

See the Pen GRzJrOa by artvera (@artvera) on CodePen

Link to comment
Share on other sites

  • Solution

Hi @artvera

 

Thanks for the great demo! All you had to do is set up a ScrollTrigger for each `.cardsSolutions` with a `containerAnimation`!

 

Check it out, the ScrollTrigger trigger is set to each card and the `containerAnimation` to your `animation`, the timeline could be better with the start and end markers and it will toggle a class at the moment, but you could of course also create an animation for it. Hope it helps and happy tweening! 

 

See the Pen poGJeEp?editors=1010 by mvaneijgen (@mvaneijgen) on CodePen

 

See the docs for more info about `containerAnimation` https://gsap.com/docs/v3/Plugins/ScrollTrigger and the demo below

 

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

 

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