girro Posted March 6, 2021 Share Posted March 6, 2021 Hello all! I'm a beginner in all web related fields and this is my first try with javascript animation. I've spent couple of hours trying to find out if the problem is in my GSAP timelines or my poor javascript skills, but I can't get animation to repeat on second mouse click. Thanks, Girro See the Pen VwmGwxo?editors=1111 by hanzek (@hanzek) on CodePen Link to comment Share on other sites More sharing options...
PointC Posted March 6, 2021 Share Posted March 6, 2021 Hi @girro Welcome to the forum. It doesn't work on the second click because you've already played the timeline. You'll want to restart the timeline or use .play(0) like this: document.getElementById("List").addEventListener("click", () => tl.play(0)); document.getElementById("Kanban").addEventListener("click", () => t2.play(0)); Is this intended to be a bubble indicator when you're done? If so, this demo may help. See the Pen zJVmMd by PointC (@PointC) on CodePen Happy tweening and welcome aboard. 4 Link to comment Share on other sites More sharing options...
girro Posted March 6, 2021 Author Share Posted March 6, 2021 Thanks for quick solution. And the example is perfect for my case. Cheers! 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