Class Animation<T extends TimePoint>

java.lang.Object
org.vanted.animation.Animation<T>
Direct Known Subclasses:
ContinuousAnimation, LabelTextAnimation, VisibilityAnimation

public abstract class Animation<T extends TimePoint>
extends Object
The Animation class represents DISCRETE Animation. This class DOES NOT have an interpolator. To use an interpolator, inherit from the ContinousAnimation class.
Author:
- Patrick Shaw
  • Constructor Summary

    Constructors
    Constructor Description
    Animation​(Attributable attributable, List<T> dataPoints, double loopDuration)
    Creates an animation with a StandardLooper, infinite loops and starts immediately
    Animation​(Attributable attributable, List<T> dataPoints, double loopDuration, double startTime)
    Creates an animation with a StandardLooper that loops forever
    Animation​(Attributable attributable, List<T> dataPoints, double loopDuration, double startTime, int noLoops)
    Creates an animation with a StandardLooper
    Animation​(Attributable attributable, List<T> dataPoints, double loopDuration, double startTime, int noLoops, Looper looper)
    Creates an animation
  • Method Summary

    Modifier and Type Method Description
    double getEndTime()  
    double getLoopDuration()
    Get's the loop duration of the animation.
    double getStartTime()  
    boolean isFinished​(double time)  
    void reset()
    Should be called whenever an animation wants to be restarted.
    void setDataPoints​(List<T> dataPoints)  
    void setLoopDuration​(double duration)
    Sets the duration of a loop.
    void setLoopDuration​(long duration, TimeUnit timeUnit)
    Sets the duration of a loop.
    void setLoopDuration​(LoopDuration duration)
    Sets the duration of a loop.
    void setLooper​(Looper looper)
    Sets the looper of the animation: How the animation handles looping.
    void setNoLoops​(int noLoops)
    Sets the number of times that the animation will perform the animation before stopping.
    void setNoLoops​(NumberOfLoops noLoops)
    Sets the number of times that the animation will perform the animation before stopping.
    void setStartTime​(double startTime)
    Sets the time at which the Animation object will begin its animation
    void setStartTime​(long startTime, TimeUnit timeUnit)
    Sets the time at which the Animation object will begin its animation.
    void update​(double time, boolean animatorFinished)
    Modifies a particular attribute in a node relative to the time elapsed.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Animation

      public Animation​(Attributable attributable, List<T> dataPoints, double loopDuration, double startTime, int noLoops, Looper looper)
      Creates an animation
      Parameters:
      attributable - The attributable to be animated.
      dataPoints - The data points that the animation reads data values from to perform the animation.
      loopDuration - The duration of a loop in milliseconds
      NOTE: If the loopDuration value is smaller than the largest time value of a data point, the animation will stop abruptly.
      startTime - The time at which this animation will start in milliseconds.
      looper - Specifies how the animation handles loops
    • Animation

      public Animation​(Attributable attributable, List<T> dataPoints, double loopDuration, double startTime, int noLoops)
      Creates an animation with a StandardLooper
      Parameters:
      attributable - The attributable to be animated.
      dataPoints - The data points that the animation reads data values from to perform the animation.
      loopDuration - The duration of a loop in milliseconds
      NOTE: If the loopDuration value is smaller than the largest time value of a data point, the animation will stop abruptly.
      startTime - The time at which this animation will start in milliseconds.
    • Animation

      public Animation​(Attributable attributable, List<T> dataPoints, double loopDuration, double startTime)
      Creates an animation with a StandardLooper that loops forever
      Parameters:
      attributable - The attributable to be animated.
      dataPoints - The data points that the animation reads data values from to perform the animation.
      loopDuration - The duration of a loop in milliseconds
      NOTE: If the loopDuration value is smaller than the largest time value of a data point, the animation will stop abruptly.
      startTime - The time at which this animation will start in milliseconds.
    • Animation

      public Animation​(Attributable attributable, List<T> dataPoints, double loopDuration)
      Creates an animation with a StandardLooper, infinite loops and starts immediately
      Parameters:
      attributable - The attributable to be animated.
      dataPoints - The data points that the animation reads data values from to perform the animation.
      loopDuration - The duration of a loop in milliseconds
      NOTE: If the loopDuration value is smaller than the largest time value of a data point, the animation will stop abruptly.
  • Method Details

    • setLoopDuration

      public void setLoopDuration​(double duration)
      Sets the duration of a loop.
      Parameters:
      duration - The loop duration in milliseconds.
    • setLoopDuration

      public void setLoopDuration​(LoopDuration duration)
      Sets the duration of a loop.
    • setLoopDuration

      public void setLoopDuration​(long duration, TimeUnit timeUnit)
      Sets the duration of a loop.
      Parameters:
      duration - The time magnitude.
      The - unit of time being used.
    • getLoopDuration

      public double getLoopDuration()
      Get's the loop duration of the animation.
      Returns:
      The duration of the loop in milliseconds.
    • setNoLoops

      public void setNoLoops​(int noLoops)
      Sets the number of times that the animation will perform the animation before stopping.
      Parameters:
      noLoops - -1 = Loop forever
      0 = The Animation object will not do anything.
      1 = The Animation object will perform the animation twice.
      2 = The Animation object will perform the animation three times.
    • setNoLoops

      public void setNoLoops​(NumberOfLoops noLoops)
      Sets the number of times that the animation will perform the animation before stopping.
    • getEndTime

      public double getEndTime()
      Returns:
      The time at which the animation will stop animating all together.
    • setLooper

      public void setLooper​(Looper looper)
      Sets the looper of the animation: How the animation handles looping.
      Parameters:
      looper - A looper
    • setDataPoints

      public void setDataPoints​(List<T> dataPoints)
      Parameters:
      dataPoints - The set of data points that the animation will use to animate with
    • setStartTime

      public void setStartTime​(double startTime)
      Sets the time at which the Animation object will begin its animation
      Parameters:
      startTime - The time at which the animation starts in milliseconds
    • setStartTime

      public void setStartTime​(long startTime, TimeUnit timeUnit)
      Sets the time at which the Animation object will begin its animation.
      Parameters:
      startTime - The magnitude of the time.
      timeUnit - The unit of time.
    • getStartTime

      public double getStartTime()
      Returns:
    • isFinished

      public boolean isFinished​(double time)
      Parameters:
      time - The time since the start of the loop.
      Returns:
      Whether the animation is finished animating all together.
    • update

      public void update​(double time, boolean animatorFinished)
      Modifies a particular attribute in a node relative to the time elapsed.
      Parameters:
      time - The amount of time that has elapsed so far.
    • reset

      public void reset()
      Should be called whenever an animation wants to be restarted.