Class ForwardLooper

java.lang.Object
org.vanted.animation.loopers.Looper
org.vanted.animation.loopers.ForwardLooper

public class ForwardLooper
extends Looper
Similar to a StandardLooper but allows interpolators to interpolate from the end of the animation to the start of the animation.
Note: This looper should only be used with that are continuous. Use a StandardLooper for animations that do not have a continuous element. (continuous animations usually inherit from ContinousAnimation.
Note: A ForwardLooper should only be used if the animation's loopDuration is longer than the largest time value in the animation's set of data points.
Author:
- Patrick Shaw
  • Constructor Details

    • ForwardLooper

      public ForwardLooper()
  • Method Details

    • getNormalizedTime

      public <V,​ T extends InterpolatableTimePoint<V>> double getNormalizedTime​(double time, double loopDuration, List<T> dataPoints, List<T> pointsUsed, T previousPoint, T nextPoint)
      Description copied from class: Looper
      Calculates how far the time is from the next data point as a percentage.
      Eg. If there are 4 points with times: 3,6,7,9 and time = 6.5 then this method will return 0.5 because 6.5-6/7-6 = 0.5
      Overrides:
      getNormalizedTime in class Looper
      Type Parameters:
      V - The type of data value that the data point holds.
      T - The type of data point that the interpolator is interpolating for.
      Parameters:
      time - The time has elapsed since the start of the animation.
      loopDuration - How long each loop takes in milliseconds
      dataPoints - All the dataPoints that the interpolator needs to interpolate between
      pointsUsed - The points being used for the interpolation.
      Returns:
      A value between 0 and 1.