예제 #1
0
        /// <summary>
        /// Animates Deselected Location center and zoom backwards at original position in camera
        /// </summary>
        /// <param name="l">Location will be animated</param>
        private void AnimateLocationDeselection(LocationsVM.Location l)
        {
            l.IsAnimatingView = true;
            XNAMatrixAnimation animCam = new XNAMatrixAnimation(l.Object3dEffect.View, _cameraMatrix, TimeSpan.FromSeconds(0.3), 30);

            animCam.OnAnimating += (XNAMatrixAnimation sender, XNAMatrixAnimationEventArgs e) =>
            {
                l.Object3dEffect.View = e.Value;
            };
            animCam.OnCompleted += (XNAMatrixAnimation sender, XNAMatrixAnimationEventArgs e) =>
            {
                l.Object3dEffect.View = e.Value;
                l.IsAnimatingView     = false;
            };
            animCam.Start();

            l.IsAnimatingWorld = true;
            XNAMatrixAnimation animWorld = new XNAMatrixAnimation(l.Object3dEffect.World, l.WorldMatrix, TimeSpan.FromSeconds(0.3), 30);

            animWorld.OnAnimating += (XNAMatrixAnimation sender, XNAMatrixAnimationEventArgs e) =>
            {
                l.Object3dEffect.World = e.Value;
            };
            animWorld.OnCompleted += (XNAMatrixAnimation sender, XNAMatrixAnimationEventArgs e) =>
            {
                l.Object3dEffect.World = e.Value;
                l.IsAnimatingWorld     = false;
            };
            animWorld.Start();
        }
예제 #2
0
        private void pushpin_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Pushpin senderPushpin = (sender as Pushpin);

            if (senderPushpin == null)
            {
                return;
            }

            LocationsVM.Location location = (sender as Pushpin).DataContext as LocationsVM.Location;
            if (location == null)
            {
                return;
            }

            location.IsClickedOnView = true;
            if (OnLocationTouchUp != null)
            {
                OnLocationTouchUp(this, location);
            }
        }
예제 #3
0
        /// <summary>
        /// Animates Selected Location Center and zoom in camera
        /// </summary>
        /// <param name="l">Location will be animated</param>
        private void AnimateLocationSelection(LocationsVM.Location l)
        {
            float   zoomFactor = 0.20f;
            Vector3 v          = new Vector3(l.VectorPoint.X, 0, l.VectorPoint.Z);

            Matrix cam = Matrix.CreateLookAt(new Vector3(0, 0, 0), v, Vector3.Up);

            l.IsAnimatingView = true;
            XNAMatrixAnimation animCam = new XNAMatrixAnimation(l.Object3dEffect.View, cam, TimeSpan.FromSeconds(0.3), 30);

            animCam.OnAnimating += (XNAMatrixAnimation sender, XNAMatrixAnimationEventArgs e) =>
            {
                l.Object3dEffect.View = e.Value;
            };
            animCam.OnCompleted += (XNAMatrixAnimation sender, XNAMatrixAnimationEventArgs e) =>
            {
                l.Object3dEffect.View = e.Value;
                l.IsAnimatingView     = false;
            };
            animCam.Start();

            Matrix world = l.WorldMatrix * Matrix.CreateTranslation(new Vector3(-l.VectorPoint.X * zoomFactor, -l.VectorPoint.Y, -l.VectorPoint.Z * zoomFactor));

            l.IsAnimatingWorld = true;
            XNAMatrixAnimation animWorld = new XNAMatrixAnimation(l.Object3dEffect.World, world, TimeSpan.FromSeconds(0.3), 30);

            animWorld.OnAnimating += (XNAMatrixAnimation sender, XNAMatrixAnimationEventArgs e) =>
            {
                l.Object3dEffect.World = e.Value;
            };
            animWorld.OnCompleted += (XNAMatrixAnimation sender, XNAMatrixAnimationEventArgs e) =>
            {
                l.Object3dEffect.World = e.Value;
                l.IsAnimatingWorld     = false;
            };
            animWorld.Start();
        }