Added download button animations

This commit is contained in:
DrabWeb 2017-05-19 19:02:53 -03:00
parent 649fc8362b
commit 6cc7602db1
1 changed files with 27 additions and 1 deletions

View File

@ -15,6 +15,7 @@
using osu.Framework.Localisation;
using osu.Framework.Graphics.Textures;
using System.Linq;
using osu.Framework.Input;
namespace osu.Game.Overlays.Direct
{
@ -153,12 +154,14 @@ private void load(LocalisationEngine localisation, TextureStore textures)
private class DownloadButton : ClickableContainer
{
private readonly TextAwesome icon;
//todo: proper download button animations
public DownloadButton()
{
Children = new Drawable[]
{
new TextAwesome
icon = new TextAwesome
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -168,6 +171,29 @@ public DownloadButton()
},
};
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
icon.ScaleTo(0.9f, 1000, EasingTypes.Out);
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
icon.ScaleTo(1f, 500, EasingTypes.OutElastic);
return base.OnMouseUp(state, args);
}
protected override bool OnHover(InputState state)
{
icon.ScaleTo(1.1f, 500, EasingTypes.OutElastic);
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
icon.ScaleTo(1, 500, EasingTypes.OutElastic);
}
}
}
}