T - The type of value producedpublic abstract class TimeBasedValueAnimator<T> extends Object implements ValueAnimator<T>
Subclasses must implement a method that can return a value based on an absolute percentage value. This class will convert the time each nextValue() is called into a percentage value between the start and end times and use that to calculate the absolute value of the animator.
| Modifier and Type | Field and Description |
|---|---|
protected T |
endValue
The end/target value of the animation
|
protected T |
startValue
The start value of the animation
|
| Constructor and Description |
|---|
TimeBasedValueAnimator(T initial,
T end,
long millis) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
calculateValue(double pc)
Given a percentage value (0 < pc <=1), the method should return a value
for the animation.
|
boolean |
hasFinished()
A implementation sugar for
isComplete()
Has the animator finished animating the value. |
boolean |
isComplete()
Returns whether the animator has completed
|
T |
nextValue()
Get the next value.
|
void |
reset()
Reset the animator back to its initial condition.
|
protected T startValue
public TimeBasedValueAnimator(T initial, T end, long millis)
initial - The start value for the animatorend - The end value for the animatormillis - The length of time the animation should runprotected abstract T calculateValue(double pc)
pc - the percentage valuepublic T nextValue()
nextValue in interface ValueAnimator<T>ValueAnimator.nextValue()public void reset()
reset in interface ValueAnimator<T>ValueAnimator.reset()public boolean isComplete()
public boolean hasFinished()
isComplete()
Has the animator finished animating the value.hasFinished in interface ValueAnimator<T>ValueAnimator.hasFinished()