Skip to content

AnimatedValue

classclient onlysince 0.1.0

com.galdurstudio.galdurui.api.anim.AnimatedValue

A number that moves from one value to another over a given time, along an easing curve (GaldurEasing).

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.

Example.java
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. Client thread only.

public final class AnimatedValue
PACKAGEapi.anim
SIDEclient only
THREADclient thread

Constructors 1

AnimatedValue

public AnimatedValue(double initial, long durationMs, DoubleUnaryOperator easing)

PARAMETERS

initialdoublestarting value, shown without animation
durationMslongduration of a transition, in milliseconds
easingDoubleUnaryOperatortransition curve, for example GaldurEasing.OUT_CUBIC

Methods 5

setTarget

public void setTarget(double target)

Changes the target; a transition starts from the current value unless it already is the target.

PARAMETERS

targetdouble—

snap

public void snap(double value)

Jumps to value without a transition.

PARAMETERS

valuedouble—

get

public double get()

RETURNSdouble — the value to show now

getTarget

public double getTarget()

RETURNSdouble — the value being moved towards

isRunning

public boolean isRunning()

RETURNSboolean — true while the shown value has not reached the target

© 2026 Galdur Studio · galdurstudio.com · Discord · LGPL-3.0-onlyNot an official Minecraft product. Not approved by or associated with Mojang or Microsoft.