AnimatedValue
classclient uniquementdepuis 0.1.0com.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.
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.
Constructeurs 1
AnimatedValue
PARAMÈTRES
Méthodes 5
setTarget
Changes the target; a transition starts from the current value unless it already is the target.
PARAMÈTRES
snap
Jumps to value without a transition.
PARAMÈTRES
get
RENVOIEdouble — the value to show now
getTarget
RENVOIEdouble — the value being moved towards
isRunning
RENVOIEboolean — true while the shown value has not reached the target