Adjust animations to be much smoother

This commit is contained in:
Andrei Zavatski
2020-02-20 05:08:42 +03:00
parent a8c735b66d
commit 1935a14288

View File

@ -35,6 +35,7 @@ namespace osu.Game.Overlays
private SearchBeatmapSetsRequest getSetsRequest; private SearchBeatmapSetsRequest getSetsRequest;
private Container panelsPlaceholder; private Container panelsPlaceholder;
private Drawable currentContent;
private BeatmapListingSearchSection searchSection; private BeatmapListingSearchSection searchSection;
private BeatmapListingSortTabControl sortControl; private BeatmapListingSortTabControl sortControl;
@ -124,6 +125,8 @@ namespace osu.Game.Overlays
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeEasing = Easing.Out,
AutoSizeDuration = 200,
Padding = new MarginPadding { Horizontal = 20 }, Padding = new MarginPadding { Horizontal = 20 },
} }
} }
@ -180,7 +183,7 @@ namespace osu.Game.Overlays
previewTrackManager.StopAnyPlaying(this); previewTrackManager.StopAnyPlaying(this);
panelsPlaceholder.FadeColour(Color4.DimGray, 400, Easing.OutQuint); currentContent?.FadeColour(Color4.DimGray, 400, Easing.OutQuint);
getSetsRequest = new SearchBeatmapSetsRequest( getSetsRequest = new SearchBeatmapSetsRequest(
searchSection.Query.Value, searchSection.Query.Value,
@ -222,16 +225,15 @@ namespace osu.Game.Overlays
LoadComponentAsync(newPanels, loaded => LoadComponentAsync(newPanels, loaded =>
{ {
addContentToPlaceholder(loaded); addContentToPlaceholder(loaded);
loaded.FadeIn(600, Easing.OutQuint);
searchSection.BeatmapSet = beatmaps.First(); searchSection.BeatmapSet = beatmaps.First();
}); });
} }
private void addContentToPlaceholder(Drawable content) private void addContentToPlaceholder(Drawable content)
{ {
panelsPlaceholder.Clear(); currentContent?.FadeOut(100, Easing.OutQuint).Expire();
panelsPlaceholder.FadeColour(Color4.White); panelsPlaceholder.Add(currentContent = content);
panelsPlaceholder.Add(content); currentContent.FadeIn(200, Easing.OutQuint);
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)
@ -248,6 +250,7 @@ namespace osu.Game.Overlays
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = 250; Height = 250;
Alpha = 0;
Margin = new MarginPadding { Top = 15 }; Margin = new MarginPadding { Top = 15 };
} }