Package com.google.gwt.animation.client

## Class AnimationScheduler

- java.lang.Object
- - com.google.gwt.animation.client.AnimationScheduler

- Direct Known Subclasses:
    `AnimationSchedulerImplStandard`, `AnimationSchedulerImplTimer`, `StubAnimationScheduler`

      public abstract class AnimationScheduler
      extends java.lang.Object

  This class provides task scheduling for animations. Any exceptions thrown by the command objects executed by the scheduler will be passed to the `GWT.UncaughtExceptionHandler` if one is installed.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `AnimationScheduler.AnimationCallback` | The callback used when an animation frame becomes available.
    `static class` | `AnimationScheduler.AnimationHandle` | A handle to the requested animation frame created by `requestAnimationFrame(AnimationCallback, Element)`.
    `static class` | `AnimationScheduler.AnimationSupportDetector` | Helper to detect native support for animations.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AnimationScheduler()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static AnimationScheduler` | `get()` | Returns the default implementation of the AnimationScheduler API.
    `AnimationScheduler.AnimationHandle` | `requestAnimationFrame​(AnimationScheduler.AnimationCallback callback)` | Schedule an animation, letting the browser decide when to trigger the next step in the animation.
    `abstract AnimationScheduler.AnimationHandle` | `requestAnimationFrame​(AnimationScheduler.AnimationCallback callback, Element element)` | Schedule an animation, letting the browser decide when to trigger the next step in the animation.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AnimationScheduler

          public AnimationScheduler()

  - ### Method Detail

    - #### get

          public static AnimationScheduler get()

      Returns the default implementation of the AnimationScheduler API.

    - #### requestAnimationFrame

          public AnimationScheduler.AnimationHandle requestAnimationFrame​(AnimationScheduler.AnimationCallback callback)

      Schedule an animation, letting the browser decide when to trigger the next step in the animation.

      NOTE: If you are animating an element, use `requestAnimationFrame(AnimationCallback, Element)` instead so the browser can optimize for the specified element.

      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.

      Parameters:
        `callback` - the callback to fire
      Returns:
        a handle to the requested animation frame
      See Also:
        `requestAnimationFrame(AnimationCallback, Element)`

    - #### requestAnimationFrame

          public abstract AnimationScheduler.AnimationHandle requestAnimationFrame​(AnimationScheduler.AnimationCallback callback,
                                                                                   Element element)

      Schedule an animation, letting the browser decide when to trigger the next step in the animation.

      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.

      Parameters:
        `callback` - the callback to fire
        `element` - the element being animated
      Returns:
        a handle to the requested animation frame