CurveProperty holds the easing curves in the order Animation.getCurve takes them, replacing three copies of the list in zoom, freelook and the animation config; it's saved the same way. Its dropdown opens a CurveOptions popup: a CurvePreview graph beside the list, with a dot running along the hovered curve, or the current one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
83 lines
2.9 KiB
Java
83 lines
2.9 KiB
Java
package org.saturnclient.config;
|
|
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import org.saturnclient.config.property.CurveProperty;
|
|
import org.saturnclient.config.property.IntProperty;
|
|
import org.saturnclient.config.property.Property;
|
|
|
|
public class AnimationConfig {
|
|
public static ConfigManager config;
|
|
|
|
// Logo
|
|
public static final AnimationConfig logo = new AnimationConfig(true, 700, 0);
|
|
|
|
// Main menu
|
|
public static final AnimationConfig mainMenu = new AnimationConfig(true, 700, 120);
|
|
|
|
// Mod menu
|
|
public static final AnimationConfig modMenu = new AnimationConfig(true, 700, 20);
|
|
|
|
// Shift menu
|
|
public static final AnimationConfig shiftMenu = new AnimationConfig(true, 700, 100);
|
|
|
|
// Cosmetics menu
|
|
public static final AnimationConfig cosmeticsMenu = new AnimationConfig(true, 700, 40);
|
|
|
|
// Emote wheel
|
|
public static final AnimationConfig emoteWheel = new AnimationConfig(true, 700, 40);
|
|
|
|
/** Every menu's animation, in the order they're shown in the settings */
|
|
public static final List<AnimationConfig> ALL = List.of(logo, mainMenu, modMenu, shiftMenu, cosmeticsMenu,
|
|
emoteWheel);
|
|
|
|
public static void init(ConfigManager parent) {
|
|
config = new ConfigManager(parent, "Animations");
|
|
|
|
logo.init("Logo");
|
|
mainMenu.init("Main Menu");
|
|
modMenu.init("Mod Menu");
|
|
shiftMenu.init("Shift Menu");
|
|
cosmeticsMenu.init("Cosmetics Menu");
|
|
emoteWheel.init("Emote Wheel");
|
|
}
|
|
|
|
// Animation properties
|
|
public final IntProperty duration;
|
|
public final IntProperty stagger;
|
|
public final CurveProperty curve;
|
|
|
|
public AnimationConfig(boolean enabled, int delay, int stagger) {
|
|
this.duration = Property.integer(delay).range(0, 2000, 50).unit("ms");
|
|
this.stagger = Property.integer(stagger).range(0, 300, 10).unit("ms");
|
|
this.curve = Property.curve(1);
|
|
}
|
|
|
|
/** The menu this animates, like "Mod Menu" */
|
|
public String name;
|
|
|
|
/**
|
|
* This animation's settings under short names ("Duration"), for showing
|
|
* them grouped under {@link #name}. They're saved under longer names
|
|
* ("Mod Menu Duration"), which stay as they are so saved settings keep
|
|
* loading.
|
|
*/
|
|
public Map<String, Property> getProperties() {
|
|
Map<String, Property> properties = new LinkedHashMap<>();
|
|
properties.put("Duration", duration);
|
|
properties.put("Stagger", stagger);
|
|
properties.put("Curve", curve);
|
|
return properties;
|
|
}
|
|
|
|
public void init(String name) {
|
|
this.name = name;
|
|
// config.property("Enable " + name + " Animations", this.enabled);
|
|
config.property(name + " Duration", this.duration, "How long the animation takes");
|
|
config.property(name + " Stagger", this.stagger, "Delay between items appearing one after another");
|
|
config.property(name + " Curve", this.curve, "Easing of the animation");
|
|
}
|
|
}
|