From cd37ebdff239623d21c8637259e4c467feec23c6 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 15 Mar 2017 13:57:41 -0300 Subject: [PATCH] Fading --- .../Select/Leaderboards/Leaderboard.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 66327c0cbc..16e811f868 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -3,7 +3,10 @@ using System.Collections.Generic; using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Game.Modes; @@ -51,6 +54,22 @@ namespace osu.Game.Screens.Select.Leaderboards } } + protected override void Update() + { + base.Update(); + + foreach (var s in scrollFlow.Children) + { + var topY = scrollContainer.ScrollContent.DrawPosition.Y + s.DrawPosition.Y; + var bottomY = topY + 70; + var fadeStart = scrollContainer.DrawHeight - 10; + fadeStart += scrollContainer.IsScrolledToEnd() ? 70 : 0; + + s.ColourInfo = ColourInfo.GradientVertical(Color4.White.Opacity(System.Math.Min((fadeStart - topY) / 70, 1)), + Color4.White.Opacity(System.Math.Min((fadeStart - bottomY) / 70, 1))); + } + } + public Leaderboard() { Children = new Drawable[]