mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:23:22 +08:00
Merge pull request #4703 from peppy/profile-details-animation
Add animation when collapsing or expanding the profile details section
This commit is contained in:
commit
5be8adcfcf
@ -134,9 +134,9 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
|
||||
DetailsVisible.BindValueChanged(visible =>
|
||||
{
|
||||
hiddenDetailContainer.Alpha = visible.NewValue ? 0 : 1;
|
||||
expandedDetailContainer.Alpha = visible.NewValue ? 1 : 0;
|
||||
}, true);
|
||||
hiddenDetailContainer.FadeTo(visible.NewValue ? 0 : 1, 200, Easing.OutQuint);
|
||||
expandedDetailContainer.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
||||
});
|
||||
|
||||
User.BindValueChanged(user => updateDisplay(user.NewValue));
|
||||
}
|
||||
|
@ -26,14 +26,40 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
private OverlinedInfoContainer ppInfo;
|
||||
private OverlinedInfoContainer detailGlobalRank;
|
||||
private OverlinedInfoContainer detailCountryRank;
|
||||
private FillFlowContainer fillFlow;
|
||||
private RankGraph rankGraph;
|
||||
|
||||
public readonly Bindable<User> User = new Bindable<User>();
|
||||
|
||||
private bool expanded = true;
|
||||
|
||||
public bool Expanded
|
||||
{
|
||||
set
|
||||
{
|
||||
if (expanded == value) return;
|
||||
|
||||
expanded = value;
|
||||
|
||||
if (fillFlow == null) return;
|
||||
|
||||
fillFlow.ClearTransforms();
|
||||
|
||||
if (expanded)
|
||||
fillFlow.AutoSizeAxes = Axes.Y;
|
||||
else
|
||||
{
|
||||
fillFlow.AutoSizeAxes = Axes.None;
|
||||
fillFlow.ResizeHeightTo(0, 200, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
@ -43,10 +69,13 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colours.CommunityUserGrayGreenDarkest,
|
||||
},
|
||||
new FillFlowContainer
|
||||
fillFlow = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = expanded ? Axes.Y : Axes.None,
|
||||
AutoSizeDuration = 200,
|
||||
AutoSizeEasing = Easing.OutQuint,
|
||||
Masking = true,
|
||||
Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, Vertical = 10 },
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 20),
|
||||
|
@ -117,7 +117,7 @@ namespace osu.Game.Overlays.Profile
|
||||
infoTabControl.AddItem("Info");
|
||||
infoTabControl.AddItem("Modding");
|
||||
|
||||
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Alpha = visible.NewValue ? 1 : 0, true);
|
||||
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true);
|
||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user