1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Adjust transitions

This commit is contained in:
Dean Herbert 2024-06-07 17:04:16 +08:00
parent 366ef64a2c
commit 9c6e707f00
No known key found for this signature in database
2 changed files with 30 additions and 2 deletions

View File

@ -1,14 +1,19 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transforms;
using osu.Game.Scoring; using osu.Game.Scoring;
namespace osu.Game.Online.Leaderboards namespace osu.Game.Online.Leaderboards
{ {
public partial class UpdateableRank : ModelBackedDrawable<ScoreRank?> public partial class UpdateableRank : ModelBackedDrawable<ScoreRank?>
{ {
protected override double TransformDuration => 600;
protected override bool TransformImmediately => true;
public ScoreRank? Rank public ScoreRank? Rank
{ {
get => Model; get => Model;
@ -20,6 +25,16 @@ namespace osu.Game.Online.Leaderboards
Rank = rank; Rank = rank;
} }
protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func<Drawable> createContentFunc, double timeBeforeLoad)
{
return base.CreateDelayedLoadWrapper(createContentFunc, timeBeforeLoad)
.With(w =>
{
w.Anchor = Anchor.Centre;
w.Origin = Anchor.Centre;
});
}
protected override Drawable? CreateDrawable(ScoreRank? rank) protected override Drawable? CreateDrawable(ScoreRank? rank)
{ {
if (rank.HasValue) if (rank.HasValue)
@ -33,5 +48,18 @@ namespace osu.Game.Online.Leaderboards
return null; return null;
} }
protected override TransformSequence<Drawable> ApplyShowTransforms(Drawable drawable)
{
drawable.ScaleTo(1);
return base.ApplyShowTransforms(drawable);
}
protected override TransformSequence<Drawable> ApplyHideTransforms(Drawable drawable)
{
drawable.ScaleTo(1.8f, TransformDuration, Easing.Out);
return base.ApplyHideTransforms(drawable);
}
} }
} }

View File

@ -52,8 +52,8 @@ namespace osu.Game.Skinning
BypassAutoSizeAxes = Axes.Both, BypassAutoSizeAxes = Axes.Both,
}; };
AddInternal(transientRank); AddInternal(transientRank);
transientRank.FadeOutFromOne(1200, Easing.Out) transientRank.FadeOutFromOne(500, Easing.Out)
.ScaleTo(new Vector2(1.625f), 1200, Easing.Out) .ScaleTo(new Vector2(1.625f), 500, Easing.Out)
.Expire(); .Expire();
} }
}, true); }, true);