Password masking character animation.

This commit is contained in:
Dean Herbert
2017-02-08 16:01:58 +09:00
parent 06695dbf9b
commit 55e7177577

View File

@ -1,9 +1,10 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -11,17 +12,23 @@ namespace osu.Game.Graphics.UserInterface
{ {
public class OsuPasswordTextBox : OsuTextBox public class OsuPasswordTextBox : OsuTextBox
{ {
protected override Drawable GetDrawableCharacter(char c) => protected override Drawable GetDrawableCharacter(char c) => new PasswordMaskChar(CalculatedTextSize);
new Container
public class PasswordMaskChar : Container
{ {
Size = new Vector2(CalculatedTextSize / 2, CalculatedTextSize), private CircularContainer circle;
public PasswordMaskChar(float size)
{
Size = new Vector2(size / 2, size);
Children = new[] Children = new[]
{ {
new CircularContainer circle = new CircularContainer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Alpha = 0,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.8f), Size = new Vector2(0.8f, 0),
Children = new[] Children = new[]
{ {
new Box new Box
@ -31,7 +38,15 @@ namespace osu.Game.Graphics.UserInterface
} }
}, },
} }
}
}; };
} }
protected override void LoadComplete()
{
base.LoadComplete();
circle.FadeIn(500, EasingTypes.OutQuint);
circle.ResizeTo(new Vector2(0.8f), 500, EasingTypes.OutQuint);
}
}
}
} }