isladjan Posted January 17, 2020 Share Posted January 17, 2020 Hi to all, I'm trying to learn gsap 3.x, but i have a problem with overwrite. Can anyone show me working example of new "onInterrupt" callback? Or there is some other way in GSAP 3.x to identify when (or if) overwrite between tweens is happen? Thanks, isladjan See the Pen zYxmKoq by makica (@makica) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted January 17, 2020 Share Posted January 17, 2020 Hey isladjan, welcome to the GreenSock forums! This is a good question. Sorry, we're still in the process of updating our docs (it's a long process to document all of the changes and new things!) so onInterrupt is not in there yet. The GSAP 3 Release Notes say Quote onOverwrite was removed in favor of a new onInterrupt callback that fires if/when the tween is killed before it completes. This could happen because its kill() method is called or due to overwriting. This means that onInterrupt only fires if the tween is effectively killed, meaning something like .kill() is used on it or another tween affecting the same target has overwrite: true. It might be worth observing how the different overwrite values affect your animation: See the Pen WNbaoXG?editors=0010 by GreenSock (@GreenSock) on CodePen Are you trying to achieve something specifically? Maybe some context can help you figure out the setup that you need. 1 1 Link to comment Share on other sites More sharing options...
isladjan Posted January 18, 2020 Author Share Posted January 18, 2020 thanks Zach for clarifying this to me and for quick response. 8 hours ago, ZachSaucier said: Are you trying to achieve something specifically? Maybe some context can help you figure out the setup that you need. I have a problem with property: repeatRefresh, i can't make it work. I'm trying to make a demo in which the svg paths will go in random directions using the new GSAP 3.x Utility Methods. I thought first the problem is with overwrite, but it's not. See the Pen qBEJPpJ by isladjan (@isladjan) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted January 18, 2020 Share Posted January 18, 2020 Cool animation! I like it. Very good question. repeatRefresh currently only works when the tween itself is what has the repeat property on it. Since you're repeating an entire timeline, the individual repeatRefresh isn't applied. To work around that, you could create a new set of tweens for those that you want to repeat with different values after the timeline has completed. I also set the progress to 0 of your CodePen timeline and invalidated it because it ends up in a different place (the ornaments timeline ends up in the same place as it starts so you don't need to do that). See the Pen GRgYOjj?editors=0010 by GreenSock (@GreenSock) on CodePen Side note: you can use the delay or repeatDelay properties instead of empty tweens if you'd like. 1 1 Link to comment Share on other sites More sharing options...
isladjan Posted January 19, 2020 Author Share Posted January 19, 2020 Perhaps GSAP 3.x documentation is yet not perfect, but gsap forum is. Thanks again Zach, that's exactly what i was looking for. You saved me a lot of time. I will accept your syntax and advice. 1 1 Link to comment Share on other sites More sharing options...
ZachSaucier Posted January 24, 2020 Share Posted January 24, 2020 As of GSAP 3.1, you can now use repeatRefresh on the timeline itself instead of having to create a new timeline each repeat! See the Pen KKwrYmb?editors=0010 by GreenSock (@GreenSock) on CodePen 1 1 Link to comment Share on other sites More sharing options...
isladjan Posted January 28, 2020 Author Share Posted January 28, 2020 Thanks Zach, I update the code, and repeatRefresh works now perfectly on Timeline. just keep up the good work :) 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