Adding more implementations and fixes
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package org.saturnclient.ui.anim;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.saturnclient.config.AnimationConfig;
|
||||
import org.saturnclient.ui.Element;
|
||||
|
||||
public abstract class Animation {
|
||||
public int duration;
|
||||
public int delay = 0;
|
||||
public Function<Double, Double> curve = Curve::easeInOutCubic;
|
||||
|
||||
Animation(AnimationConfig config) {
|
||||
this.duration = config.duration.value;
|
||||
switch (config.curve.value) {
|
||||
case 0:
|
||||
this.curve = Curve::easeInOutCubic;
|
||||
break;
|
||||
case 1:
|
||||
this.curve = Curve::easeOutCubic;
|
||||
break;
|
||||
case 2:
|
||||
this.curve = Curve::easeInOutBack;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Animation(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public abstract void tick(double progress, Element element);
|
||||
|
||||
public abstract void init(Element element);
|
||||
}
|
||||
Reference in New Issue
Block a user