diff --git a/src/main/java/net/aoba/gui/components/widgets/AobaButtonWidget.java b/src/main/java/net/aoba/gui/components/widgets/AobaButtonWidget.java index 587a683..4a5ec8e 100644 --- a/src/main/java/net/aoba/gui/components/widgets/AobaButtonWidget.java +++ b/src/main/java/net/aoba/gui/components/widgets/AobaButtonWidget.java @@ -21,7 +21,7 @@ public class AobaButtonWidget extends PressableWidget { private Consumer pressAction; private long hoverStartTime = 0; - private static final long HOVER_ANIMATION_DURATION = 200; + private static final long HOVER_ANIMATION_DURATION = 200000000; public AobaButtonWidget(int x, int y, int width, int height, Text message) { super(x, y, width, height, message); @@ -44,12 +44,12 @@ protected void renderWidget(DrawContext context, int mouseX, int mouseY, float d Matrix4f matrix = context.getMatrices().peek().getPositionMatrix(); if (isHovered() && hoverStartTime == 0) { - hoverStartTime = System.currentTimeMillis(); + hoverStartTime = System.nanoTime(); } else if (!isHovered()) { hoverStartTime = 0; } - long currentTime = System.currentTimeMillis(); + long currentTime = System.nanoTime(); float hoverProgress = hoverStartTime > 0 ? (currentTime - hoverStartTime) / (float) HOVER_ANIMATION_DURATION : 0; hoverProgress = Math.min(hoverProgress, 1.0f); hoverProgress = (float) Math.sin(hoverProgress * Math.PI / 2); @@ -77,4 +77,4 @@ protected void appendClickableNarrations(NarrationMessageBuilder builder) { // For brevity, we'll just skip this for now - if you want to add narration to your widget, you can do so here. return; } -} \ No newline at end of file +}