Exemple #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();
        }
Exemple #2
0
        /// <summary>
        /// Animates the camera view matrix after user screen drag completed
        /// </summary>
        private void AnimateCameraAfterFreeDrag()
        {
            _onDragEndAnimation = true;
            XNAMatrixAnimation camAnim = new XNAMatrixAnimation(_cameraMatrix, _cameraMatrixBehindDrag, TimeSpan.FromSeconds(0.5), 30);

            camAnim.OnAnimating += (XNAMatrixAnimation sender, XNAMatrixAnimationEventArgs e) =>
            {
                _cameraMatrix = e.Value;
            };
            camAnim.OnCompleted += (XNAMatrixAnimation sender, XNAMatrixAnimationEventArgs e) =>
            {
                _cameraMatrix       = e.Value;
                _onDragEndAnimation = false;
                _gestureState       = GestureStateEnum.OnMotion;
            };
            camAnim.Start();
        }
Exemple #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();
        }