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

47 lines
1.3 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 SpriteIcon 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 SpriteIcon
{
Size = new Vector2(20),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = FontAwesome.fa_spinner
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
2017-07-22 00:23:01 +08:00
spinner.Spin(2000, RotationDirection.Clockwise);
2017-02-07 12:52:19 +08:00
}
private const float transition_duration = 500;
2017-07-23 02:50:25 +08:00
protected override void PopIn() => this.FadeIn(transition_duration * 5, Easing.OutQuint);
2017-07-23 02:50:25 +08:00
protected override void PopOut() => this.FadeOut(transition_duration, Easing.OutQuint);
2017-02-07 12:52:19 +08:00
}
}