Jump to content
Search Community

Horizontal scroll and toggleActions

Omnia test
Moderator Tag

Recommended Posts

Hi,

I'm new to gsap so I'm not sure what's causing the animation to play only once in this demo despite of (toggleActions: "restart pause resume reset")

The horizontal scroll trick here is having 2 containers and rottating the inner container so it scroll horizontally. *I hopw you see what I mean in the codepen

any suggestions? 

See the Pen gOrMBLL?editors=0110 by Omnia- (@Omnia-) on CodePen

Edited by Omnia
mistake in codepen
Link to comment
Share on other sites

Hey Omnia and welcome to the GreenSock forums. I think you're a little confused about how ScrollTrigger works.

 

Your first ScrollTrigger (created by the ScrollTrigger.create() method) is doing absolutely nothing in your pen other than creating some markers that don't actually affect anything. Then you're creating a new tween with another ScrollTrigger that is based on the vertical scroll position.

 

What I think you're trying to do is combine the two into one ScrollTrigger so that the animation plays when the container is scrolled horizontally, correct? However, your transforms make doing this a lot more complicated - why are you setting things up this way? 

 

Here's how I'd set it up:

See the Pen xxVOMZB?editors=0100 by GreenSock (@GreenSock) on CodePen

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