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
870 B
50 lines
870 B
11 years ago
|
package mightypork.utils.math.animation;
|
||
11 years ago
|
|
||
11 years ago
|
|
||
11 years ago
|
import mightypork.utils.math.Calc;
|
||
11 years ago
|
import mightypork.utils.math.Calc.Deg;
|
||
11 years ago
|
|
||
|
|
||
|
/**
|
||
11 years ago
|
* Degree animator
|
||
11 years ago
|
*
|
||
|
* @author MightyPork
|
||
|
*/
|
||
|
public class AnimDoubleDeg extends AnimDouble {
|
||
11 years ago
|
|
||
11 years ago
|
public AnimDoubleDeg(AnimDouble other) {
|
||
|
super(other);
|
||
|
}
|
||
11 years ago
|
|
||
|
|
||
11 years ago
|
public AnimDoubleDeg(double value) {
|
||
|
super(value);
|
||
|
}
|
||
11 years ago
|
|
||
|
|
||
11 years ago
|
public AnimDoubleDeg(double value, Easing easing) {
|
||
|
super(value, easing);
|
||
11 years ago
|
}
|
||
11 years ago
|
|
||
|
|
||
11 years ago
|
@Override
|
||
|
public double getCurrentValue()
|
||
|
{
|
||
11 years ago
|
if (duration == 0) return Deg.norm(to);
|
||
|
return Calc.interpolateDeg(from, to, (elapsedTime / duration), easing);
|
||
11 years ago
|
}
|
||
11 years ago
|
|
||
|
|
||
11 years ago
|
@Override
|
||
11 years ago
|
protected double getProgressFromValue(double value)
|
||
11 years ago
|
{
|
||
11 years ago
|
double whole = Deg.diff(from, to);
|
||
|
if (Deg.diff(value, from) < whole && Deg.diff(value, to) < whole) {
|
||
|
double partial = Deg.diff(from, value);
|
||
|
return partial / whole;
|
||
|
}
|
||
11 years ago
|
|
||
11 years ago
|
return 0;
|
||
11 years ago
|
}
|
||
|
}
|