Esempio n. 1
0
        /// <summary>
        /// Animates the camera position and direction
        /// </summary>
        /// <param name="camera">An ortographic camera.</param>
        /// <param name="newWidth">The Width to animate to.</param>
        /// <param name="animationTime">Animation time in milliseconds</param>
        public static void AnimateWidth(OrthographicCamera camera, double newWidth, double animationTime)
        {
            double fromWidth = camera.Width;

            camera.Width = newWidth;

            if (animationTime > 0)
            {
                var a1 = new DoubleAnimation(fromWidth, newWidth,
                                             new Duration(TimeSpan.FromMilliseconds(animationTime)))
                {
                    AccelerationRatio = 0.3, DecelerationRatio = 0.5, FillBehavior = FillBehavior.Stop
                };
                camera.BeginAnimation(OrthographicCamera.WidthProperty, a1);
            }
        }