mirror of
https://github.com/ppy/osu.git
synced 2025-03-18 02:37:44 +08:00
Improve transition of toolbar when hovering.
This commit is contained in:
parent
476168eec2
commit
d65a275e32
@ -30,9 +30,14 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private ToolbarModeSelector modeSelector;
|
private ToolbarModeSelector modeSelector;
|
||||||
private ToolbarButton userButton;
|
private ToolbarButton userButton;
|
||||||
|
private Box solidBackground;
|
||||||
private Box gradientBackground;
|
private Box gradientBackground;
|
||||||
|
|
||||||
private const int transition_time = 200;
|
private const int transition_time = 250;
|
||||||
|
|
||||||
|
private const float alpha_hovering = 0.8f;
|
||||||
|
private const float alpha_normal = 0.6f;
|
||||||
|
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
@ -48,23 +53,26 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
{
|
{
|
||||||
gradientBackground.FadeIn(200);
|
solidBackground.FadeTo(alpha_hovering, transition_time, EasingTypes.OutQuint);
|
||||||
|
gradientBackground.FadeIn(transition_time, EasingTypes.OutQuint);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(InputState state)
|
protected override void OnHoverLost(InputState state)
|
||||||
{
|
{
|
||||||
gradientBackground.FadeOut(200);
|
solidBackground.FadeTo(alpha_normal, transition_time, EasingTypes.OutQuint);
|
||||||
|
gradientBackground.FadeOut(transition_time, EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Toolbar()
|
public Toolbar()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
solidBackground = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.6f)
|
Colour = new Color4(0.1f, 0.1f, 0.1f, 1),
|
||||||
|
Alpha = alpha_normal,
|
||||||
},
|
},
|
||||||
gradientBackground = new Box
|
gradientBackground = new Box
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user