1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 22:22:55 +08:00
osu-lazer/osu.Game/Graphics/UserInterface/LoadingAnimation.cs

49 lines
1.4 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2017-02-07 12:52:19 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using OpenTK;
2016-11-04 10:43:00 +08:00
2017-02-07 12:52:19 +08:00
namespace osu.Game.Graphics.UserInterface
{
public class LoadingAnimation : VisibilityContainer
2017-02-07 12:52:19 +08:00
{
private readonly TextAwesome spinner;
2017-02-07 12:52:19 +08:00
public LoadingAnimation()
{
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();
2017-02-07 12:52:19 +08:00
}
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);
2017-02-07 12:52:19 +08:00
}
}