Jump to content
Search Community

YOYO animation to start when ScrollTrigger timeline is paused

cesare.polonara test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hi all, I couldn't find a solution to this behaviour yet, basically I'd like to have a base loop animation on an element, which animates scale, and that has to start only when user is not scrolling ( there's a ScrollTrigger timeline on the same element  which animates scale as well ), basically the base element animation has to scale dynamically based on the actual scale value when scroll stops.

I'm not sure what's the best approach to achieve this, I'd like to avoid having to read the element style imperatively and track it through all the scrolltrigger timeline, I was wondering if there's a way to access the current elem properties state in gsap.to(), I assumed "+=" was doing that, but it's not working as intended, any tips ?

Thanks.

See the Pen OJOodyX by kais3rp (@kais3rp) on CodePen

Link to comment
Share on other sites

  • Solution

There are many ways to do this, but I think the simplest would be to just create a wrapper element that scales on scroll (the ScrollTriggered one) and then have a yoyo'd tween on the inner element that you pause() while scrolling and resume() onScrubComplete: 

 

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

 

Does that help? 

  • Like 3
Link to comment
Share on other sites

7 hours ago, GreenSock said:

There are many ways to do this, but I think the simplest would be to just create a wrapper element that scales on scroll (the ScrollTriggered one) and then have a yoyo'd tween on the inner element that you pause() while scrolling and resume() onScrubComplete: 

 

 

 

 

Does that help? 

 

Thanks dude, this is definitely the simplest, yet most effective approach to achieve what I wanted, it works like a charm! Love gsap and the great support you get on forum, it's the first time I write cause usually I always find the right answer just by reading other posts, hope this will help someone else too !

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