public class Smoother2D extends java.lang.Object implements Tickable
| Constructor and Description |
|---|
Smoother2D(float smoothness)
Creates a 2D smoother with the given smoothness.
|
Smoother2D(float startX,
float startY,
float smoothness)
Creates a 2D smoother with the given smoothness and start values.
|
| Modifier and Type | Method and Description |
|---|---|
float |
getX()
Reports the current x value of the smoother.
|
float |
getXTarget()
Reports the target x value aimed at by this smoother at a rate determined by the smoothness.
|
float |
getY()
Reports the current y value of the smoother.
|
float |
getYTarget()
Reports the target y value aimed at by this smoother at a rate determined by the smoothness.
|
void |
setSmoothness(float smoothness)
Sets the smoothness value that determines the rate of transition towards a target.
|
void |
setTarget(float targetX,
float targetY)
Sets the target values aimed at by the smoother.
|
void |
setValue(float valueX,
float valueY)
Move the smoother to the given values immediately regardless of the smoothness value.
|
void |
setX(float valueX)
Move the smoother to the given x value immediately regardless of the smoothness value.
|
void |
setXTarget(float targetX)
Sets the target x value aimed at by the smoother.
|
void |
setY(float valueY)
Move the smoother to the given y value immediately regardless of the smoothness value.
|
void |
setYTarget(float targetY)
Sets the target y value aimed at by the smoother.
|
void |
tick()
Advances the time used by the smoother to move towards its targets.
|
float |
x()
Deprecated.
Consider using
getX() instead for standard accessor naming. |
float |
y()
Deprecated.
Consider using
getY() instead for standard accessor naming. |
public Smoother2D(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 Smoother2D(float startX,
float startY,
float smoothness)
startX - Initial x value that will move towards a target.startY - Initial y value that will move towards a target.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 setSmoothness(float smoothness)
setSmoothness in interface Tickablesmoothness - 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 setValue(float valueX,
float valueY)
valueX - New x target value to jump to.valueY - New y target value to jump to.public final void setX(float valueX)
valueX - New x target value to jump to.public final void setY(float valueY)
valueY - New y target value to jump to.public final void setTarget(float targetX,
float targetY)
targetX - X target value aimed at by the smoother.targetY - Y target value aimed at by the smoother.public final void setXTarget(float targetX)
targetX - X target value aimed at by the smoother.public final void setYTarget(float targetY)
targetY - Y target value aimed at by the smoother.public final float getXTarget()
public final float getYTarget()
@Deprecated public final float x()
getX() instead for standard accessor naming.tick() has been called.public final float getX()
tick() has been called.@Deprecated public final float y()
getY() instead for standard accessor naming.tick() has been called.public final float getY()
tick() has been called.