From a5ec40e505207841162ab406f60ec46985db7235 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Mon, 16 May 2022 17:31:30 +0200 Subject: deltatime things --- src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main/java/cc/polyfrost/oneconfig/utils') diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java index e30c227..e10679a 100644 --- a/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java +++ b/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java @@ -1,5 +1,7 @@ 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); @@ -10,8 +12,8 @@ public class MathUtils { } public static float easeOut(float current, float goal, float speed) { - if (Math.round(Math.abs(goal - current) * 25) > 0) { - return current + (goal - current) / speed; + if (Math.round(Math.abs(goal - current) * 100) > 0) { + return current + (goal - current) / speed * (OneConfigGui.INSTANCE == null ? 17 : OneConfigGui.INSTANCE.getDeltaTime()); } else { return goal; } @@ -25,6 +27,7 @@ public class MathUtils { * taken from https://github.com/jesusgollonet/processing-penner-easing */ public static float easeInOutCirc(float t, float b, float c, float d) { + c *= OneConfigGui.INSTANCE == null ? 17 : OneConfigGui.INSTANCE.getDeltaTime(); 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; } -- cgit