com.google.gwt.animation.client

## Class Animation

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

- Direct Known Subclasses:
    CellTree.NodeAnimation, PopupPanel.ResizeAnimation

      public abstract class Animation
      extends java.lang.Object

  An `Animation` is a continuous event that updates progressively over time at a non-fixed frame rate.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `Animation()` Construct a new `Animation`.
    `protected` | `Animation(AnimationScheduler scheduler)` Construct a new `AnimationScheduler` using the specified scheduler to sheduler request frames.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancel()` Immediately cancel this animation.
    `protected double` | `interpolate(double progress)` Interpolate the linear progress into a more natural easing function.
    `protected void` | `onCancel()` Called immediately after the animation is canceled.
    `protected void` | `onComplete()` Called immediately after the animation completes.
    `protected void` | `onStart()` Called immediately before the animation starts.
    `protected abstract void` | `onUpdate(double progress)` Called when the animation should be updated.
    `void` | `run(int duration)` Immediately run this animation.
    `void` | `run(int duration, double startTime)` Run this animation at the given startTime.
    `void` | `run(int duration, double startTime, Element element)` Run this animation at the given startTime.
    `void` | `run(int duration, Element element)` Immediately run this animation.

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

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

- - ### Constructor Detail

    - #### Animation

          public Animation()

      Construct a new `Animation`.

    - #### Animation

          protected Animation(AnimationScheduler scheduler)

      Construct a new `AnimationScheduler` using the specified scheduler to sheduler request frames.
      Parameters:
        `scheduler` - an `AnimationScheduler` instance

  - ### Method Detail

    - #### cancel

          public void cancel()

      Immediately cancel this animation. If the animation is running or is scheduled to run, `onCancel()` will be called.

    - #### run

          public void run(int duration)

      Immediately run this animation. If the animation is already running, it will be canceled first.

      This is equivalent to `run(duration, null)`.

      Parameters:
        `duration` - the duration of the animation in milliseconds
      See Also:
        `run(int, Element)`

    - #### run

          public void run(int duration,
                 Element element)

      Immediately run this animation. If the animation is already running, it will be canceled first.

      If the element is not `null`, the `onUpdate(double)` method might be called only if the element may be visible (generally left at the appreciation of the browser). Otherwise, it will be called unconditionally.

      Parameters:
        `duration` - the duration of the animation in milliseconds
        `element` - the element that visually bounds the entire animation

    - #### run

          public void run(int duration,
                 double startTime)

      Run this animation at the given startTime. If the startTime has already passed, the animation will run synchronously as if it started at the specified start time. If the animation is already running, it will be canceled first.

      This is equivalent to `run(duration, startTime, null)`.

      Parameters:
        `duration` - the duration of the animation in milliseconds
        `startTime` - the synchronized start time in milliseconds
      See Also:
        `run(int, double, Element)`

    - #### run

          public void run(int duration,
                 double startTime,
                 Element element)

      Run this animation at the given startTime. If the startTime has already passed, the animation will run synchronously as if it started at the specified start time. If the animation is already running, it will be canceled first.

      If the element is not `null`, the `onUpdate(double)` method might be called only if the element may be visible (generally left at the appreciation of the browser). Otherwise, it will be called unconditionally.

      Parameters:
        `duration` - the duration of the animation in milliseconds
        `startTime` - the synchronized start time in milliseconds
        `element` - the element that visually bounds the entire animation

    - #### interpolate

          protected double interpolate(double progress)

      Interpolate the linear progress into a more natural easing function. Depending on the `Animation`, the return value of this method can be less than 0.0 or greater than 1.0.
      Parameters:
        `progress` - the linear progress, between 0.0 and 1.0
      Returns:
        the interpolated progress

    - #### onCancel

          protected void onCancel()

      Called immediately after the animation is canceled. The default implementation of this method calls `onComplete()` only if the animation has actually started running.

    - #### onComplete

          protected void onComplete()

      Called immediately after the animation completes.

    - #### onStart

          protected void onStart()

      Called immediately before the animation starts.

    - #### onUpdate

          protected abstract void onUpdate(double progress)

      Called when the animation should be updated. The value of progress is between 0.0 and 1.0 (inclusive) (unless you override the `interpolate(double)` method to provide a wider range of values). There is no guarantee that `onUpdate(double)` is called with 0.0 or 1.0. If you need to perform setup or tear down procedures, you can override `onStart()` and `onComplete()`.
      Parameters:
        `progress` - a double, normally between 0.0 and 1.0 (inclusive)