1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 16:13:34 +08:00

Adjust completion animation

This commit is contained in:
Dean Herbert 2022-11-03 15:11:26 +09:00
parent 0868c00ee8
commit e89d3840fc
2 changed files with 31 additions and 7 deletions

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables;
using osuTK.Graphics; using osuTK.Graphics;
@ -24,8 +23,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
private DrawableSpinner spinner = null!; private DrawableSpinner spinner = null!;
private CircularProgress background = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(DrawableHitObject drawableHitObject, OsuColour colours) private void load(DrawableHitObject drawableHitObject)
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
@ -33,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new CircularProgress background = new CircularProgress
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -59,8 +60,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
{ {
base.Update(); base.Update();
fill.Alpha = (float)Interpolation.DampContinuously(fill.Alpha, spinner.Progress > 0 ? 1 : 0, 120f, (float)Math.Abs(Time.Elapsed)); background.Alpha = spinner.Progress >= 1 ? 0 : 1;
fill.Current.Value = (float)Interpolation.DampContinuously(fill.Current.Value, arc_fill * spinner.Progress, 120f, (float)Math.Abs(Time.Elapsed));
fill.Alpha = (float)Interpolation.DampContinuously(fill.Alpha, spinner.Progress > 0 && spinner.Progress < 1 ? 1 : 0, 40f, (float)Math.Abs(Time.Elapsed));
fill.Current.Value = (float)Interpolation.DampContinuously(fill.Current.Value, spinner.Progress >= 1 ? 0 : arc_fill * spinner.Progress, 40f, (float)Math.Abs(Time.Elapsed));
fill.Rotation = (float)(90 - fill.Current.Value * 180); fill.Rotation = (float)(90 - fill.Current.Value * 180);
} }
} }

View File

@ -1,24 +1,34 @@
// 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.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Utils;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Skinning.Argon namespace osu.Game.Rulesets.Osu.Skinning.Argon
{ {
public class ArgonSpinnerRingArc : CompositeDrawable public class ArgonSpinnerRingArc : CompositeDrawable
{ {
private const float arc_fill = 0.31f; private const float arc_fill = 0.31f;
private const float arc_fill_complete = 0.50f;
private const float arc_radius = 0.02f; private const float arc_radius = 0.02f;
private DrawableSpinner spinner = null!;
private CircularProgress fill = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(DrawableHitObject drawableHitObject)
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
InternalChild = new CircularProgress spinner = (DrawableSpinner)drawableHitObject;
InternalChild = fill = new CircularProgress
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -29,5 +39,15 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
RoundedCaps = true, RoundedCaps = true,
}; };
} }
protected override void Update()
{
base.Update();
fill.Current.Value = (float)Interpolation.DampContinuously(fill.Current.Value, spinner.Progress >= 1 ? arc_fill_complete : arc_fill, 40f, (float)Math.Abs(Time.Elapsed));
fill.InnerRadius = (float)Interpolation.DampContinuously(fill.InnerRadius, spinner.Progress >= 1 ? arc_radius * 2.2f : arc_radius, 40f, (float)Math.Abs(Time.Elapsed));
fill.Rotation = (float)(-fill.Current.Value * 180);
}
} }
} }