function animate() {
  if (typeof App.stats !== 'undefined') {
    App.stats.begin();
  }

  // Record the amount of time since the last tick. Used to smooth animation.
  // This is the only place that App.timer.getDelta() should ever be called
  // because getDelta() returns the time since the last time it was called so
  // calling it elsewhere will skew the result here.
  var frameDelta = App.timer.getDelta();
  // Starts the timer in the first animation frame. Doing this here instead of
  // in startAnimating() lets us get the delta right for the first frame.
  if (!App.timer.running) {
    App.timer.start();
  }
  // Cap the delta in order to avoid the spiral of death.
  if (App.MIN_FPS && frameDelta > 1 / App.MIN_FPS) {
    /**
     * @event low_fps
     *   Fires on the document when the frame rate drops below App.MIN_FPS.
     *
     * @param {Number} fps The frame-per-second rate.
     *
     * @member global
     */
    jQuery(document).trigger('low_fps', [1 / frameDelta]);
    frameDelta = 1 / App.MIN_FPS;
  }
  // Count paints so we can calculate overall FPS
  App.timer.frames++;

  if (App.debugMode) {
    Timer.event('debug timer update', true);
  }

  // update
  if (window.Mouse && Mouse.Scroll) {
    Mouse.Scroll._update();
  }
  while (frameDelta > 0 && !App.isGameOver) {
    // Break the physics updates down into discrete chunks of no more than
    // 1 / App.MAX_FPS in order to keep them as small as possible for accuracy.
    /**
     * @property physicsDelta
     *   The amount of simulated time in seconds since the last physics update.
     *
     * Use this to smooth animation.
     *
     * @member App
     * @static
     */
    App.physicsDelta = Math.min(frameDelta, 1 / App.MAX_FPS);
    if (typeof update == 'function') {
      update(App.physicsDelta, App.physicsTimeElapsed);
    }
    frameDelta -= App.physicsDelta;
    App.physicsTimeElapsed += App.physicsDelta;
  }

  if (App.debugMode) {
    App.Debug.updateTimeElapsed += Timer.getTimeSince('debug timer update');
    Timer.event('debug timer clear', true);
  }

  // clear
  context.clear();

  if (App.debugMode) {
    App.Debug.clearTimeElapsed += Timer.getTimeSince('debug timer clear');
    Timer.event('debug timer draw', true);
  }

  // draw
  draw();

  if (App.debugMode) {
    App.Debug.drawTimeElapsed += Timer.getTimeSince('debug timer draw');
  }

  if (typeof App.stats !== 'undefined') {
    App.stats.end();
  }

  // request new frame
  if (_animate) {
    window.requestAnimFrame(animate);
  }
}
/**
 * Animate the canvas. This is intended for private use and should not be
 * called directly. Instead see {@link #startAnimating} and
 * {@link #stopAnimating}.
 *
 * @member App
 * @ignore
 */
Animate the canvas. This is intended for private use and should not be
called directly. Instead see  #startAnimating and
#stopAnimating.

@member App
@ignore
Animate the canvas . This is intended for private use and should not be called directly . Instead see #startAnimating and #stopAnimating . @member App @ignore
function animate() {
  if (typeof App.stats !== 'undefined') {
    App.stats.begin();
  }
  var frameDelta = App.timer.getDelta();
  if (!App.timer.running) {
    App.timer.start();
  }
  if (App.MIN_FPS && frameDelta > 1 / App.MIN_FPS) {
    jQuery(document).trigger('low_fps', [1 / frameDelta]);
    frameDelta = 1 / App.MIN_FPS;
  }
  App.timer.frames++;
  if (App.debugMode) {
    Timer.event('debug timer update', true);
  }
  if (window.Mouse && Mouse.Scroll) {
    Mouse.Scroll._update();
  }
  while (frameDelta > 0 && !App.isGameOver) {
    App.physicsDelta = Math.min(frameDelta, 1 / App.MAX_FPS);
    if (typeof update == 'function') {
      update(App.physicsDelta, App.physicsTimeElapsed);
    }
    frameDelta -= App.physicsDelta;
    App.physicsTimeElapsed += App.physicsDelta;
  }
  if (App.debugMode) {
    App.Debug.updateTimeElapsed += Timer.getTimeSince('debug timer update');
    Timer.event('debug timer clear', true);
  }
  context.clear();
  if (App.debugMode) {
    App.Debug.clearTimeElapsed += Timer.getTimeSince('debug timer clear');
    Timer.event('debug timer draw', true);
  }
  draw();
  if (App.debugMode) {
    App.Debug.drawTimeElapsed += Timer.getTimeSince('debug timer draw');
  }
  if (typeof App.stats !== 'undefined') {
    App.stats.end();
  }
  if (_animate) {
    window.requestAnimFrame(animate);
  }
}
function animate ( ) { if ( typeof App . stats !== 'undefined' ) { App . stats . begin ( ) ; } var frameDelta = App . timer . getDelta ( ) ; if ( ! App . timer . running ) { App . timer . start ( ) ; } if ( App . MIN_FPS && frameDelta > 1 / App . MIN_FPS ) { jQuery ( document ) . trigger ( 'low_fps' , [ 1 / frameDelta ] ) ; frameDelta = 1 / App . MIN_FPS ; } App . timer . frames ++ ; if ( App . debugMode ) { Timer . event ( 'debug timer update' , true ) ; } if ( window . Mouse && Mouse . Scroll ) { Mouse . Scroll . _update ( ) ; } while ( frameDelta > 0 && ! App . isGameOver ) { App . physicsDelta = Math . min ( frameDelta , 1 / App . MAX_FPS ) ; if ( typeof update == 'function' ) { update ( App . physicsDelta , App . physicsTimeElapsed ) ; } frameDelta -= App . physicsDelta ; App . physicsTimeElapsed += App . physicsDelta ; } if ( App . debugMode ) { App . Debug . updateTimeElapsed += Timer . getTimeSince ( 'debug timer update' ) ; Timer . event ( 'debug timer clear' , true ) ; } context . clear ( ) ; if ( App . debugMode ) { App . Debug . clearTimeElapsed += Timer . getTimeSince ( 'debug timer clear' ) ; Timer . event ( 'debug timer draw' , true ) ; } draw ( ) ; if ( App . debugMode ) { App . Debug . drawTimeElapsed += Timer . getTimeSince ( 'debug timer draw' ) ; } if ( typeof App . stats !== 'undefined' ) { App . stats . end ( ) ; } if ( _animate ) { window . requestAnimFrame ( animate ) ; } }
Animate the canvas.
Animate the canvas .
// Record the amount of time since the last tick. Used to smooth animation. // This is the only place that App.timer.getDelta() should ever be called // because getDelta() returns the time since the last time it was called so // calling it elsewhere will skew the result here. // Starts the timer in the first animation frame. Doing this here instead of // in startAnimating() lets us get the delta right for the first frame. // Cap the delta in order to avoid the spiral of death. /**
     * @event low_fps
     *   Fires on the document when the frame rate drops below App.MIN_FPS.
     *
     * @param {Number} fps The frame-per-second rate.
     *
     * @member global
     */ // Count paints so we can calculate overall FPS // update // Break the physics updates down into discrete chunks of no more than // 1 / App.MAX_FPS in order to keep them as small as possible for accuracy. /**
     * @property physicsDelta
     *   The amount of simulated time in seconds since the last physics update.
     *
     * Use this to smooth animation.
     *
     * @member App
     * @static
     */ // clear // draw // request new frame