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:
  MapWidget.MapAnimation

    public abstract class Animation

extends Object

A convenient method to perform animations.

Author:
  Maryanovsky Alexander

Constructor Summary
`Animation(int duration)` Creates a new `Animation` with the specified duration, displaying 25 frames per second.
`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` | `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`

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, displaying 25 frames per second.

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.

### 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