public void Calculate(AnimationControl animationControl, CubeControlValues values)
        {
            if (values.CubeThetaX <= 0)
            {
                animationControl.SetAnimation(new RotateYForward());
                return;
            }

            values.CubeThetaX--;
            values.CameraTheta--;
        }
        public void Calculate(AnimationControl animationControl, CubeControlValues values)
        {
            if (values.CubeThetaY >= 45)
            {
                animationControl.SetAnimation(new RotateYBackward());
                return;
            }

            values.CubeThetaY++;
            values.CameraPhi++;
        }
        public void Calculate(AnimationControl animationControl, CubeControlValues values)
        {
            if (values.CubeScale <= 1F)
            {
                animationControl.SetAnimation(new RotateXForward());
                return;
            }

            values.CubeScale -= .01F;
            values.CameraTheta--;
        }
        public void Calculate(AnimationControl animationControl, CubeControlValues values)
        {
            if (values.CubeScale >= 1.5F)
            {
                animationControl.SetAnimation(new ScaleDown());
                return;
            }

            values.CubeScale += .01F;
            values.CameraTheta--;
        }
        public void Calculate(AnimationControl animationControl, CubeControlValues values)
        {
            if (values.CubeThetaY <= 0)
            {
                animationControl.SetAnimation(new ResetCameraPosition());
                return;
            }

            values.CubeThetaY--;
            values.CameraPhi++;
        }
        public void Calculate(AnimationControl animationControl, CubeControlValues values)
        {
            if (values.CameraTheta == defaultValues.CameraTheta && values.CameraPhi == defaultValues.CameraPhi)
            {
                animationControl.SetAnimation(new ScaleUp());
            }

            if (values.CameraTheta != defaultValues.CameraTheta)
            {
                values.CameraTheta += values.CameraTheta < defaultValues.CameraTheta ? 1F : -1F;
            }

            if (values.CameraPhi != defaultValues.CameraPhi)
            {
                values.CameraPhi += values.CameraPhi < defaultValues.CameraPhi ? 1F : -1F;
            }
        }
        public void KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                #region Camera properties

            case Keys.R:
                Values.CameraR += e.Shift ? -1F : 1F;
                break;

            case Keys.D:
                Values.CameraDistance += e.Shift ? -5F : 5F;
                break;

            case Keys.P:
                Values.CameraPhi += e.Shift ? -1F : 1F;
                break;

            case Keys.T:
                Values.CameraTheta += e.Shift ? -1F : 1F;
                break;

                #endregion

                #region Translate cube

            case Keys.Right:
                Values.CubeX -= .1F;
                break;

            case Keys.Left:
                Values.CubeX += .1F;
                break;

            case Keys.Up:
                Values.CubeY += .1F;
                break;

            case Keys.Down:
                Values.CubeY -= .1F;
                break;

            case Keys.PageUp:
                Values.CubeZ += .1F;
                break;

            case Keys.PageDown:
                Values.CubeZ -= .1F;
                break;

                #endregion

                #region Rotate cube

            case Keys.X:
                Values.CubeThetaX += e.Shift ? -1F : 1F;
                break;

            case Keys.Y:
                Values.CubeThetaY += e.Shift ? -1F : 1F;
                break;

            case Keys.Z:
                Values.CubeThetaZ += e.Shift ? -1F : 1F;
                break;

                #endregion

                #region Scale cube

            // Scale cube
            case Keys.S:
                Values.CubeScale += e.Shift ? -0.01F : 0.01F;
                break;

                #endregion

                #region Rendering properties

            // Toggle animation
            case Keys.A:
                _timer.Enabled = !_timer.Enabled;
                break;

            // Reset values
            case Keys.C:
                _timer.Enabled = false;
                Values         = new CubeControlValues();
                break;

                #endregion

            default:
                Console.WriteLine("Invalid command");
                break;
            }

            OnChange();
        }
 public void Update(CubeControlValues cubeControlValues)
 {
     CurrentAnimation.Calculate(this, cubeControlValues);
 }