Run at each animation interval
965767
function() {
        // Compute the amount of play left to go
        t.playLeft = t.playEnd - Date.now();

        // Done playing
        if (t.playLeft <= 0) {
          clearInterval(t.timer);
          t.next();
        }

        // Set the progress bar width
        t.setProgress();
      }
521058
function() {
            var Anim = Kinetic.Animation;
            this.stop();
            this.frame.timeDiff = 0;
            this.frame.lastTime = now();
            Anim._addAnimation(this);
        }
341588
function () {

		var times = this.times,
			values = this.values,
			stride = this.getValueSize(),

			smoothInterpolation = this.getInterpolation() === InterpolateSmooth,

			writeIndex = 1,
			lastIndex = times.length - 1;

		for ( var i = 1; i < lastIndex; ++ i ) {

			var keep = false;

			var time = times[ i ];
			var timeNext = times[ i + 1 ];

			// remove adjacent keyframes scheduled at the same time

			if ( time !== timeNext && ( i !== 1 || time !== time[ 0 ] ) ) {

				if ( ! smoothInterpolation ) {

					// remove unnecessary keyframes same as their neighbors

					var offset = i * stride,
						offsetP = offset - stride,
						offsetN = offset + stride;

					for ( var j = 0; j !== stride; ++ j ) {

						var value = values[ offset + j ];

						if ( value !== values[ offsetP + j ] ||
							value !== values[ offsetN + j ] ) {

							keep = true;
							break;

						}

					}

				} else {

					keep = true;

				}

			}

			// in-place compaction

			if ( keep ) {

				if ( i !== writeIndex ) {

					times[ writeIndex ] = times[ i ];

					var readOffset = i * stride,
						writeOffset = writeIndex * stride;

					for ( var j = 0; j !== stride; ++ j ) {

						values[ writeOffset + j ] = values[ readOffset + j ];

					}

				}

				++ writeIndex;

			}

		}

		// flush last keyframe (compaction looks ahead)

		if ( lastIndex > 0 ) {

			times[ writeIndex ] = times[ lastIndex ];

			for ( var readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {

				values[ writeOffset + j ] = values[ readOffset + j ];

			}

			++ writeIndex;

		}

		if ( writeIndex !== times.length ) {

			this.times = AnimationUtils.arraySlice( times, 0, writeIndex );
			this.values = AnimationUtils.arraySlice( values, 0, writeIndex * stride );

		}

		return this;

	}
1086099
function(){

            canvas = document.getElementById("canvas");
            canvas.width = Zone.prototype.WIDTH;
            canvas.height =  Zone.prototype.HEIGHT;

            frameCount = 0;

            if (GameView.isRunning()){
                run();
            }

            //Add a listener on our global gameData object, to know when our game starts/stops
            gameData.on("change:isRunning", function(model, value){
                value ? run() : reset();
            });
        }
480113
def run(self, force=False):
        
        now = time.time()
        for func, spec in self.tasks.items():
            if force or now >= spec.get('next_run', 0):
                func()
                spec['next_run'] = now + spec['interval']
684771
def animate(self, animation, static, score, best, appear):
        """"""

        # Create a surface of static parts in the animation.
        surface = pygame.Surface((self.game_width, self.game_height), 0)
        surface.fill(self.BACKGROUND)

        # Draw all static tiles.
        for y in range(self.COUNT_Y):
            for x in range(self.COUNT_X):
                x1, y1 = self.get_tile_location(x, y)
                x1 -= self.origin[0]
                y1 -= self.origin[1]
                surface.blit(self.tiles[static.get((x, y), 0)], (x1, y1))

        # Pygame clock for FPS control.
        clock = pygame.time.Clock()

        if score:
            score_label = self.label_font.render('+%d' % score, True, (119, 110, 101))
            w1, h1 = score_label.get_size()

        if best:
            best_label = self.label_font.render('+%d' % best, True, (119, 110, 101))
            w2, h2 = best_label.get_size()

        # Loop through every frame.
        for frame in range(self.ANIMATION_FRAMES):
            # Limit at 60 fps.
            clock.tick(60)

            # Pump events.
            pygame.event.pump()

            self.screen.blit(surface, self.origin)

            # Calculate animation progress.
            dt = (frame + 0.) / self.ANIMATION_FRAMES

            for tile in animation:
                self.screen.blit(self.tiles[tile.value], tile.get_position(dt))

            # Scale the images to be proportional to the square root allows linear size increase.
            scale = dt ** 0.5

            w, h = int(self.cell_width * scale) & ~1, int(self.cell_height * scale) & ~1

            for x, y, value in appear:
                self.screen.blit(self._scale_tile(value, w, h),
                                 self._center_tile(self.get_tile_location(x, y), (w, h)))

            # Draw the score boxes and get their location, if we are drawing scores.
            if best or score:
                (x1, y1), (x2, y2), w, h = self.draw_scores()
            if score:
                self.screen.blit(score_label, (x1 + (w - w1) / 2, y1 + (h - h1) / 2 - dt * h))
            if best:
                self.screen.blit(best_label, (x2 + (w - w2) / 2, y2 + (h - h2) / 2 - dt * h))

            pygame.display.flip()
1015359
def run
      @started_at = Time.now
      max_cycles = 1

      while true do
        if @cycle < max_cycles
          step
        else
          diff = Time.now - @started_at
          max_cycles = (diff * @clock_cycle)
        end
      end
    end
658246
function (x, y, anchorX, anchorY) {
            var tooltip = this,
              now = tooltip.now,
              animate = tooltip.options.animation !== false && !tooltip.isHidden &&
                    // When we get close to the target position, abort animation and land on the right place (#3056)
                (mathAbs(x - now.x) > 1 || mathAbs(y - now.y) > 1),
              skipAnchor = tooltip.followPointer || tooltip.len > 1;

            // Get intermediate values for animation
            extend(now, {
                x: animate ? (2 * now.x + x) / 3 : x,
                y: animate ? (now.y + y) / 2 : y,
                anchorX: skipAnchor ? UNDEFINED : animate ? (2 * now.anchorX + anchorX) / 3 : anchorX,
                anchorY: skipAnchor ? UNDEFINED : animate ? (now.anchorY + anchorY) / 2 : anchorY
            });

            // Move to the intermediate value
            tooltip.label.attr(now);


            // Run on next tick of the mouse tracker
            if (animate) {

                // Never allow two timeouts
                clearTimeout(this.tooltipTimeout);

                // Set the fixed interval ticking for the smooth tooltip
                this.tooltipTimeout = setTimeout(function () {
                    // The interval function may still be running during destroy, so check that the chart is really there before calling.
                    if (tooltip) {
                        tooltip.move(x, y, anchorX, anchorY);
                    }
                }, 32);

            }
        }
452291
def run_loop(agents, env, max_frames=0, max_episodes=0):
  """"""
  total_frames = 0
  total_episodes = 0
  start_time = time.time()

  observation_spec = env.observation_spec()
  action_spec = env.action_spec()
  for agent, obs_spec, act_spec in zip(agents, observation_spec, action_spec):
    agent.setup(obs_spec, act_spec)

  try:
    while not max_episodes or total_episodes < max_episodes:
      total_episodes += 1
      timesteps = env.reset()
      for a in agents:
        a.reset()
      while True:
        total_frames += 1
        actions = [agent.step(timestep)
                   for agent, timestep in zip(agents, timesteps)]
        if max_frames and total_frames >= max_frames:
          return
        if timesteps[0].last():
          break
        timesteps = env.step(actions)
  except KeyboardInterrupt:
    pass
  finally:
    elapsed_time = time.time() - start_time
    print("Took %.3f seconds for %s steps: %.3f fps" % (
        elapsed_time, total_frames, total_frames / elapsed_time))
1069108
private void startAnimationInternal() {
        long duration = toController.getSettings().getAnimationsDuration();
        float durationFraction = toPosition == 1f
                ? (isLeaving ? position : 1f - position)
                : (isLeaving ? position / toPosition : (1f - position) / (1f - toPosition));

        positionScroller.setDuration((long) (duration * durationFraction));
        positionScroller.startScroll(position, isLeaving ? 0f : 1f);
        animationEngine.start();
        onAnimationStarted();
    }
381330
def run(self, once=False):
        """"""
        self._once = once
        self.start()
        while self.running:
            try:
                time.sleep(1.0)
            except KeyboardInterrupt:
                self.stop()
                self.join()
103564
function() {
        var options = this.options,
            animation = options.animation;

        // Cycling more than the show amount causes unexpected issues
        if (options.itemsToCycle > options.itemsToShow) {
            options.itemsToCycle = options.itemsToShow;
        }

        // Fade animations can only display 1 at a time
        if (animation === 'fade') {
            options.itemsToShow = options.itemsToCycle = 1;
            options.infinite = false;

        // Determine the dimension and position based on animation
        } else if (animation === 'slide-up') {
            this._dimension = 'height';
            this._position = 'top';

        } else if (animation === 'slide') {
            this._dimension = 'width';
            this._position = options.rtl ? 'right' : 'left';
        }
    }
1251200
def run(self):
        """"""
        while not self._finished.isSet():
            self._func(self._reference)
            self._finished.wait(self._func._interval / 1000.0)
334620
function () {
                    // TODO Use requestAnimationFrame instead of setInterval
                    // https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame
                    this.show();
                    var self = this;
                    intervalCounterId = setInterval(function () {
                        if (isNaN(count)) {
                            clearInterval(intervalCounterId);
                            count = 0;
                            self.hide();
                        } else {
                            var remaining = 100 - count;
                            count = count + (0.15 * Math.pow(1 - Math.sqrt(remaining), 2));
                            self.updateCount(count);
                        }
                    }, 200);
                }
1308021
function incrementPosition() {
            comparison._animateInterval = setInterval(function () {
                currentPositionInPercent++;
                comparison._updatePosition(currentPositionInPercent);
                if (currentPositionInPercent >= newPositionInPercent) {
                    setFinalPositionAndClearInterval();
                }
            }, 10);
        }
721459
def basic_animation(frames=100, interval=30):
    """"""
    fig = plt.figure()
    ax = plt.axes(xlim=(0, 10), ylim=(-2, 2))
    line, = ax.plot([], [], lw=2)

    x = np.linspace(0, 10, 1000)

    def init():
        line.set_data([], [])
        return line,

    def animate(i):
        y = np.cos(i * 0.02 * np.pi) * np.sin(x - i * 0.02 * np.pi)
        line.set_data(x, y)
        return line,

    return animation.FuncAnimation(fig, animate, init_func=init,
                                   frames=frames, interval=interval)
719358
function resize () {
    if (!running) {
      running = true

      if (window.requestAnimationFrame) {
        window.requestAnimationFrame(runCallbacks)
      } else {
        setTimeout(runCallbacks, 66)
      }
    }
  }