mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 08:22:56 +08:00
Adjust transitions to look better
This commit is contained in:
parent
cd0e0fe70f
commit
003a3de270
@ -21,7 +21,7 @@ namespace osu.Game.Graphics.Containers
|
||||
/// </summary>
|
||||
public class ScalingContainer : Container
|
||||
{
|
||||
private const float duration = 500;
|
||||
internal const float TRANSITION_DURATION = 500;
|
||||
|
||||
private Bindable<float> sizeX;
|
||||
private Bindable<float> sizeY;
|
||||
@ -99,7 +99,7 @@ namespace osu.Game.Graphics.Containers
|
||||
if (applyUIScale)
|
||||
{
|
||||
uiScale = osuConfig.GetBindable<float>(OsuSetting.UIScale);
|
||||
uiScale.BindValueChanged(args => this.TransformTo(nameof(CurrentScale), args.NewValue, duration, Easing.OutQuart), true);
|
||||
uiScale.BindValueChanged(args => this.TransformTo(nameof(CurrentScale), args.NewValue, TRANSITION_DURATION, Easing.OutQuart), true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,10 +163,10 @@ namespace osu.Game.Graphics.Containers
|
||||
backgroundStack.Push(new ScalingBackgroundScreen());
|
||||
}
|
||||
|
||||
backgroundStack.FadeIn(duration);
|
||||
backgroundStack.FadeIn(TRANSITION_DURATION);
|
||||
}
|
||||
else
|
||||
backgroundStack?.FadeOut(duration);
|
||||
backgroundStack?.FadeOut(TRANSITION_DURATION);
|
||||
}
|
||||
|
||||
RectangleF targetRect = new RectangleF(Vector2.Zero, Vector2.One);
|
||||
@ -195,13 +195,13 @@ namespace osu.Game.Graphics.Containers
|
||||
if (requiresMasking)
|
||||
sizableContainer.Masking = true;
|
||||
|
||||
sizableContainer.MoveTo(targetRect.Location, duration, Easing.OutQuart);
|
||||
sizableContainer.ResizeTo(targetRect.Size, duration, Easing.OutQuart);
|
||||
sizableContainer.MoveTo(targetRect.Location, TRANSITION_DURATION, Easing.OutQuart);
|
||||
sizableContainer.ResizeTo(targetRect.Size, TRANSITION_DURATION, Easing.OutQuart);
|
||||
|
||||
// Of note, this will not work great in the case of nested ScalingContainers where multiple are applying corner radius.
|
||||
// Masking and corner radius should likely only be applied at one point in the full game stack to fix this.
|
||||
// An example of how this can occur is when the skin editor is visible and the game screen scaling is set to "Everything".
|
||||
sizableContainer.TransformTo(nameof(CornerRadius), requiresMasking ? corner_radius : 0, duration, requiresMasking ? Easing.OutQuart : Easing.None)
|
||||
sizableContainer.TransformTo(nameof(CornerRadius), requiresMasking ? corner_radius : 0, TRANSITION_DURATION, requiresMasking ? Easing.OutQuart : Easing.None)
|
||||
.OnComplete(_ => { sizableContainer.Masking = requiresMasking; });
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,10 @@ namespace osu.Game.Skinning.Editor
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
this.FadeIn(TRANSITION_DURATION, Easing.OutQuint);
|
||||
this
|
||||
// align animation to happen after the majority of the ScalingContainer animation completes.
|
||||
.Delay(ScalingContainer.TRANSITION_DURATION * 0.3f)
|
||||
.FadeIn(TRANSITION_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
|
Loading…
Reference in New Issue
Block a user