private void onAccentChanged(ValueChangedEvent <Colour4> accent) { foregroundBuffer.Colour = accent.NewValue.Opacity(0.5f); const float animation_length = 50; foregroundBuffer.ClearTransforms(false, nameof(foregroundBuffer.Colour)); if (IsHitting.Value) { // wait for the next sync point double synchronisedOffset = animation_length * 2 - Time.Current % (animation_length * 2); using (foregroundBuffer.BeginDelayedSequence(synchronisedOffset)) foregroundBuffer.FadeColour(accent.NewValue.Lighten(0.2f), animation_length).Then().FadeColour(foregroundBuffer.Colour, animation_length).Loop(); } subtractionCache.Invalidate(); }
private void updateAccentColour() { if (!IsLoaded) { return; } 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) { // 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(); }