Add animation to checkbox when joning/leaving a channel

This commit is contained in:
Dean Herbert
2022-03-10 15:49:18 +09:00
parent 0155519343
commit 1a187d4dec

View File

@ -81,9 +81,9 @@ namespace osu.Game.Overlays.Chat.Listing
{ {
checkbox = new SpriteIcon checkbox = new SpriteIcon
{ {
Anchor = Anchor.CentreLeft, Alpha = 0,
Origin = Anchor.CentreLeft, Anchor = Anchor.Centre,
Margin = new MarginPadding { Left = 15 }, Origin = Anchor.Centre,
Icon = FontAwesome.Solid.Check, Icon = FontAwesome.Solid.Check,
Size = new Vector2(icon_size), Size = new Vector2(icon_size),
}, },
@ -134,15 +134,19 @@ namespace osu.Game.Overlays.Chat.Listing
channelJoined = channel.Joined.GetBoundCopy(); channelJoined = channel.Joined.GetBoundCopy();
channelJoined.BindValueChanged(change => channelJoined.BindValueChanged(change =>
{ {
const double duration = 500;
if (change.NewValue) if (change.NewValue)
{ {
checkbox.Show(); checkbox.FadeIn(duration, Easing.OutQuint);
checkbox.ScaleTo(1f, duration, Easing.OutElastic);
channelText.Colour = Colour4.White; channelText.Colour = Colour4.White;
topicText.Colour = Colour4.White; topicText.Colour = Colour4.White;
} }
else else
{ {
checkbox.Hide(); checkbox.FadeOut(duration, Easing.OutQuint);
checkbox.ScaleTo(0.8f, duration, Easing.OutQuint);
channelText.Colour = colourProvider.Light3; channelText.Colour = colourProvider.Light3;
topicText.Colour = colourProvider.Content2; topicText.Colour = colourProvider.Content2;
} }
@ -159,7 +163,7 @@ namespace osu.Game.Overlays.Chat.Listing
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
hoverBox.Hide(); hoverBox.FadeOut(300, Easing.OutQuint);
base.OnHoverLost(e); base.OnHoverLost(e);
} }
} }