switch to requestAnimationFrame for rendering - v3

The original method of setTimeout for animation drains on system resources
if the tab is not visible, It is somewhat mitigated by some of the
modern browsers (Chrome and Firefox tested) which set a maximum
one setTimeout call per second for background tabs, though this is
not a behaviour to be relied upon.

The requestAnimationFrame API aims to fix that with these properties:
- animation is suspended for background tabs, and resumed when forgrounded
- animation frames are aligned with canvas refreshes by the graphics card,
  thus it should be smoother
- fall back to the old method of setTimeout when the API is not available

The "fps" option is also removed here, since it is now timed by the
browser itself. It is by default equivalent to about 60 fps.