diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-04 16:57:41 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-04 16:57:41 +0200 |
commit | 140ffd89293cdad8963d1fc80db382dc5681229f (patch) | |
tree | b611edd6a7faac0a7f6f3b1895fa33571b6de0cf /src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutCubic.java | |
parent | 07f04270648ae1e38e4f411898f38b0f067dd308 (diff) | |
download | OneConfig-140ffd89293cdad8963d1fc80db382dc5681229f.tar.gz OneConfig-140ffd89293cdad8963d1fc80db382dc5681229f.tar.bz2 OneConfig-140ffd89293cdad8963d1fc80db382dc5681229f.zip |
animation
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutCubic.java')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutCubic.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutCubic.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutCubic.java new file mode 100644 index 0000000..760f369 --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutCubic.java @@ -0,0 +1,23 @@ +package cc.polyfrost.oneconfig.gui.animations; + +public class EaseInOutCubic extends Animation { + + /** + * @param duration The duration of the animation + * @param start The start of the animation + * @param end The end of the animation + * @param reverse Reverse the animation + */ + public EaseInOutCubic(int duration, float start, float end, boolean reverse) { + super(duration, start, end, reverse); + } + + /** + * Adapted from <a href="https://github.com/jesusgollonet/processing-penner-easing">https://github.com/jesusgollonet/processing-penner-easing</a> + */ + @Override + protected float animate(float timePassed, float duration, float start, float change) { + if ((timePassed /= duration / 2) < 1) return change / 2 * timePassed * timePassed * timePassed + start; + return change / 2 * ((timePassed -= 2) * timePassed * timePassed + 2) + start; + } +} |