Exemplo n.º 1
0
        private void StartAnimation(bool isActionImmediate)
        {
            // Camera can be animated with using StartRotation method.
            // StartRotation take two parameters - headingChangeInSecond and attitudeChangeInSecond
            // Advantage of using StartRotation method over using Storyboard animation of Heading or Attitude properties is that
            // StartRotation does not lock the Heading and Attitude properties.
            // The StartRotation also works very good with CameraControlPanel and MouseCameraController - while the camera is rotating it is possible
            // to manually change camera with the mouse or with the buttons on CameraControlPanel

            double headingChangeInSecond  = HeadingChangeInSecondSlider.Value;
            double attitudeChangeInSecond = AttitudeChangeInSecondSlider.Value;

            if (isActionImmediate)
            {
                Camera1.StartRotation(headingChangeInSecond, attitudeChangeInSecond); // No easing
            }
            else
            {
                double accelerationSpeed = AccelerationSpeedSlider.Value;
                SphericalCamera.EasingFunctionDelegate easingFunction = GetEaseInFunction(); // NOTE that ease in and ease out are different functions

                Camera1.StartRotation(headingChangeInSecond, attitudeChangeInSecond, accelerationSpeed, easingFunction);
            }

            StartStopSlowlyButton.Content   = "STOP rotation slowly";
            StartStopNowButton.Content      = "STOP rotation now";
            AccelerationSpeedTextBlock.Text = "decelerationSpeed (0 = disabled):";

            _isRotationStarted = true;
        }
Exemplo n.º 2
0
        private void StopAnimation(bool isActionImmediate)
        {
            if (isActionImmediate)
            {
                Camera1.StopRotation(); // No easing
            }
            else
            {
                double accelerationSpeed = AccelerationSpeedSlider.Value;
                SphericalCamera.EasingFunctionDelegate easingFunction = GetEaseOutFunction(); // NOTE that ease in and ease out are different functions

                Camera1.StopRotation(accelerationSpeed, easingFunction);
            }

            StartStopSlowlyButton.Content   = "START rotation slowly";
            StartStopNowButton.Content      = "START rotation now";
            AccelerationSpeedTextBlock.Text = "accelerationSpeed (0 = disabled):";

            _isRotationStarted = false;
        }