Package com.jgoodies.animation
Class AnimationFunctions.InterpolatedAnimationFunction<T>
- java.lang.Object
-
- com.jgoodies.animation.AbstractAnimationFunction<T>
-
- com.jgoodies.animation.AnimationFunctions.InterpolatedAnimationFunction<T>
-
- All Implemented Interfaces:
AnimationFunction<T>
- Enclosing class:
- AnimationFunctions
private static final class AnimationFunctions.InterpolatedAnimationFunction<T> extends AbstractAnimationFunction<T>
Helper class for interpolation based animation functions.
-
-
Field Summary
Fields Modifier and Type Field Description private float[]
keyTimes
private AnimationFunctions.InterpolationMode
mode
private T[]
values
-
Constructor Summary
Constructors Modifier Constructor Description private
InterpolatedAnimationFunction(long duration, T[] values, float[] keyTimes, AnimationFunctions.InterpolationMode mode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
checkValidKeyTimes(int valuesLength, float[] theKeyTimes)
private T
discreteValueAt(long time)
private int
indexAt(long time, int intervalCount)
private T
interpolateLinear(T value1, T value2, long time, long duration)
Currently we provide only linear interpolations that are based on floats.private T
linearValueAt(long time)
T
valueAt(long time)
Returns the function value at a given time in the valid time interval.-
Methods inherited from class com.jgoodies.animation.AbstractAnimationFunction
checkTimeRange, duration
-
-
-
-
Field Detail
-
keyTimes
private final float[] keyTimes
-
mode
private final AnimationFunctions.InterpolationMode mode
-
values
private final T[] values
-
-
Constructor Detail
-
InterpolatedAnimationFunction
private InterpolatedAnimationFunction(long duration, T[] values, float[] keyTimes, AnimationFunctions.InterpolationMode mode)
-
-
Method Detail
-
checkValidKeyTimes
private static void checkValidKeyTimes(int valuesLength, float[] theKeyTimes)
-
discreteValueAt
private T discreteValueAt(long time)
-
indexAt
private int indexAt(long time, int intervalCount)
-
interpolateLinear
private T interpolateLinear(T value1, T value2, long time, long duration)
Currently we provide only linear interpolations that are based on floats.- Parameters:
value1
- the first interpolation key pointvalue2
- the second interpolation key pointtime
- the time to get an interpolated value forduration
- the duration of the whole animation- Returns:
- the interpolated value at the given time
-
linearValueAt
private T linearValueAt(long time)
-
valueAt
public T valueAt(long time)
Description copied from interface:AnimationFunction
Returns the function value at a given time in the valid time interval. The value is undefined for times outside this function's time interval. An implementation may throw an exception, if this method called with a time outside the time interval.- Parameters:
time
- the time used to determine the animation effect- Returns:
- the function value at the given time
-
-