1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 20:07:25 +08:00

Update Nub hover animation to better suit immediacy of sound effects

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

View File

@ -27,9 +27,6 @@ namespace osu.Game.Graphics.UserInterface
private const float border_width = 3; private const float border_width = 3;
private const double animate_in_duration = 200;
private const double animate_out_duration = 500;
private readonly Box fill; private readonly Box fill;
private readonly Container main; private readonly Container main;
@ -72,7 +69,7 @@ namespace osu.Game.Graphics.UserInterface
Colour = GlowColour.Opacity(0), Colour = GlowColour.Opacity(0),
Type = EdgeEffectType.Glow, Type = EdgeEffectType.Glow,
Radius = 8, Radius = 8,
Roundness = 5, Roundness = 4,
}; };
} }
@ -94,13 +91,18 @@ namespace osu.Game.Graphics.UserInterface
if (value) if (value)
{ {
main.FadeColour(GlowingAccentColour, animate_in_duration, Easing.OutQuint); main.FadeColour(GlowingAccentColour.Lighten(0.5f), 40, Easing.OutQuint)
main.FadeEdgeEffectTo(0.2f, animate_in_duration, Easing.OutQuint); .Then()
.FadeColour(GlowingAccentColour, 800, Easing.OutQuint);
main.FadeEdgeEffectTo(Color4.White.Opacity(0.1f), 40, Easing.OutQuint)
.Then()
.FadeEdgeEffectTo(GlowColour.Opacity(0.1f), 800, Easing.OutQuint);
} }
else else
{ {
main.FadeEdgeEffectTo(0, animate_out_duration, Easing.OutQuint); main.FadeEdgeEffectTo(GlowColour.Opacity(0), 800, Easing.OutQuint);
main.FadeColour(AccentColour, animate_out_duration, Easing.OutQuint); main.FadeColour(AccentColour, 800, Easing.OutQuint);
} }
} }
} }
@ -163,14 +165,20 @@ namespace osu.Game.Graphics.UserInterface
private void onCurrentValueChanged(ValueChangedEvent<bool> filled) private void onCurrentValueChanged(ValueChangedEvent<bool> filled)
{ {
fill.FadeTo(filled.NewValue ? 1 : 0, 200, Easing.OutQuint); const double duration = 200;
fill.FadeTo(filled.NewValue ? 1 : 0, duration, Easing.OutQuint);
if (filled.NewValue) if (filled.NewValue)
main.ResizeWidthTo(1, animate_in_duration, Easing.OutElasticHalf); {
main.ResizeWidthTo(1, duration, Easing.OutElasticHalf);
main.TransformTo(nameof(BorderThickness), filled.NewValue ? 8.5f : border_width, duration, Easing.OutElasticHalf);
}
else else
main.ResizeWidthTo(0.9f, animate_out_duration, Easing.OutElastic); {
main.ResizeWidthTo(0.75f, duration, Easing.OutQuint);
main.TransformTo(nameof(BorderThickness), filled.NewValue ? 8.5f : border_width, 200, Easing.OutQuint); main.TransformTo(nameof(BorderThickness), border_width, duration, Easing.OutQuint);
}
} }
} }
} }