using requestAnimationFrame