rnrh Posted June 8, 2021 Share Posted June 8, 2021 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 More sharing options...
Solution GreenSock Posted June 9, 2021 Solution Share Posted June 9, 2021 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? 1 Link to comment Share on other sites More sharing options...
rnrh Posted June 9, 2021 Author Share Posted June 9, 2021 @GreenSock thanks for your help here and suggestions on cleaning things up! Its nice to have some confirmation I was at least correct in concept. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now