Class ALcdAnimation

java.lang.Object
com.luciad.view.animation.ALcdAnimation
All Implemented Interfaces:
ILcdAnimation
Direct Known Subclasses:
TLcdAnimation

public abstract class ALcdAnimation extends Object implements ILcdAnimation
Convenience class for implementing animations, including ILcdView based animations.

It has only one abstract method: setTimeImpl(double) for updating the animation. To customize the timing of the animation, you can supply an Interpolator.

Additionally, you can override isLoop() to implement looping animations, and override the empty start(), stop(), and restart() implementations to do additional bookkeeping and cleanup, such as handling a canceled animation.

You can supply any number of ILcdView objects at construction time. ALcdAnimation makes sure to invalidate them when setTime(double) is invoked.

Since:
2012.0
  • Constructor Details

  • Method Details

    • getInterpolator

      public ALcdAnimation.Interpolator getInterpolator()
      Returns the ALcdAnimation.Interpolator of this ALcdAnimation.
      Returns:
      the ALcdAnimation.Interpolator of this ALcdAnimation
    • setInterpolator

      public void setInterpolator(ALcdAnimation.Interpolator aInterpolator)
      Updates the interpolator of this ALcdAnimation.
      Parameters:
      aInterpolator - the new interpolator for this ALcdAnimation.
      Throws:
      IllegalArgumentException - when aInterpolator equals null.
    • setTime

      public final void setTime(double aTime)
      Updates the animation in function of the time elapsed since its start. This implementation uses the interpolator and calls setTimeImpl(double) to perform the actual update of the animation.

      All ILcdView objects provided at construction time are invalidated.

      Specified by:
      setTime in interface ILcdAnimation
      Parameters:
      aTime - the duration (in seconds) for which the animation has been running
    • setTimeImpl

      protected abstract void setTimeImpl(double aTime)
      Performs the actual updates that are necessary to progress the animation to the given time.
      Parameters:
      aTime - the duration (in seconds) for which the animation has been running
    • interpolate

      protected static double interpolate(double aStart, double aTarget, double aFraction)
      Interpolates linearly between the two given values.
      Parameters:
      aStart - the first value
      aTarget - the second value
      aFraction - the difference between the first value and the interpolated value relative to the difference between the first and the second value
      Returns:
      the linearly interpolated value
    • getDuration

      public double getDuration()
      Description copied from interface: ILcdAnimation
      Returns the duration of this animation in seconds.

      The duration of this animation should be a strictly positive finite value.

      Specified by:
      getDuration in interface ILcdAnimation
      Returns:
      the duration of this animation in seconds
    • isLoop

      public boolean isLoop()
      Description copied from interface: ILcdAnimation
      If true, ALcdAnimationManager will play this animation repeatedly until it is explicitly terminated. Each successive playback will be surrounded with a call to ILcdAnimation.start() and ILcdAnimation.stop().
      Specified by:
      isLoop in interface ILcdAnimation
      Returns:
      true if the animation should repeat, false if it should play once and then terminate
    • restart

      public void restart()
      Description copied from interface: ILcdAnimation
      Called by ALcdAnimationManager when this animation is looped and needs to start a new loop.
      Specified by:
      restart in interface ILcdAnimation
    • start

      public void start()
      Description copied from interface: ILcdAnimation
      Called by ALcdAnimationManager when this animation is added to the manager and needs to starts playing.
      Specified by:
      start in interface ILcdAnimation
    • stop

      public void stop()
      Description copied from interface: ILcdAnimation
      Called by ALcdAnimationManager when this animation is removed from the manager and needs to stops playing.
      Specified by:
      stop in interface ILcdAnimation