SyntaxFix
Write A Post
Hire A Developer
Questions
I always use this
ctx.clearRect(0, 0, canvas.width, canvas.height) window.requestAnimationFrame(functionToBeCalled)
NOTE
combining clearRect and requestAnimationFrame allows for more fluid animation if that is what you're going for