32 lines
727 B
Java
32 lines
727 B
Java
package speiger.src.coreengine.math.smooth;
|
|
|
|
public class SmoothFloat
|
|
{
|
|
protected float value;
|
|
protected float target;
|
|
protected float agility;
|
|
|
|
public SmoothFloat(float agility)
|
|
{
|
|
this.agility = agility;
|
|
}
|
|
|
|
public SmoothFloat(float value, float agility)
|
|
{
|
|
this.value = value;
|
|
target = value;
|
|
this.agility = agility;
|
|
}
|
|
|
|
public boolean isDone(){return Math.abs(target - value) <= 0.5F;}
|
|
public void update(float delta){value += (target - value) * agility * delta;}
|
|
|
|
public void setTarget(float value){target = value;}
|
|
public void addTarget(float value){target += value;}
|
|
|
|
public void forceFinish(){value = target;}
|
|
|
|
public float getValue(){return value;}
|
|
public float getTarget(){return target;}
|
|
}
|