Package org.vanted.animation.loopers
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.
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 Summary
Constructors Constructor Description ForwardLooper()
-
Method Summary
Modifier and Type Method Description <V, T extends InterpolatableTimePoint<V>>
doublegetNormalizedTime(double time, double loopDuration, List<T> dataPoints, List<T> pointsUsed, T previousPoint, T nextPoint)
Calculates how far thetime
is from the next data point as a percentage.Methods inherited from class org.vanted.animation.loopers.Looper
findPreviousIndex, getNextLoopPreviousIndex, getPointIndexes, getPointsUsed, getTimeSinceStartOfLoop
-
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 thetime
is from the next data point as a percentage.
Eg. If there are 4 points with times: 3,6,7,9 andtime
= 6.5 then this method will return 0.5 because 6.5-6/7-6 = 0.5- Overrides:
getNormalizedTime
in classLooper
- 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 millisecondsdataPoints
- All the dataPoints that the interpolator needs to interpolate betweenpointsUsed
- The points being used for the interpolation.- Returns:
- A value between 0 and 1.
-