use requestAnimationFrame instead of setinteral