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

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
{
2022-11-24 13:32:20 +08:00
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,
Progress = 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.Progress = (float)Interpolation.DampContinuously(fill.Progress, spinner.Progress >= 1 ? arc_fill_complete : arc_fill, 40f, (float)Math.Abs(Time.Elapsed));
2022-11-03 14:11:26 +08:00
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.Progress * 180);
2022-11-03 14:11:26 +08:00
}
}
}