1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Add slight scale to icon buttons

This commit is contained in:
Dean Herbert 2021-11-19 15:27:51 +09:00
parent 741c27c1f2
commit 6e5918a100

View File

@ -54,14 +54,19 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
protected readonly SpriteIcon Icon; protected readonly SpriteIcon Icon;
private readonly Container content;
protected BeatmapCardIconButton() protected BeatmapCardIconButton()
{ {
Anchor = Origin = Anchor.Centre; Origin = Anchor.Centre;
Anchor = Anchor.Centre;
Child = new CircularContainer Child = content = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Masking = true, Masking = true,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Children = new Drawable[] Children = new Drawable[]
{ {
Icon = new SpriteIcon Icon = new SpriteIcon
@ -105,7 +110,10 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
private void updateState() private void updateState()
{ {
Content.FadeColour(IsHovered && Enabled.Value ? HoverColour : IdleColour, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint); bool isHovered = IsHovered && Enabled.Value;
content.ScaleTo(isHovered ? 1.2f : 1, 500, Easing.OutQuint);
content.FadeColour(isHovered ? HoverColour : IdleColour, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
} }
} }
} }