Request animation frame

This implementation fixes #18 but breaks the tests. Even if we force to use setTimeout polyfill in tests, the tests do not run properly.