Using requestAnimationFrame instead of setInterval