示例#1
0
        private static void HandleEquationChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            PennerDoubleAnimation pda = sender as PennerDoubleAnimation;

            // cache method so we avoid lookup while animating
            pda._easingMethod = typeof(PennerDoubleAnimation).GetMethod(e.NewValue.ToString());
        }
示例#2
0
        public bool ProcessAlertTick()
        {
            int maxTick = 30;

            if ((_stepAlert < maxTick) && (_stepAlert > 0) && (AlertState != AnimationState.Idle))
            {
                if (AlertState == AnimationState.Growing)
                {
                    _stepAlert++;
                }
                else if (AlertState == AnimationState.Shrinking)
                {
                    _stepAlert--;
                }
            }

            if ((_stepAlert >= maxTick) && (AlertState == AnimationState.Growing))
            {
                AlertState = AnimationState.Shrinking;
                _stepAlert--;
            }
            else if ((_stepAlert <= 0) && (AlertState == AnimationState.Shrinking))
            {
                AlertState = AnimationState.Growing;
                _stepAlert++;
                _alertPulseCount++;
            }

            if (_alertPulseCount > 4)
            {
                AlertState       = AnimationState.Idle;
                IsAlerting       = false;
                DrawColor        = DefaultDrawColor;
                DrawSize         = 0;
                _alertPulseCount = 0;
                return(true);
            }
            else
            {
                //DrawSize = _stepAlert;

                if (AlertState == AnimationState.Growing)
                {
                    DrawSize = (float)PennerDoubleAnimation.QuintEaseIn(_stepAlert, 1, 100, maxTick);
                }
                else if (AlertState == AnimationState.Shrinking)
                {
                    DrawSize = (float)PennerDoubleAnimation.QuintEaseIn(_stepAlert, 1, 100, maxTick);
                }

                return(false);
            }
        }
示例#3
0
        public bool ProcessHighlightTick()
        {
            int maxTick = 20;

            if ((_stepHighlight < maxTick) && (_stepHighlight > 0) && (HighlightState != AnimationState.Idle))
            {
                if (HighlightState == AnimationState.Growing)
                {
                    _stepHighlight++;
                }
                else if (HighlightState == AnimationState.Shrinking)
                {
                    _stepHighlight--;
                }
            }

            if ((_stepHighlight >= maxTick) && (HighlightState == AnimationState.Growing))
            {
                HighlightState = !_isFlash ? AnimationState.Paused : AnimationState.Shrinking;
                _stepHighlight--;
            }
            else if ((_stepHighlight <= 0) && (HighlightState == AnimationState.Shrinking))
            {
                _stepHighlight++;
                HighlightState = AnimationState.Idle;
                IsHighlighted  = false;
                _isFlash       = false;
                DrawColor      = DefaultDrawColor;
                DrawSize       = 0;
                return(true);
            }

            //DrawSize = _stepAlert;

            if (HighlightState == AnimationState.Growing)
            {
                DrawSize = (float)PennerDoubleAnimation.QuintEaseOut(_stepHighlight, 1, 10, maxTick);
            }
            else if (HighlightState == AnimationState.Shrinking)
            {
                DrawSize = (float)PennerDoubleAnimation.QuintEaseIn(_stepHighlight, 1, 10, maxTick);
            }

            return(false);
        }