using requestAnimationFrame() instead of setIntervar