function setAnimationScheduler(scheduler) {
  scheduler = scheduler || window
  if (scheduler !== _scheduler) {
    if (nextFrameTimer) {
      _scheduler.cancelAnimationFrame(nextFrameTimer)
      nextFrameTimer = null
    }
    _scheduler = scheduler
    queueFrame()
  }
}
Allow the scheduler to be modified, e.g. when switching to an immersive XRSession.

TODO: we may want to only do this for a subset of animations, like just those subject to
 an XRSession, while letting others use the default. This global hook won't work for that.

@param {{requestAnimationFrame, cancelAnimationFrame}} scheduler - an object holding
       the two scheduling functions.