Skip to content

Commit cece6b5

Browse files
committed
reset the animation in AnimatedButton and AnimatedMask
1 parent d0eadf0 commit cece6b5

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

button/src/main/java/io/github/projectunified/craftux/button/AnimatedButton.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ public void setMode(AnimationMode mode) {
5151
this.mode = mode;
5252
}
5353

54+
/**
55+
* Reset the animation for the unique id
56+
*
57+
* @param uuid the unique id
58+
*/
59+
public void reset(UUID uuid) {
60+
Animation<Button> animation = animationMap.get(uuid);
61+
if (animation != null) {
62+
animation.reset();
63+
}
64+
}
65+
5466
private Animation<Button> getAnimation(UUID uuid) {
5567
return animationMap.computeIfAbsent(uuid, key -> new Animation<>(buttons, periodMillis, mode));
5668
}

mask/src/main/java/io/github/projectunified/craftux/mask/AnimatedMask.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ public void setMode(AnimationMode mode) {
5555
this.mode = mode;
5656
}
5757

58+
/**
59+
* Reset the animation for the unique id
60+
*
61+
* @param uuid the unique id
62+
*/
63+
public void reset(UUID uuid) {
64+
Animation<Mask> animation = animationMap.get(uuid);
65+
if (animation != null) {
66+
animation.reset();
67+
}
68+
}
69+
5870
private Animation<Mask> getAnimation(@NotNull UUID uuid) {
5971
return animationMap.computeIfAbsent(uuid, k -> new Animation<>(elements, periodMillis, mode));
6072
}

0 commit comments

Comments
 (0)