diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-04 13:36:46 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-04 13:36:46 +0200 |
commit | a4d135ebb02c6fea87c8f9275a8a07338999d84b (patch) | |
tree | a8bafe2e44307255e9c9eef14a9baf6d26e37c73 /src/main/java/cc/polyfrost/oneconfig/gui/animations | |
parent | 07741d92fa6ea636b8292bb35706c25e5e6a72cc (diff) | |
download | OneConfig-a4d135ebb02c6fea87c8f9275a8a07338999d84b.tar.gz OneConfig-a4d135ebb02c6fea87c8f9275a8a07338999d84b.tar.bz2 OneConfig-a4d135ebb02c6fea87c8f9275a8a07338999d84b.zip |
OC-66 done
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/animations')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java | 3 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInQuartReversed.java | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java index 39130f0..a9ef863 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java @@ -1,6 +1,7 @@ package cc.polyfrost.oneconfig.gui.animations; import cc.polyfrost.oneconfig.utils.color.ColorPalette; +import cc.polyfrost.oneconfig.utils.color.ColorUtils; public class ColorAnimation { private ColorPalette palette; @@ -33,7 +34,6 @@ public class ColorAnimation { blueAnimation = new EaseInOutQuad(100, blueAnimation.get(), newColors[2], false); alphaAnimation = new EaseInOutQuad(100, alphaAnimation.get(), newColors[3], false); prevState = state; - return ((int) (alphaAnimation.get(0) * 255) << 24) | ((int) (redAnimation.get(0) * 255) << 16) | ((int) (greenAnimation.get(0) * 255) << 8) | ((int) (blueAnimation.get(0) * 255)); } return ((int) (alphaAnimation.get() * 255) << 24) | ((int) (redAnimation.get() * 255) << 16) | ((int) (greenAnimation.get() * 255) << 8) | ((int) (blueAnimation.get() * 255)); } @@ -43,6 +43,7 @@ public class ColorAnimation { } public void setPalette(ColorPalette palette) { + if (this.palette.equals(palette)) return; this.palette = palette; prevState = 3; } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInQuartReversed.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInQuartReversed.java index 9e77714..10bf354 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInQuartReversed.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInQuartReversed.java @@ -14,7 +14,8 @@ public class EaseInQuartReversed extends Animation { @Override protected float animate(float timePassed, float duration, float start, float change) { float x = timePassed / duration; - if (x < 0.5f) return (float) (16 * Math.pow(x, 4) * change + start); - return (float) (Math.pow(2 * x - 2, 4) * change + start); + if (x < 0.25f) return (float) (128 * Math.pow(x, 4) * change + start); + if (x < 0.75f) return (float) ((-128 * Math.pow(x - 0.5, 4) + 1) * change + start); + return (float) (128 * Math.pow(x - 1, 4) * change + start); } } |