mirror of
https://github.com/Motschen/Blur.git
synced 2025-12-17 12:15:10 +01:00
Add easing option to fade animation (#48)
* Add easing option to fade animation * Fix German translation
This commit is contained in:
@@ -46,6 +46,7 @@ public class Blur implements ClientModInitializer {
|
||||
}
|
||||
|
||||
private boolean doFade = false;
|
||||
|
||||
public void onScreenChange(Screen newGui) {
|
||||
if (MinecraftClient.getInstance().world != null) {
|
||||
boolean excluded = newGui == null || BlurConfig.blurExclusions.stream().anyMatch(exclusion -> newGui.getClass().getName().contains(exclusion));
|
||||
@@ -64,7 +65,9 @@ public class Blur implements ClientModInitializer {
|
||||
}
|
||||
|
||||
private float getProgress() {
|
||||
return Math.min((System.currentTimeMillis() - start) / (float) BlurConfig.fadeTimeMillis, 1);
|
||||
float x = Math.min((System.currentTimeMillis() - start) / (float) BlurConfig.fadeTimeMillis, 1);
|
||||
if (BlurConfig.ease) x *= (2 - x); // easeOutCubic
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getBackgroundColor(boolean second) {
|
||||
|
||||
@@ -10,6 +10,8 @@ public class BlurConfig extends MidnightConfig {
|
||||
public static List<String> blurExclusions = Blur.defaultExclusions;
|
||||
@Entry(min = 0, max = 5000, width = 4)
|
||||
public static int fadeTimeMillis = 200;
|
||||
@Entry
|
||||
public static boolean ease = true;
|
||||
@Entry(min = 0, max = 500, width = 3)
|
||||
public static int radius = 8;
|
||||
@Entry(isColor = true, width = 7, min = 7)
|
||||
|
||||
Reference in New Issue
Block a user