public class RandomLinearFloatValueAnimator extends Object implements ValueAnimator<Float>
ValueAnimator
that continuously animates between
randomly selected values in a range. Once the stop value
has been reached, the animator chooses a new random target
value.
Each animation between values is linear and has a fixed
duration.Constructor and Description |
---|
RandomLinearFloatValueAnimator(float min,
float max,
int duration)
Construct a
RandomLinearFloatValueAnimator with the given
range and duration for each sub-animation. |
RandomLinearFloatValueAnimator(float min,
float max,
int duration,
float initial)
Construct a
RandomLinearFloatValueAnimator with the given
range, duration for each sub-animation and fixed initial value. |
RandomLinearFloatValueAnimator(int startWait,
int stopWait,
float min,
float max,
int duration)
Construct a
RandomLinearFloatValueAnimator with the given
range and duration for each sub-animation. |
RandomLinearFloatValueAnimator(int startWait,
int stopWait,
float min,
float max,
int duration,
float initial)
Construct a
RandomLinearFloatValueAnimator with the given
range, duration for each sub-animation and fixed initial value. |
Modifier and Type | Method and Description |
---|---|
boolean |
hasFinished()
Has the animator finished animating the value.
|
Float |
nextValue()
Get the next value.
|
void |
reset()
Reset the animator back to its initial condition.
|
protected void |
setNextAnimator(float v1) |
public RandomLinearFloatValueAnimator(float min, float max, int duration)
RandomLinearFloatValueAnimator
with the given
range and duration for each sub-animation.min
- minimum allowed valuemax
- maximum allowed valueduration
- duration between valuespublic RandomLinearFloatValueAnimator(float min, float max, int duration, float initial)
RandomLinearFloatValueAnimator
with the given
range, duration for each sub-animation and fixed initial value.min
- minimum allowed valuemax
- maximum allowed valueduration
- duration between valuesinitial
- initial starting valuepublic RandomLinearFloatValueAnimator(int startWait, int stopWait, float min, float max, int duration)
RandomLinearFloatValueAnimator
with the given
range and duration for each sub-animation.
The sub-animations will start after startWait ticks, and
finish stopWait ticks after startWait+duration.startWait
- amount of time in ticks to wait before starting animation.stopWait
- amount of time in ticks to wait after finishing animation.min
- minimum allowed valuemax
- maximum allowed valueduration
- duration between valuespublic RandomLinearFloatValueAnimator(int startWait, int stopWait, float min, float max, int duration, float initial)
RandomLinearFloatValueAnimator
with the given
range, duration for each sub-animation and fixed initial value.
The sub-animations will start after startWait ticks, and
finish stopWait ticks after startWait+duration.startWait
- amount of time in ticks to wait before starting animation.stopWait
- amount of time in ticks to wait after finishing animation.min
- minimum allowed valuemax
- maximum allowed valueduration
- duration between valuesinitial
- initial starting valuepublic Float nextValue()
ValueAnimator
nextValue
in interface ValueAnimator<Float>
public boolean hasFinished()
ValueAnimator
hasFinished
in interface ValueAnimator<Float>
public void reset()
ValueAnimator
reset
in interface ValueAnimator<Float>
protected void setNextAnimator(float v1)