1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 08:02:55 +08:00

Simplify and standardise scale for default display

This commit is contained in:
Dean Herbert 2020-07-30 11:50:13 +09:00
parent 64c7ae7686
commit 54fee7e716
3 changed files with 11 additions and 26 deletions

View File

@ -7,7 +7,6 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
@ -39,29 +38,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
RelativeSizeAxes = Axes.Both;
// we are slightly bigger than our parent, to clip the top and bottom of the circle
Height = 1.3f;
Spinner = s;
InternalChildren = new Drawable[]
{
ticks = new Container<DrawableSpinnerTick>(),
RotationTracker = new SpinnerRotationTracker(Spinner),
new AspectContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Y,
Scale = new Vector2(Spinner.Scale),
Children = new Drawable[]
{
new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerBody), _ => new DefaultSpinnerDisc()),
RotationTracker = new SpinnerRotationTracker(Spinner)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
}
},
SpmCounter = new SpinnerSpmCounter
@ -162,8 +152,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
RotationTracker.Tracking = OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false;
}
public float RelativeHeight => ToScreenSpace(new RectangleF(0, 0, 0, OsuHitObject.OBJECT_RADIUS * 2)).Height / DrawHeight;
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();

View File

@ -39,6 +39,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
RelativeSizeAxes = Axes.Both;
// we are slightly bigger than our parent, to clip the top and bottom of the circle
// this should probably be revisited when scaled spinners are a thing.
Scale = new Vector2(1.3f);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
@ -95,22 +99,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
centre.ScaleTo(0);
mainContainer.ScaleTo(0);
this.ScaleTo(1);
using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt / 2, true))
{
float phaseOneScale = spinner.Scale * 0.7f;
centre.ScaleTo(phaseOneScale, spinner.TimePreempt / 4, Easing.OutQuint);
mainContainer
.ScaleTo(phaseOneScale * drawableSpinner.RelativeHeight * 1.6f, spinner.TimePreempt / 4, Easing.OutQuint);
// constant ambient rotation to give the spinner "spinning" character.
this.RotateTo((float)(25 * spinner.Duration / 2000), spinner.TimePreempt + spinner.Duration);
centre.ScaleTo(0.3f, spinner.TimePreempt / 4, Easing.OutQuint);
mainContainer.ScaleTo(0.2f, spinner.TimePreempt / 4, Easing.OutQuint);
using (BeginDelayedSequence(spinner.TimePreempt / 2, true))
{
centre.ScaleTo(spinner.Scale, spinner.TimePreempt / 2, Easing.OutQuint);
centre.ScaleTo(0.5f, spinner.TimePreempt / 2, Easing.OutQuint);
mainContainer.ScaleTo(1, spinner.TimePreempt / 2, Easing.OutQuint);
}
}
@ -160,8 +160,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
.FadeTo(tracking_alpha, 250, Easing.OutQuint);
}
float relativeCircleScale = spinner.Scale * drawableSpinner.RelativeHeight;
float targetScale = relativeCircleScale + (1 - relativeCircleScale) * drawableSpinner.Progress;
const float initial_scale = 0.2f;
float targetScale = initial_scale + (1 - initial_scale) * drawableSpinner.Progress;
fill.Scale = new Vector2((float)Interpolation.Lerp(fill.Scale.X, targetScale, Math.Clamp(Math.Abs(Time.Elapsed) / 100, 0, 1)));
mainContainer.Rotation = drawableSpinner.RotationTracker.Rotation;

View File

@ -28,9 +28,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
spinner = (DrawableSpinner)drawableHitObject;
AutoSizeAxes = Axes.Both;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
InternalChildren = new Drawable[]
{
glow = new GlowPiece(),