Class AnimatedButton
java.lang.Object
io.github.projectunified.craftux.button.MultiButton
io.github.projectunified.craftux.button.AnimatedButton
A button that cycles through a list of buttons as animation frames over time.
Each frame is displayed for a configurable period, creating an animated effect.
Example usage:
AnimatedButton animatedButton = new AnimatedButton();
animatedButton.addButton(
new SimpleButton(new ItemStack(Material.DIAMOND)),
new SimpleButton(new ItemStack(Material.EMERALD))
);
animatedButton.setPeriodMillis(100); // 100ms per frame
-
Field Summary
Fields inherited from class io.github.projectunified.craftux.button.MultiButton
buttons -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(@NotNull UUID uuid, @NotNull ActionItem actionItem) Apply actions to the action itemvoidsetMode(AnimationMode mode) Set the mode of the animationvoidsetPeriodMillis(long periodMillis) Sets the period of the animation between frame changes.voidstop()Stop the element.Methods inherited from class io.github.projectunified.craftux.button.MultiButton
addButton, addButton, getButtons, init
-
Constructor Details
-
AnimatedButton
public AnimatedButton()
-
-
Method Details
-
setPeriodMillis
public void setPeriodMillis(long periodMillis) Sets the period of the animation between frame changes.- Parameters:
periodMillis- the period in milliseconds- Throws:
IllegalArgumentException- if periodMillis is not positive
-
setMode
Set the mode of the animation- Parameters:
mode- the mode of the animation
-
stop
public void stop()Description copied from interface:ElementStop the element. Should be called after removing from the GUI.- Specified by:
stopin interfaceElement- Overrides:
stopin classMultiButton
-
apply
Description copied from interface:ButtonApply actions to the action item- Parameters:
uuid- the uuid of the playeractionItem- the action item- Returns:
- true if any action was applied. Can return false in a conditional case (e.g. predicate button)
-