Animating with javascript: from setInterval to requestAnimationFrame Animating DOM elements[1] or the content of a canvas is a classical use case for setInterval. But the interval is not as reliable as it seems, and a more suitable API is now available… Animating with setInterval To animate an element moving 400 pixels on the right with javascript, the basic thing to do is to move it 10 pixels at