Aller au contenu
galdurdocs

AnimatedValue

classclient uniquementdepuis 0.1.0

com.galdurstudio.galdurui.api.anim.AnimatedValue

Pas encore traduit : texte d’origine en anglais.

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
PAQUETapi.anim
CÔTÉclient uniquement
THREADthread client

Constructeurs 1

AnimatedValue

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

PARAMÈTRES

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

Méthodes 5

setTarget

public void setTarget(double target)

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

PARAMÈTRES

targetdouble—

snap

public void snap(double value)

Jumps to value without a transition.

PARAMÈTRES

valuedouble—

get

public double get()

RENVOIEdouble — the value to show now

getTarget

public double getTarget()

RENVOIEdouble — the value being moved towards

isRunning

public boolean isRunning()

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

© 2026 Galdur Studio · galdurstudio.com · Discord · LGPL-3.0-onlyProduit non officiel. Non approuvé par Mojang ou Microsoft, ni associé à eux.