aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-08-24 22:51:58 +0200
committerGitHub <noreply@github.com>2022-08-24 22:51:58 +0200
commitdaed9569a0f1d2231c4f824f6cffd72d5f8ae8bd (patch)
tree6efee702c616d96e40a3e69ce89425f0936a7598 /src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java
parenta76b49be6dbeb0be3f88870e33d3e10e0e7f8e1c (diff)
downloadOneConfig-daed9569a0f1d2231c4f824f6cffd72d5f8ae8bd.tar.gz
OneConfig-daed9569a0f1d2231c4f824f6cffd72d5f8ae8bd.tar.bz2
OneConfig-daed9569a0f1d2231c4f824f6cffd72d5f8ae8bd.zip
Notifs (#111)
* Start on notifications * Finish notifications (pog) * oop * internalizing * misc: set default duration to 4000ms * Scaling notifs stuff Co-authored-by: Wyvest <45589059+Wyvest@users.noreply.github.com>
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java
index ca9bc17..62cbed7 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java
@@ -26,23 +26,56 @@
package cc.polyfrost.oneconfig.gui.animations;
+import java.util.concurrent.Callable;
+
public class DummyAnimation extends Animation {
protected final float value;
+ protected Callable<Boolean> done = null;
/**
* @param value The value that is returned
+ * @param done A callable that returns if the animation is finished
*/
- public DummyAnimation(float value) {
- super(value, value, value, false);
+ public DummyAnimation(float value, Callable<Boolean> done) {
+ super(0, value, value, false);
+ this.value = value;
+ this.done = done;
+ }
+
+ /**
+ * @param value The value that is returned
+ * @param duration The duration of the animation
+ */
+ public DummyAnimation(float value, float duration) {
+ super(duration, value, value, false);
this.value = value;
}
+ /**
+ * @param value The value that is returned
+ */
+ public DummyAnimation(float value) {
+ this(value, 0);
+ }
+
@Override
public float get(float deltaTime) {
+ timePassed += deltaTime;
return value;
}
@Override
+ public boolean isFinished() {
+ if (done != null) {
+ try {
+ return done.call();
+ } catch (Exception ignored) {
+ }
+ }
+ return super.isFinished();
+ }
+
+ @Override
protected float animate(float x) {
return x;
}