middle ease animation for sbv2
This commit is contained in:
parent
66b174523b
commit
2b5ee7d8b8
|
@ -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. */
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user