pietM Posted March 12, 2022 Share Posted March 12, 2022 HI everyone, Likely a common question, but I can't find a clear solution after searching the forums. I have elements in a div that distribute by flex after a "mouseenter" event. The widths are set to "auto," so they shift once the browser dimensions change. I think I need to add a "resize" listener: window.addEventListener("resize", () => {}) and collect the new widths with gsap.getPropoerty() after "resize" and tl.kill()? But when I try this approach it doesn't work. Appreciate the help and feedback. M See the Pen LYeYWXm by evryali (@evryali) on CodePen Link to comment Share on other sites More sharing options...
Solution Cassie Posted March 12, 2022 Solution Share Posted March 12, 2022 Hello there @pietM, The jigsaw piece you're missing here is tl.invalidate()https://greensock.com/docs/v3/GSAP/Timeline/invalidate() Here's a demo, a little refactored - fromTo can sometimes be very useful, but it can also be unnecessary if you set things up properly in the CSS. (also it's circ not cerc) Hope this helps! See the Pen OJzJmQN?editors=0010 by GreenSock (@GreenSock) on CodePen 4 Link to comment Share on other sites More sharing options...
pietM Posted March 12, 2022 Author Share Posted March 12, 2022 Awesome. So helpful. Thank you @Cassie! I don't have much experience w/ .invalidate(), but seems extremely useful. (I know re:circ, 'cerc' reminds me of autechre?!?) Thanks again! 1 1 Link to comment Share on other sites More sharing options...
Cassie Posted March 12, 2022 Share Posted March 12, 2022 My pleasure! Happy tweening and have a lovely weekend. 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