Skip to content

Commit

Permalink
Adjust animations further to match stable
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach committed Jul 24, 2024
1 parent 3c28c11 commit 26395bd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
25 changes: 13 additions & 12 deletions osu.Game/Skinning/LegacyKeyCounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,24 @@ namespace osu.Game.Skinning
{
public partial class LegacyKeyCounter : KeyCounter
{
public bool UsesFixedAnchor { get; set; }
private const float transition_duration = 160;

public float TransitionDuration { get; set; } = 50f;
public Colour4 ActiveColour { get; set; }

public Colour4 KeyTextColour
private Colour4 textColour;

public Colour4 TextColour
{
get => keyTextColour;
get => textColour;
set
{
keyTextColour = value;
textColour = value;
overlayKeyText.Colour = value;
}
}

private Colour4 keyTextColour = Colour4.White;

private readonly Container keyContainer;

private readonly OsuSpriteText overlayKeyText;

private readonly Sprite keySprite;

public LegacyKeyCounter(InputTrigger trigger)
Expand Down Expand Up @@ -64,7 +62,7 @@ public LegacyKeyCounter(InputTrigger trigger)
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = trigger.Name,
Colour = keyTextColour,
Colour = textColour,
Font = OsuFont.GetFont(size: 20),
},
},
Expand All @@ -87,14 +85,17 @@ private void load(ISkinSource source)
protected override void Activate(bool forwardPlayback = true)
{
base.Activate(forwardPlayback);
keyContainer.ScaleTo(0.75f, TransitionDuration, Easing.OutQuad);
keyContainer.ScaleTo(0.75f, transition_duration, Easing.Out);
keySprite.Colour = ActiveColour;
overlayKeyText.Text = CountPresses.Value.ToString();
overlayKeyText.Font = overlayKeyText.Font.With(weight: FontWeight.Bold);
}

protected override void Deactivate(bool forwardPlayback = true)
{
base.Deactivate(forwardPlayback);
keyContainer.ScaleTo(1f, TransitionDuration);
keyContainer.ScaleTo(1f, transition_duration, Easing.Out);
keySprite.Colour = Colour4.White;
}
}
}
13 changes: 9 additions & 4 deletions osu.Game/Skinning/LegacyKeyCounterDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ namespace osu.Game.Skinning
{
public partial class LegacyKeyCounterDisplay : KeyCounterDisplay
{
private const float key_transition_time = 100;
private static readonly Colour4 active_colour_top = Colour4.FromHex(@"#ffde00");
private static readonly Colour4 active_colour_bottom = Colour4.FromHex(@"#f8009e");

protected override FillFlowContainer<KeyCounter> KeyFlow { get; }

Expand Down Expand Up @@ -61,12 +62,16 @@ protected override void LoadComplete()

if (backgroundTexture != null)
backgroundSprite.Texture = backgroundTexture;

for (int i = 0; i < KeyFlow.Count; ++i)
{
((LegacyKeyCounter)KeyFlow[i]).ActiveColour = i < 2 ? active_colour_top : active_colour_bottom;
}
}

protected override KeyCounter CreateCounter(InputTrigger trigger) => new LegacyKeyCounter(trigger)
{
TransitionDuration = key_transition_time,
KeyTextColour = keyTextColor,
TextColour = keyTextColor,
};

private Colour4 keyTextColor = Colour4.White;
Expand All @@ -80,7 +85,7 @@ public Colour4 KeyTextColor
{
keyTextColor = value;
foreach (var child in KeyFlow.Cast<LegacyKeyCounter>())
child.KeyTextColour = value;
child.TextColour = value;
}
}
}
Expand Down

0 comments on commit 26395bd

Please sign in to comment.