aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/utils/MathUtils.java
blob: e2e51841dd941757426dd6f784b68d1f753ee2d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package io.polyfrost.oneconfig.utils;

public class MathUtils {
    public static float clamp(float number) {
        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) 20.0;
        } else {
            return goal;
        }
    }
}