public void start() { if (!ticking) { ticking = true; AnimationScheduler.get().requestAnimationFrame(this); } }
@Override public void execute(double timestamp) { if (update(timestamp)) { // Schedule the next animation frame. requestHandle = scheduler.requestAnimationFrame(callback, element); } else { requestHandle = null; } } };
/** * Construct a new {@link Animation}. */ public Animation() { this(AnimationScheduler.get()); }
/** * Schedule an animation, letting the browser decide when to trigger the next * step in the animation. * * <p> * NOTE: If you are animating an element, use * {@link #requestAnimationFrame(AnimationCallback, Element)} instead so the * browser can optimize for the specified element. * </p> * * <p> * Using this method instead of a timeout is preferred because the browser is * in the best position to decide how frequently to trigger the callback for * an animation of the specified element. The browser can balance multiple * animations and trigger callbacks at the optimal rate for smooth * performance. * </p> * * @param callback the callback to fire * @return a handle to the requested animation frame * @see #requestAnimationFrame(AnimationCallback, Element) */ public AnimationHandle requestAnimationFrame(AnimationCallback callback) { return requestAnimationFrame(callback, null); }
/** * Construct a new {@link Animation}. */ public Animation() { this(AnimationScheduler.get()); }
@Override public void execute (double timestamp) { try { mainLoop(); } catch (Throwable t) { error("GwtApplication", "exception: " + t.getMessage(), t); throw new RuntimeException(t); } AnimationScheduler.get().requestAnimationFrame(this, graphics.canvas); } }, graphics.canvas);
@Override public void execute(double timestamp) { if (update(timestamp)) { // Schedule the next animation frame. requestHandle = scheduler.requestAnimationFrame(callback, element); } else { requestHandle = null; } } };
/** * Construct a new {@link Animation}. */ public Animation() { this(AnimationScheduler.get()); }
@Override public void execute (double timestamp) { try { mainLoop(); } catch (Throwable t) { error("GwtApplication", "exception: " + t.getMessage(), t); throw new RuntimeException(t); } AnimationScheduler.get().requestAnimationFrame(this, graphics.canvas); } }, graphics.canvas);
@Override public void execute(double timestamp) { if (update(timestamp)) { // Schedule the next animation frame. requestHandle = scheduler.requestAnimationFrame(callback, element); } else { requestHandle = null; } } };
@Override public void execute(double timestamp) { if (ticking) { GamepadSupport.pollGamepads(); GamepadSupport.pollGamepadsStatus(); AnimationScheduler.get().requestAnimationFrame(this); } } }
/** * Schedule an animation, letting the browser decide when to trigger the next * step in the animation. * * <p> * NOTE: If you are animating an element, use * {@link #requestAnimationFrame(AnimationCallback, Element)} instead so the * browser can optimize for the specified element. * </p> * * <p> * Using this method instead of a timeout is preferred because the browser is * in the best position to decide how frequently to trigger the callback for * an animation of the specified element. The browser can balance multiple * animations and trigger callbacks at the optimal rate for smooth * performance. * </p> * * @param callback the callback to fire * @return a handle to the requested animation frame * @see #requestAnimationFrame(AnimationCallback, Element) */ public AnimationHandle requestAnimationFrame(AnimationCallback callback) { return requestAnimationFrame(callback, null); }
AnimationScheduler.get().requestAnimationFrame(new AnimationCallback() { @Override public void execute (double timestamp) {
/** * Schedule an animation, letting the browser decide when to trigger the next * step in the animation. * * <p> * NOTE: If you are animating an element, use * {@link #requestAnimationFrame(AnimationCallback, Element)} instead so the * browser can optimize for the specified element. * </p> * * <p> * Using this method instead of a timeout is preferred because the browser is * in the best position to decide how frequently to trigger the callback for * an animation of the specified element. The browser can balance multiple * animations and trigger callbacks at the optimal rate for smooth * performance. * </p> * * @param callback the callback to fire * @return a handle to the requested animation frame * @see #requestAnimationFrame(AnimationCallback, Element) */ public AnimationHandle requestAnimationFrame(AnimationCallback callback) { return requestAnimationFrame(callback, null); }
AnimationScheduler.get().requestAnimationFrame(new AnimationCallback() { @Override public void execute (double timestamp) {
@Override protected final void tick() { if (m_refire) { m_refire = false; AnimationScheduler.get().requestAnimationFrame(m_action); } }
@Override protected final void tick() { if (m_refire) { m_refire = false; AnimationScheduler.get().requestAnimationFrame(m_action); } }
@Override protected final void tick() { if (m_refire) { m_refire = false; AnimationScheduler.get().requestAnimationFrame(m_action); } }
@Override protected final void tick() { if (m_refire) { m_refire = false; AnimationScheduler.get().requestAnimationFrame(m_action); } }
private void kick() { if (commands.size() > 0) { AnimationScheduler.get().requestAnimationFrame(callback); } }