You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
894 B
50 lines
894 B
package mightypork.utils.time;
|
|
|
|
|
|
import mightypork.utils.math.Calc;
|
|
import mightypork.utils.math.Calc.Rad;
|
|
import mightypork.utils.math.easing.Easing;
|
|
|
|
|
|
/**
|
|
* Radians animator
|
|
*
|
|
* @author MightyPork
|
|
*/
|
|
public class AnimDoubleRad extends AnimDouble {
|
|
|
|
public AnimDoubleRad(AnimDouble other) {
|
|
super(other);
|
|
}
|
|
|
|
|
|
public AnimDoubleRad(double value) {
|
|
super(value);
|
|
}
|
|
|
|
|
|
public AnimDoubleRad(double value, Easing easing) {
|
|
super(value, easing);
|
|
}
|
|
|
|
|
|
@Override
|
|
public double getCurrentValue()
|
|
{
|
|
if (duration == 0) return Rad.norm(to);
|
|
return Calc.interpolateRad(from, to, (elapsedTime / duration), easing);
|
|
}
|
|
|
|
|
|
@Override
|
|
protected double getProgressFromValue(double value)
|
|
{
|
|
double whole = Rad.diff(from, to);
|
|
if (Rad.diff(value, from) < whole && Rad.diff(value, to) < whole) {
|
|
double partial = Rad.diff(from, value);
|
|
return partial / whole;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
|