1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-25 23:55:35 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Skinning/Argon/ArgonSpinnerRingArc.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.9 KiB
C#
Raw Normal View History

// 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.
2022-11-03 14:11:26 +08:00
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
2022-11-03 14:11:26 +08:00
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 partial class ArgonSpinnerRingArc : CompositeDrawable
{
private const float arc_fill = 0.31f;
2022-11-03 14:11:26 +08:00
private const float arc_fill_complete = 0.50f;
private const float arc_radius = 0.02f;
2022-11-03 14:11:26 +08:00
private DrawableSpinner spinner = null!;
private CircularProgress fill = null!;
[BackgroundDependencyLoader]
2022-11-03 14:11:26 +08:00
private void load(DrawableHitObject drawableHitObject)
{
RelativeSizeAxes = Axes.Both;
2022-11-03 14:11:26 +08:00
spinner = (DrawableSpinner)drawableHitObject;
InternalChild = fill = new CircularProgress
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Current = { Value = arc_fill },
Rotation = -arc_fill * 180,
InnerRadius = arc_radius,
RoundedCaps = true,
};
}
2022-11-03 14:11:26 +08:00
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);
}
}
}