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

View File

@ -1,24 +1,34 @@
// 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.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
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
{
public class ArgonSpinnerRingArc : CompositeDrawable
{
private const float arc_fill = 0.31f;
private const float arc_fill_complete = 0.50f;
private const float arc_radius = 0.02f;
private DrawableSpinner spinner = null!;
private CircularProgress fill = null!;
[BackgroundDependencyLoader]
private void load()
private void load(DrawableHitObject drawableHitObject)
{
RelativeSizeAxes = Axes.Both;
InternalChild = new CircularProgress
spinner = (DrawableSpinner)drawableHitObject;
InternalChild = fill = new CircularProgress
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -29,5 +39,15 @@ private void load()
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);
}
}
}