diff options
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java index e10679a..e86061a 100644 --- a/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java +++ b/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java @@ -1,7 +1,5 @@ package cc.polyfrost.oneconfig.utils; -import cc.polyfrost.oneconfig.gui.OneConfigGui; - public class MathUtils { public static float clamp(float number) { return number < 0f ? 0f : Math.min(number, 1f); @@ -11,9 +9,9 @@ public class MathUtils { return number < min ? min : Math.min(number, max); } - public static float easeOut(float current, float goal, float speed) { + public static float easeOut(float current, float goal, float speed, float deltaTime) { if (Math.round(Math.abs(goal - current) * 100) > 0) { - return current + (goal - current) / speed * (OneConfigGui.INSTANCE == null ? 17 : OneConfigGui.INSTANCE.getDeltaTime()); + return current + (goal - current) / speed * deltaTime; } else { return goal; } @@ -26,8 +24,8 @@ public class MathUtils { /** * taken from <a href="https://github.com/jesusgollonet/processing-penner-easing">https://github.com/jesusgollonet/processing-penner-easing</a> */ - public static float easeInOutCirc(float t, float b, float c, float d) { - c *= OneConfigGui.INSTANCE == null ? 17 : OneConfigGui.INSTANCE.getDeltaTime(); + public static float easeInOutCirc(float t, float b, float c, float d, float deltaTime) { + c *= deltaTime; if ((t /= d / 2) < 1) return -c / 2 * ((float) Math.sqrt(1 - t * t) - 1) + b; return c / 2 * ((float) Math.sqrt(1 - (t -= 2) * t) + 1) + b; } |