Package foundry.veil.api.client.ui.util
Class PoseStackAnimator
java.lang.Object
foundry.veil.api.client.ui.util.PoseStackAnimator
A utility class to manage and apply animations to a
PoseStack
.
Animations are defined as a sequence of PoseStackAnimator.AnimationStage
s, each with a duration and a transformation function.-
Constructor Summary
ConstructorDescriptionPoseStackAnimator
(com.mojang.blaze3d.vertex.PoseStack poseStack) Constructs a newPoseStackAnimator
for the givenPoseStack
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addStage
(long durationMillis, BiConsumer<Long, com.mojang.blaze3d.vertex.PoseStack> transform) Adds a new animation stage to the sequence.boolean
Checks if the animation is currently active.void
Resets the animation, stopping it and clearing any defined stages.void
Starts the animation sequence.void
Advances the animation based on the elapsed time.
-
Constructor Details
-
PoseStackAnimator
public PoseStackAnimator(com.mojang.blaze3d.vertex.PoseStack poseStack) Constructs a newPoseStackAnimator
for the givenPoseStack
.- Parameters:
poseStack
- ThePoseStack
to animate.
-
-
Method Details
-
addStage
public void addStage(long durationMillis, BiConsumer<Long, com.mojang.blaze3d.vertex.PoseStack> transform) Adds a new animation stage to the sequence.- Parameters:
durationMillis
- The duration of the stage in milliseconds.transform
- The transformation function to apply during this stage. This function receives thePoseStack
as an argument, allowing you to directly modify its transformations.
-
startAnimation
public void startAnimation()Starts the animation sequence. -
tickAnimation
public void tickAnimation()Advances the animation based on the elapsed time. Call this method once per frame to update the animation. -
isAnimating
public boolean isAnimating()Checks if the animation is currently active.- Returns:
- True if the animation is running, false otherwise.
-
resetAnimation
public void resetAnimation()Resets the animation, stopping it and clearing any defined stages.
-