mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 00:09:55 +09:00
Improve the loading animation and use it in multiple places
- Supersedes https://github.com/ppy/osu/pull/926. - [ ] Depends on https://github.com/ppy/osu-framework/pull/817.
This commit is contained in:
@ -1,15 +1,48 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class LoadingAnimation : SpriteText
|
||||
public class LoadingAnimation : VisibilityContainer
|
||||
{
|
||||
private readonly TextAwesome spinner;
|
||||
|
||||
public LoadingAnimation()
|
||||
{
|
||||
Text = "Loading";
|
||||
Size = new Vector2(20);
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
spinner = new TextAwesome
|
||||
{
|
||||
TextSize = 20,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = FontAwesome.fa_spinner
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
spinner.RotateTo(360, 2000);
|
||||
using (spinner.BeginDelayedSequence(2000))
|
||||
spinner.Loop();
|
||||
}
|
||||
|
||||
private const float transition_duration = 500;
|
||||
|
||||
protected override void PopIn() => FadeIn(transition_duration * 5, EasingTypes.OutQuint);
|
||||
|
||||
protected override void PopOut() => FadeOut(transition_duration, EasingTypes.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user