Animations
Short, quiet animations that make screens feel alive, and a setting that lets players turn them all off. Your own widgets can use the same tools.
What moves
- Hover fades on buttons and tabs.
- A checkbox mark that grows and shrinks.
- Windows and menu screens that rise slightly on open.
- Tab content sliding in from its side.
- Smooth list scrolling.
Durations are short, between 90 and 180 ms, with the curves of GaldurEasing.
| Constant | Duration | Used for |
|---|---|---|
HOVER_MS | 90 ms | Hover fade (buttons, tabs) |
TOGGLE_MS | 110 ms | Checkbox mark |
PAGE_MS | 160 ms | Tab content sliding in |
OPEN_MS | 180 ms | Screen opening |
SCROLL_SMOOTHING_MS | 45 ms | Time constant of smooth scrolling |
These live in GaldurAnimations.
Players can turn them off
Mods → Galdur UI → Config → Animations, or config/galdurui-client.toml. Changes are then instant everywhere, including in your mod if you use the tools below.
Animate your own widgets
AnimatedValue is a number that moves to a target over a given time, along an easing curve. Set the target whenever you like, every frame for instance: a transition only starts when the target changes, and it starts from the value shown at that moment, so changing course midway never jumps.
private final AnimatedValue hover = new AnimatedValue(0, GaldurAnimations.HOVER_MS, GaldurEasing.OUT_QUAD);protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) { hover.setTarget(isHovered() ? 1 : 0); int color = mix(idle, hovered, hover.get()); ...}When the player turned animations off, get() returns the target directly. snap(value) jumps without a transition.
If you write an animation without AnimatedValue, check GaldurAnimations.enabled() first.
Easing curves
Every curve maps a linear progress t from 0 to 1, gives 0 at 0 and 1 at 1.
| Curve | Feel |
|---|---|
LINEAR | Constant speed. |
IN_QUAD | Starts slow, ends fast. |
OUT_QUAD | Starts fast, ends slow; subtler than OUT_CUBIC. |
IN_OUT_QUAD | Slow at both ends. |
OUT_CUBIC | Starts fast, lands softly: the default choice for UI. |
IN_OUT_CUBIC | Slow at both ends, stronger than IN_OUT_QUAD. |
OUT_BACK | Slightly overshoots the target before settling: a small bounce. |
double t = Math.min(1, elapsed / (double) durationMs);int y = (int) Math.round(from + (to - from) * GaldurEasing.OUT_CUBIC.applyAsDouble(t));