Varunbht Posted September 16, 2020 Share Posted September 16, 2020 Hi guys! Please click once in codepen demo. I am trying to make a very simple sparkling animation on clicking anywhere in the window but unfortunately I am not able to do it. It runs only once. I want it to run whenever I click. Please help me. See the Pen MWyBPNj by Swooshant (@Swooshant) on CodePen Link to comment Share on other sites More sharing options...
akapowl Posted September 16, 2020 Share Posted September 16, 2020 Hey @Varunbht - welcome to the forum. Changing sparkles.paused(!sparkles.paused()); to sparkles.play(0); seems to have done the trick. Is this what you intended? See the Pen 39d6129d43cca4f17b402d43d0d69118 by akapowl (@akapowl) on CodePen 2 Link to comment Share on other sites More sharing options...
Varunbht Posted September 16, 2020 Author Share Posted September 16, 2020 Thank You so much @akapowl for your help and could you tell me how I can hide this svg on load, so that it only shows when click. Link to comment Share on other sites More sharing options...
akapowl Posted September 16, 2020 Share Posted September 16, 2020 You could initially set the whole SVG to autoAlpha 0 gsap.set('svg.sparkles', { autoAlpha: 0 }) and then first thing in your timeline set it to autoAlpha 1. sparkles.set('svg.sparkles', { autoAlpha: 1 }); See the Pen 2ce52dfbdf982c8258d170570b771f5d by akapowl (@akapowl) on CodePen 2 Link to comment Share on other sites More sharing options...
Varunbht Posted September 16, 2020 Author Share Posted September 16, 2020 Thank you again @akapowl for your help. 1 Link to comment Share on other sites More sharing options...
ZachSaucier Posted September 16, 2020 Share Posted September 16, 2020 More on hiding things on load here: 2 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