Added easing functions for all-around better animations.
These are Robert Penner's easing functions (http://robertpenner.com/easing/), refactored by CharlotteGore to only take a t parameter (https://github.com/CharlotteGore/functional-easing). Licensed under BSD (the former) and MIT (the latter). Related changes: - Added "AnimatedValue" utility class for updating values used in animations. - MenuButton now uses AnimatedValue to handle its animations (still linear by default). - Added in-out-back easings on logo, mods, and various other elements; added out-bounce easings on button menu. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -239,6 +239,22 @@ public class Utils {
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clamps a value between a lower and upper bound.
|
||||
* @param val the value to clamp
|
||||
* @param low the lower bound
|
||||
* @param high the upper bound
|
||||
* @return the clamped value
|
||||
* @author fluddokt
|
||||
*/
|
||||
public static int clamp(int val, int low, int high) {
|
||||
if (val < low)
|
||||
return low;
|
||||
if (val > high)
|
||||
return high;
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clamps a value between a lower and upper bound.
|
||||
* @param val the value to clamp
|
||||
|
||||
Reference in New Issue
Block a user