From 2b5ee7d8b8d570858cf73c784d7c2270b74c78ba Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 25 Dec 2016 16:22:09 +0100 Subject: [PATCH] middle ease animation for sbv2 --- .../opsu/ui/animations/AnimationEquation.java | 7 +++++++ src/yugecin/opsudance/sbv2/MoveStoryboard.java | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/itdelatrisu/opsu/ui/animations/AnimationEquation.java b/src/itdelatrisu/opsu/ui/animations/AnimationEquation.java index 3953b436..0ef9f5ac 100644 --- a/src/itdelatrisu/opsu/ui/animations/AnimationEquation.java +++ b/src/itdelatrisu/opsu/ui/animations/AnimationEquation.java @@ -294,6 +294,13 @@ public enum AnimationEquation { return -0.5f * ((float) Math.pow(2, 10 * t) * (float) Math.sin((t - period / 4) * (Math.PI * 2) / period)); return (float) Math.pow(2, -10 * t) * (float) Math.sin((t - period / 4) * (Math.PI * 2) / period) * 0.5f + 1; } + }, + IN_OUT_EASE_MIDDLE { + @Override + public float calc(float t) { + float ct = 1f - t; + return 3f * ct * ct * t * 0.6f + 3 * ct * t * t * 0.4f + t * t * t * 1f; + } }; /** Overshoot constant for "back" easings. */ diff --git a/src/yugecin/opsudance/sbv2/MoveStoryboard.java b/src/yugecin/opsudance/sbv2/MoveStoryboard.java index 4f6df0b8..cbf2c3e7 100644 --- a/src/yugecin/opsudance/sbv2/MoveStoryboard.java +++ b/src/yugecin/opsudance/sbv2/MoveStoryboard.java @@ -41,7 +41,7 @@ public class MoveStoryboard { private final SimpleButton btnAddCubic; private final SimpleButton btnAnimLin; - private final SimpleButton btnAnimCir; + private final SimpleButton btnAnimMid; private final SimpleButton btnAnimCub; private final StoryboardMove dummyMove; @@ -61,7 +61,7 @@ public class MoveStoryboard { btnAddQuadratic = new SimpleButton(width - 205, 80, 200, 25, Fonts.SMALL, "add quadratic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON); btnAddCubic = new SimpleButton(width - 205, 110, 200, 25, Fonts.SMALL, "add cubic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON); btnAnimLin = new SimpleButton(width - 250, 50, 40, 25, Fonts.SMALL, "lin", Color.blue, Color.white, Color.white, Color.orange); - btnAnimCir = new SimpleButton(width - 250, 80, 40, 25, Fonts.SMALL, "cir", Color.blue, Color.white, Color.white, Color.orange); + btnAnimMid = new SimpleButton(width - 250, 80, 40, 25, Fonts.SMALL, "cir", Color.blue, Color.white, Color.white, Color.orange); btnAnimCub = new SimpleButton(width - 250, 110, 40, 25, Fonts.SMALL, "cub", Color.blue, Color.white, Color.white, Color.orange); dummyMove = (StoryboardMove) Proxy.newProxyInstance(StoryboardMove.class.getClassLoader(), new Class[]{StoryboardMove.class}, new InvocationHandler() { @Override @@ -93,7 +93,7 @@ public class MoveStoryboard { btnAddQuadratic.render(g); btnAddCubic.render(g); btnAnimLin.render(g); - btnAnimCir.render(g); + btnAnimMid.render(g); btnAnimCub.render(g); if (moves[objectIndex] != null && objectIndex > 0 && trackPosition >= gameObjects[objectIndex - 1].getEndTime() && trackPosition < gameObjects[objectIndex].getTime()) { moves[objectIndex].render(g); @@ -128,11 +128,11 @@ public class MoveStoryboard { if (btnAnimLin.isHovered()) { getCurrentMoveOrDummy().setAnimationEquation(AnimationEquation.LINEAR); } - if (btnAnimCir.isHovered()) { + if (btnAnimMid.isHovered()) { getCurrentMoveOrDummy().setAnimationEquation(AnimationEquation.IN_OUT_CIRC); } if (btnAnimCub.isHovered()) { - getCurrentMoveOrDummy().setAnimationEquation(AnimationEquation.IN_OUT_CUBIC); + getCurrentMoveOrDummy().setAnimationEquation(AnimationEquation.IN_OUT_EASE_MIDDLE); } } @@ -159,7 +159,7 @@ public class MoveStoryboard { btnAddQuadratic.update(x, y); btnAddCubic.update(x, y); btnAnimLin.update(x, y); - btnAnimCir.update(x, y); + btnAnimMid.update(x, y); btnAnimCub.update(x, y); if (moves[objectIndex] != null) { moves[objectIndex].update(delta, x, y);