aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/utils/MathUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/utils/MathUtils.java')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/utils/MathUtils.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/utils/MathUtils.java b/src/main/java/io/polyfrost/oneconfig/utils/MathUtils.java
index 547e286..dc70eea 100644
--- a/src/main/java/io/polyfrost/oneconfig/utils/MathUtils.java
+++ b/src/main/java/io/polyfrost/oneconfig/utils/MathUtils.java
@@ -5,13 +5,6 @@ public class MathUtils {
return number < (float) 0.0 ? (float) 0.0 : Math.min(number, (float) 1.0);
}
- public static float easeOut(float current, float goal) {
- if (Math.floor(Math.abs(goal - current) / (float) 0.01) > 0) {
- return current + (goal - current) / (float) 100.0;
- } else {
- return goal;
- }
- }
public static float easeOut(float current, float goal, float speed) {
if (Math.floor(Math.abs(goal - current) / (float) 0.01) > 0) {
return current + (goal - current) / speed;
@@ -21,4 +14,15 @@ public class MathUtils {
}
+ public static float easeInQuad(float current) {
+ return current * current;
+ }
+
+ /** 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) {
+ 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;
+ }
+
+
}