예제 #1
0
        private void onIsHittingChanged(ValueChangedEvent <bool> isHitting)
        {
            // Update animate
            InternalChildren.OfType <LayerContainer>().ForEach(x =>
            {
                x.Reset();
                x.IsPlaying = isHitting.NewValue;
            });

            // Foreground sparkle
            foreground.ClearTransforms(false, nameof(foreground.Colour));
            foreground.Alpha = 0;

            if (isHitting.NewValue)
            {
                foreground.Alpha = 1;

                const float animation_length = 50;

                // wait for the next sync point
                double synchronisedOffset = animation_length * 2 - Time.Current % (animation_length * 2);
                using (foreground.BeginDelayedSequence(synchronisedOffset))
                    foreground.FadeColour(AccentColour.Value.Lighten(0.7f), animation_length).Then().FadeColour(foreground.Colour, animation_length).Loop();
            }
        }