|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gicentre.utils.network.traer.animation.Smoother2D
public class Smoother2D
A 2D smoother for transitions towards a target over time at a rate determined by its smoothness. 2D smoothers are useful for 2D animation where two values must be transitioned together.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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.Method Detail |
---|
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()
tick
in interface Tickable
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()
public final float x()
getX()
instead for standard accessor naming.
tick()
has been called.
public final float getX()
tick()
has been called.
public final float y()
getY()
instead for standard accessor naming.
tick()
has been called.
public final float getY()
tick()
has been called.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |