aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-01 18:40:47 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-01 18:40:47 +0200
commitb72b3dca39631a995b422e0b3495e8d3618e91d8 (patch)
treeda3f0655c57c66b94922e10f59792ea6ebfb4648 /src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java
parentd109fac644fb9be7424f35fa24eb0ad32331e799 (diff)
downloadOneConfig-b72b3dca39631a995b422e0b3495e8d3618e91d8.tar.gz
OneConfig-b72b3dca39631a995b422e0b3495e8d3618e91d8.tar.bz2
OneConfig-b72b3dca39631a995b422e0b3495e8d3618e91d8.zip
temp
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java
index 79634da..c4beb82 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java
@@ -25,21 +25,11 @@ public final class MathUtils {
}
/**
- * taken from <a href="https://github.com/jesusgollonet/processing-penner-easing">https://github.com/jesusgollonet/processing-penner-easing</a>
+ * Adapted 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 ? 16 : 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;
- }
-
- /**
- * taken from <a href="https://github.com/jesusgollonet/processing-penner-easing">https://github.com/jesusgollonet/processing-penner-easing</a>
- */
- public static float easeInOutQuad(float t, float b, float c, float d) {
- c *= OneConfigGui.INSTANCE == null ? 16 : OneConfigGui.INSTANCE.getDeltaTime();
- if ((t /= d / 2) < 1) return c / 2 * t * t + b;
- return -c / 2 * ((--t) * (t - 2) - 1) + b;
+ public static float easeInOutCirc(float time, float beginning, float change, float duration) {
+ if ((time /= duration / 2) < 1) return -change / 2 * ((float) Math.sqrt(1 - time * time) - 1) + beginning;
+ return change / 2 * ((float) Math.sqrt(1 - (time -= 2) * time) + 1) + beginning;
}
public static float map(float value, float start1, float stop1, float start2, float stop2) {