diff options
author | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-06-01 18:03:12 +0100 |
---|---|---|
committer | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-06-01 18:03:12 +0100 |
commit | edcd817d9d6b2493ee76a15d12f21696a99a2d34 (patch) | |
tree | d1056ebe7abdff4c5f91a4b129c0d6a5684a8b77 /src/main/java/cc/polyfrost/oneconfig/utils | |
parent | 68cc66b387a8a6a226289132dea331e6ecf3f76b (diff) | |
parent | 53494fad20feed812735b36dea31c6b0656bb104 (diff) | |
download | OneConfig-edcd817d9d6b2493ee76a15d12f21696a99a2d34.tar.gz OneConfig-edcd817d9d6b2493ee76a15d12f21696a99a2d34.tar.bz2 OneConfig-edcd817d9d6b2493ee76a15d12f21696a99a2d34.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/utils')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/utils/MathUtils.java | 18 |
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) { |