Update OsuButton hover animation to better suit immediacy of sound effects

This commit is contained in:
Dean Herbert 2022-11-04 18:50:42 +09:00
parent eb836269e7
commit 8b58475ee0

View File

@ -4,7 +4,6 @@
#nullable disable #nullable disable
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -95,7 +94,7 @@ namespace osu.Game.Graphics.UserInterface
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.White.Opacity(.1f), Colour = Color4.White,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
Depth = float.MinValue Depth = float.MinValue
}, },
@ -126,7 +125,7 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnClick(ClickEvent e) protected override bool OnClick(ClickEvent e)
{ {
if (Enabled.Value) if (Enabled.Value)
Background.FlashColour(BackgroundColour.Lighten(0.4f), 200); Background.FlashColour(Color4.White, 800, Easing.OutQuint);
return base.OnClick(e); return base.OnClick(e);
} }
@ -134,7 +133,11 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
if (Enabled.Value) if (Enabled.Value)
Hover.FadeIn(200, Easing.OutQuint); {
Hover.FadeTo(0.2f, 40, Easing.OutQuint)
.Then()
.FadeTo(0.1f, 800, Easing.OutQuint);
}
return base.OnHover(e); return base.OnHover(e);
} }
@ -143,7 +146,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
base.OnHoverLost(e); base.OnHoverLost(e);
Hover.FadeOut(300); Hover.FadeOut(800, Easing.OutQuint);
} }
protected override bool OnMouseDown(MouseDownEvent e) protected override bool OnMouseDown(MouseDownEvent e)