In this tutorial, I go over a bit of Javascript that will move a square across the canvas using requestAnimationFrame. This is by far the best way to do animation on an HTML5 canvas, so check it out!
Source: https://github.com/pothonprogramming/...
Working Example: https://pothonprogramming.github.io/c...