Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add animations to the argon key counter #23751

Merged
merged 5 commits into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 32 additions & 3 deletions osu.Game/Screens/Play/ArgonKeyCounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace osu.Game.Screens.Play
public partial class ArgonKeyCounter : KeyCounter
{
private Circle inputIndicator = null!;
private OsuSpriteText keyNameText = null!;
private OsuSpriteText countText = null!;

// These values were taken from Figma
Expand All @@ -24,13 +25,16 @@ public partial class ArgonKeyCounter : KeyCounter
// Make things look bigger without using Scale
private const float scale_factor = 1.5f;

[Resolved]
private OsuColour colours { get; set; } = null!;

public ArgonKeyCounter(InputTrigger trigger)
: base(trigger)
{
}

[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load()
{
Children = new Drawable[]
{
Expand All @@ -42,7 +46,7 @@ private void load(OsuColour colours)
Height = line_height * scale_factor,
Alpha = 0.5f
},
new OsuSpriteText
keyNameText = new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Expand All @@ -69,8 +73,33 @@ protected override void LoadComplete()
{
base.LoadComplete();

IsActive.BindValueChanged(e => inputIndicator.Alpha = e.NewValue ? 1 : 0.5f, true);
CountPresses.BindValueChanged(e => countText.Text = e.NewValue.ToString(@"#,0"), true);
}

protected override void Activate(bool forwardPlayback = true)
{
base.Activate(forwardPlayback);

keyNameText
.FadeColour(Colour4.White, 10, Easing.OutQuint);

inputIndicator
.FadeIn(10, Easing.OutQuint)
.MoveToY(0)
.Then()
.MoveToY(4, 60, Easing.OutQuint);
}

protected override void Deactivate(bool forwardPlayback = true)
{
base.Deactivate(forwardPlayback);

keyNameText
.FadeColour(colours.Blue0, 200, Easing.OutQuart);

inputIndicator
.MoveToY(0, 250, Easing.OutQuart)
.FadeTo(0.5f, 250, Easing.OutQuart);
}
}
}