Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.maryanovsky.gwtutils.client.ui
Class Animation

    java.lang.Object
      com.maryanovsky.gwtutils.client.ui.Animation

Direct Known Subclasses:
  FadeAnimation, MapWidget.MapAnimation

    public abstract class Animation

extends Object

A convenient method to perform animations.

Author:
  Maryanovsky Alexander

Field Summary
`static int` | `DEFAULT_FPS` The default frame rate.

Constructor Summary
`Animation(int duration)` Creates a new `Animation` with the specified duration and default frame rate.
`Animation(int duration, int fps)` Creates a new `Animation` with the specified duration (in milliseconds) and frames per second to display.

Method Summary
`protected abstract void` | `animationEnd()` Invoked after the animation is done.
`protected abstract void` | `animationStart()` Invoked before the first frame of the animation is displayed.
`void` | `end()` Ends the animation immediately.
`int` | `getDuration()` Returns the duration of the animation, in milliseconds.
`double` | `getFps()` Returns the number of frames per second this animation displays.
`double` | `getHalfSinusoidalProgress()` Returns the half-sinusoidal progression of the animation, i.e.
`double` | `getLinearProgress()` Returns the linear progress of the animation, i.e.
`double` | `getSinusoidalProgress()` Returns the sinusoidal progression of the animation, i.e.
`boolean` | `isRunning()` Returns whether the animation is currently running.
`protected abstract void` | `nextFrame()` Displays the next frame of the animation.
`void` | `start()` Starts the animation (and returns immediately).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_FPS

    public static final int DEFAULT_FPS

  The default frame rate.

  See Also:
    Constant Field Values

Constructor Detail

### Animation

    public Animation(int duration,
                     int fps)

  Creates a new `Animation` with the specified duration (in milliseconds) and frames per second to display.

### Animation

    public Animation(int duration)

  Creates a new `Animation` with the specified duration and default frame rate.

Method Detail

### getDuration

    public final int getDuration()

  Returns the duration of the animation, in milliseconds.

### getFps

    public final double getFps()

  Returns the number of frames per second this animation displays.

### start

    public void start()

  Starts the animation (and returns immediately).

### isRunning

    public final boolean isRunning()

  Returns whether the animation is currently running. This returns `true` between the return from start() and until the return from animationEnd().

### end

    public void end()

  Ends the animation immediately.

### getLinearProgress

    public final double getLinearProgress()

  Returns the linear progress of the animation, i.e. a value that changes from 0 to 1 linearly with time.

### getSinusoidalProgress

    public final double getSinusoidalProgress()

  Returns the sinusoidal progression of the animation, i.e. a value that changes from 0 to 1 as the sine changes between -pi/2 and +pi/2.

### getHalfSinusoidalProgress

    public final double getHalfSinusoidalProgress()

  Returns the half-sinusoidal progression of the animation, i.e. a value that changes from 0 to 1 as the sine changes between 0 and pi/2.

### animationStart

    protected abstract void animationStart()

  Invoked before the first frame of the animation is displayed. This method will always be called, even if the animation ends prematurely.

### nextFrame

    protected abstract void nextFrame()

  Displays the next frame of the animation. Use one of the `get[Type]Progress` methods to determine how far along the animation is. Note that this method is not guaranteed to get called because the animation may be ended prematurely.

### animationEnd

    protected abstract void animationEnd()

  Invoked after the animation is done. This method will always be called, even if the animation ends prematurely.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD