main menu logo tweaks

Minor changes to the logo scale
Pulsing effect:
  let the ghost logo expand
  also animate the initial shrink
This commit is contained in:
yugecin 2018-06-26 21:49:41 +02:00
parent 11fd501a1e
commit 8d7b7ef567
No known key found for this signature in database
GPG Key ID: 2C5AC035A7068E44
3 changed files with 21 additions and 16 deletions

View File

@ -18,7 +18,6 @@
package itdelatrisu.opsu;
import itdelatrisu.opsu.ui.Colors;
import itdelatrisu.opsu.ui.Fonts;
import java.io.File;
@ -300,13 +299,13 @@ public enum GameImage {
MENU_LOGO ("logo2", "png", false, true) {
@Override
protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy(0.8f);
return img.getScaledCopy(0.75f);
}
},
MENU_LOGO_PIECE ("logo2piece2", "png", false, true) {
@Override
protected Image process_sub(Image img, int w, int h) {
return img.getScaledCopy(0.8f);
return img.getScaledCopy(0.75f);
}
},
MENU_PLAY ("menu-play2", "png", false, false) {

View File

@ -145,11 +145,11 @@ public class MainMenu extends BaseOpsuState {
logo.setHoverAnimationDuration(logoAnimationDuration);
playButton.setHoverAnimationDuration(logoAnimationDuration);
exitButton.setHoverAnimationDuration(logoAnimationDuration);
final AnimationEquation logoAnimationEquation = AnimationEquation.IN_OUT_BACK;
final AnimationEquation logoAnimationEquation = AnimationEquation.IN_OUT_EXPO;
logo.setHoverAnimationEquation(logoAnimationEquation);
playButton.setHoverAnimationEquation(logoAnimationEquation);
exitButton.setHoverAnimationEquation(logoAnimationEquation);
final float logoHoverScale = 1.08f;
final float logoHoverScale = 1.096f;
logo.setHoverExpand(logoHoverScale);
playButton.setHoverExpand(logoHoverScale);
exitButton.setHoverExpand(logoHoverScale);
@ -265,15 +265,21 @@ public class MainMenu extends BaseOpsuState {
boolean renderPiece = position != null;
if (position == null) {
position = System.currentTimeMillis() % 1000 / 1000f;
if (position < 0.05f) {
position = 1f - AnimationEquation.IN_CUBIC.calc(position / 0.05f);
} else {
position = (position - 0.05f) / 0.95f;
}
}
float scale = 1f + position * 0.05f;
logo.draw(color, scale);
logo.draw(color, 0.9726f + position * 0.0274f);
final float hoverScale = logo.getCurrentHoverExpandValue();
if (renderPiece) {
Image piece = GameImage.MENU_LOGO_PIECE.getImage().getScaledCopy(logo.getLastScale());
Image piece = GameImage.MENU_LOGO_PIECE.getImage();
piece = piece.getScaledCopy(hoverScale);
piece.rotate(position * 360);
piece.drawCentered(logo.getX(), logo.getY(), color);
}
float ghostScale = logo.getLastScale() / scale * 1.05f;
final float ghostScale = hoverScale * 1.0186f - position * 0.0186f;
Image ghostLogo = GameImage.MENU_LOGO.getImage().getScaledCopy(ghostScale);
ghostLogo.setAlpha(0.25f);
ghostLogo.drawCentered(logo.getX(), logo.getY(), color);

View File

@ -98,9 +98,6 @@ public class MenuButton {
/** The default max rotation angle of the button. */
private static final float DEFAULT_ANGLE_MAX = 30f;
/** The last scale at which the button was drawn. */
private float lastScale = 1f;
/**
* Creates a new button from an Image.
* @param img the image
@ -170,9 +167,14 @@ public class MenuButton {
public float getY() { return y; }
/**
* Returns the last scale at which the button was drawn.
* Returns the scale multiplier, from the hover effect, used to draw the button.
*/
public float getLastScale() { return lastScale; }
public float getCurrentHoverExpandValue() {
if ((hoverEffect & EFFECT_EXPAND) == 0) {
return 1f;
}
return scale.getValue();
}
/**
* Sets text to draw in the middle of the button.
@ -229,7 +231,6 @@ public class MenuButton {
xScaleOffset = image.getWidth() / 2f - xRadius;
yScaleOffset = image.getHeight() / 2f - yRadius;
}
lastScale = scaleOverride;
if (hoverEffect == 0)
image.draw(x - xRadius, y - yRadius, filter);
else {
@ -243,7 +244,6 @@ public class MenuButton {
xScaleOffset = image.getWidth() / 2f - xRadius;
yScaleOffset = image.getHeight() / 2f - yRadius;
}
lastScale *= scale.getValue();
}
}
if ((hoverEffect & EFFECT_FADE) > 0)