Jump to content
Search Community

Combine multiple fromTo() with ScrollTrigger

rnrh test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

I have a fromTo() that I want to execute on load, and then another fromTo() that I want to execute using ScrollTrigger. My pen has the intended functionality, but looking at my code, it seems like there must be a more elegant way to combine these into a timeline. I looked at batch, and I'm not sure that's the right approach for this effect, but I am pretty to new to gsap in general.

 

Any guidance would be greatly appreciated.

See the Pen ZEejejq by rnrh (@rnrh) on CodePen

Link to comment
Share on other sites

  • Solution

Howdy, @rnrh. It wouldn't really make much sense to put them both into a timeline because you're controlling them in completely different ways - one runs independently and immediately when the page loads, and the other gets triggered by scroll position. And A timeline wouldn't make your code more concise. I cleaned it up a bit here, though: 

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

 

Does that help? 

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