Package kr.toxicity.model.api.animation
Class AnimationStateHandler<T extends Timed>
java.lang.Object
kr.toxicity.model.api.animation.AnimationStateHandler<T>
- Type Parameters:
T- timed value
Animation state handler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnimation(@NotNull String name, @NotNull AnimationIterator<T> iterator, @NotNull AnimationModifier modifier, @NotNull Runnable removeTask) Adds animationGets after keyframeafterKeyframe(T defaultValue) Gets after keyframeGets before keyframebeforeKeyframe(T defaultValue) Gets before keyframefloatframe()Gets ticking frame of current keyframebooleanChecks this keyframe has been finishedfloatprogress()Gets the progress of current keyframevoidreplaceAnimation(@NotNull String name, @NotNull AnimationIterator<T> iterator, @NotNull AnimationModifier modifier) Replaces animation@Nullable RunningAnimationGets running animationbooleanstopAnimation(@NotNull String name) Remove animationbooleantick()Ticks this state handlerbooleanTicks this state handler
-
Constructor Details
-
AnimationStateHandler
public AnimationStateHandler()
-
-
Method Details
-
keyframeFinished
public boolean keyframeFinished()Checks this keyframe has been finished- Returns:
- finished
-
beforeKeyframe
Gets before keyframe- Returns:
- before keyframe
-
afterKeyframe
Gets after keyframe- Returns:
- after keyframe
-
beforeKeyframe
Gets before keyframe- Parameters:
defaultValue- default value- Returns:
- before keyframe
-
afterKeyframe
Gets after keyframe- Parameters:
defaultValue- default value- Returns:
- after keyframe
-
runningAnimation
Gets running animation- Returns:
- animation
-
tick
public boolean tick()Ticks this state handler- Returns:
- keyframe has been shifted or not
-
tick
Ticks this state handler- Parameters:
ifEmpty- callback if animator is empty- Returns:
- keyframe has been shifted or not
-
progress
public float progress()Gets the progress of current keyframe- Returns:
- progress
-
addAnimation
public void addAnimation(@NotNull @NotNull String name, @NotNull @NotNull AnimationIterator<T> iterator, @NotNull @NotNull AnimationModifier modifier, @NotNull @NotNull Runnable removeTask) Adds animation- Parameters:
name- nameiterator- iteratormodifier- modifierremoveTask- remove task
-
replaceAnimation
public void replaceAnimation(@NotNull @NotNull String name, @NotNull @NotNull AnimationIterator<T> iterator, @NotNull @NotNull AnimationModifier modifier) Replaces animation- Parameters:
name- nameiterator- iteratormodifier- modifier
-
stopAnimation
Remove animation- Parameters:
name- name- Returns:
- success
-
frame
public float frame()Gets ticking frame of current keyframe- Returns:
- ticking frame
-