fix: update dependencies

This commit is contained in:
TopchetoEU 2023-04-16 03:51:27 +03:00
parent b1895f04bb
commit 6984a7e154

View File

@ -1,39 +0,0 @@
package me.topchetoeu.keystrokes.engine;
public class Fadeout {
public float slope;
public float duration;
private boolean near(float f) {
return near(slope, f);
}
private boolean near(float a, float b) {
return Math.abs(a - b) < 0.001f;
}
public float calculate(float delta) {
if (delta > duration) return 0;
if (near(0)) return 1;
if (near(1)) return 1 - delta / duration;
if (near(2)) return 1 - (float)Math.sqrt(delta / duration);
float pow = 1 / slope;
if (near(pow, Math.round(pow))) {
float a = delta / duration;
float b = 1;
for (int i = 0; i < pow; i++) b *= a;
return 1 - b;
}
return 1 - (float)Math.pow(delta / duration, pow);
}
public Fadeout(float slope, float duration) {
this.slope = slope;
this.duration = duration;
}
}