Replacing setInterval() with requestAnimationFrame().