add RequestAnimationFrame support for render in loop