Answer the question
In order to leave comments, you need to log in
How to properly restart canvas on button click?
You need to start the canvas animation on the click of the button, when you click again, the animation should reset and repeat again (tuggle effect). In the example, I did just that, however, on my click, the function is called many times without clearing the old canvas, which by itself affects the speed (fps) of the animation. How to do it right?
https://jsfiddle.net/Lr2fpndx/
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question