Implemented requestAnimationFrame

Improve performance by not drawing when the browser is not ready but
still maintaining the framerate