From ced6e5efd09788de3133e14d043a2f337c68f85c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Sep 2018 16:29:29 +0900 Subject: [PATCH] Synchronise animation; reduce flashiness --- .../Objects/Drawables/Pieces/BodyPiece.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs index 01bc02b15a..619fe06c73 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs @@ -140,11 +140,15 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces foreground.Colour = AccentColour.Opacity(0.5f); background.Colour = AccentColour.Opacity(0.7f); + const float animation_length = 50; + + foreground.ClearTransforms(false, nameof(foreground.Colour)); if (hitting) - foreground.FadeColour(AccentColour.Lighten(0.3f), 50).Then().FadeColour(foreground.Colour, 50).Loop(); - else { - foreground.ClearTransforms(false, nameof(foreground.Colour)); + // wait for the next sync point + double synchronisedOffset = animation_length * 2 - Time.Current % (animation_length * 2); + using (foreground.BeginDelayedSequence(synchronisedOffset)) + foreground.FadeColour(AccentColour.Lighten(0.2f), animation_length).Then().FadeColour(foreground.Colour, animation_length).Loop(); } subtractionCache.Invalidate();