A
A
Alice7772020-12-07 14:45:59
JavaScript
Alice777, 2020-12-07 14:45:59

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

1 answer(s)
R
RAX7, 2020-12-07
@Alice777

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question