Пример #1
0
        private void Calculate()
        {
            // If we have finished an animation, reset the animation state
            // We do this here (rather than in Animate()) as we need the
            // _currentProcess information in the UpdateStates() function of the
            // window and control classes.

            float offset = _amount;

            if (_tweener != null)
            {
                offset = _tweener.Tween(_amount, 0.0f, 1.0f, 1.0f);
            }

            if (_effect == EffectType.Fade)
            {
                _matrix.SetFader(((float)(_endAlpha - _startAlpha) * offset + _startAlpha) * 0.01f);
            }
            else if (_effect == EffectType.Slide)
            {
                _matrix.SetTranslation((_endX - _startX) * offset + _startX, (_endY - _startY) * offset + _startY, 0);
            }
            else if (_effect == EffectType.RotateX)
            {
                _matrix.SetXRotation(((_endX - _startX) * offset + _startX) * DEGREE_TO_RADIAN, _centerX, _centerY, 1.0f);
            }
            else if (_effect == EffectType.RotateY)
            {
                _matrix.SetYRotation(((_endX - _startX) * offset + _startX) * DEGREE_TO_RADIAN, _centerX, _centerY, 1.0f);
            }
            else if (_effect == EffectType.RotateZ)
            {
                if (_clockHandle != ClockHandleType.None)
                {
                    SetClock();
                }
                _matrix.SetZRotation(((_endX - _startX) * offset + _startX) * DEGREE_TO_RADIAN, _centerX, _centerY,
                                     GUIGraphicsContext.PixelRatio);
            }
            else if (_effect == EffectType.Zoom)
            {
                float scaleX = ((_endX - _startX) * offset + _startX) * 0.01f;
                float scaleY = ((_endY - _startY) * offset + _startY) * 0.01f;
                _matrix.SetScaler(scaleX, scaleY, _centerX, _centerY);
            }
        }