Package org.vanted.animation.loopers
Class SwingLooper
java.lang.Object
org.vanted.animation.loopers.Looper
org.vanted.animation.loopers.SwingLooper
public class SwingLooper extends Looper
Reverses the animation after it goes forward. (Reverses when the loop number
is an odd number)
TODO: The SwingLooper only behaves properly for loop durations that are longer than the largest time value in the animation's data point list.
TODO: The SwingLooper only behaves properly for loop durations that are longer than the largest time value in the animation's data point list.
- Author:
- - Patrick Shaw
-
Constructor Summary
Constructors Constructor Description SwingLooper()
-
Method Summary
Modifier and Type Method Description <V, T extends TimePoint<V>>
intfindPreviousIndex(List<T> dataPoints, int oldPreviousIndex, int currentLoopNumber, double time)
(Provided this method is not overridden) Finds the largest index, from a set of data points, who's getTime() method is <= time.<V, T extends TimePoint<V>>
intgetNextLoopPreviousIndex(List<T> dataPoints, int newLoopNumber)
Specifies what the previousIndex animation should be set to when it starts a new loop.double
getTimeSinceStartOfLoop(int currentLoopNumber, double startTime, double loopDuration, double time)
Calculates the time since the start of the loopMethods inherited from class org.vanted.animation.loopers.Looper
getNormalizedTime, getPointIndexes, getPointsUsed
-
Constructor Details
-
SwingLooper
public SwingLooper()
-
-
Method Details
-
findPreviousIndex
public <V, T extends TimePoint<V>> int findPreviousIndex(List<T> dataPoints, int oldPreviousIndex, int currentLoopNumber, double time)Description copied from class:Looper
(Provided this method is not overridden) Finds the largest index, from a set of data points, who's getTime() method is <= time.- Overrides:
findPreviousIndex
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:
dataPoints
- The set of data points that the interpolator is interpolating onoldPreviousIndex
- The old index that was being used before this method was calledcurrentLoopNumber
- The current loop number of the animationtime
- The time that has elapsed since the start of the animation loop.- Returns:
- The largest index from a set of data points, who's getTime() return value is <= time.
- See Also:
TimePoint.getTime()
-
getTimeSinceStartOfLoop
public double getTimeSinceStartOfLoop(int currentLoopNumber, double startTime, double loopDuration, double time)Description copied from class:Looper
Calculates the time since the start of the loop- Overrides:
getTimeSinceStartOfLoop
in classLooper
- Parameters:
currentLoopNumber
- The animation's loop number.- Returns:
- The time since the start of the animation's current loop.
-
getNextLoopPreviousIndex
public <V, T extends TimePoint<V>> int getNextLoopPreviousIndex(List<T> dataPoints, int newLoopNumber)Description copied from class:Looper
Specifies what the previousIndex animation should be set to when it starts a new loop.- Overrides:
getNextLoopPreviousIndex
in classLooper
- Parameters:
dataPoints
- The set of data points that the interpolator is interpolating on.newLoopNumber
- The animation's new loop number.- Returns:
- The new previousIndex value of the Animation.
-