public class Smoother extends java.lang.Object implements Tickable
Constructor and Description |
---|
Smoother(float smoothness)
Creates a smoother with the given smoothness.
|
Smoother(float smoothness,
float start)
Creates a smoother with the given smoothness and start value.
|
Modifier and Type | Method and Description |
---|---|
float |
getTarget()
Reports the target value aimed at by this smoother at a rate determined by the smoothness.
|
float |
getValue()
Reports the current value of the smoother.
|
void |
setSmoothness(float smoothness)
Sets the smoothness value that determines the rate of transition towards a target.
|
void |
setTarget(float target)
Sets the target value aimed at by the smoother.
|
void |
setValue(float x)
Move the smoother to the given target value immediately regardless of the smoothness value.
|
void |
tick()
Advances the time used by the smoother to move towards its target.
|
public Smoother(float smoothness)
smoothness
- The smoothness of the transition towards a target. It is scaled between
0 and 1. A value of 0 has abrupt changes, 1 is very smooth. A value of
0.9 gives nice workable smoothness for typical animations.public Smoother(float smoothness, float start)
smoothness
- The smoothness of the transition towards a target. It is scaled between
0 and 1. A value of 0 has abrupt changes, 1 is very smooth. A value of
0.9 gives nice workable smoothness for typical animations.start
- Start value that will move towards a target.public final void setSmoothness(float smoothness)
setSmoothness
in interface Tickable
smoothness
- The smoothness of the transition towards a target. It is scaled between
0 and 1. A value of 0 has abrupt changes, 1 is very smooth. A value of
0.9 gives nice workable smoothness for typical animations.public final void tick()
public final void setTarget(float target)
target
- Target value aimed at by the smoother.public final float getTarget()
public void setValue(float x)
x
- New target value to jump to.public final float getValue()
tick()
has been called.