What is the correct way to clear the canvas animation on click of a button and restart it?

  • 0
    You need to start the canvas animation on the click of the button, when you click the button again, the animation should be reset and repeated again (tuggle effect). In the example, I did so, 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?
    JavaScript William Barton, Apr 26, 2020

  • 1 Answers
  • 0
    Eliot Robbins

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!