Using requestAnimationFrame for animation