void ArrangePlacement()
            {
                maskingLayer.Dispatcher.BeginInvoke(() => {
                    var placement = new ElementPlacement {
                        Transform   = currentPage.SafeTransformToVisual(null) as Transform ?? new TranslateTransform(),
                        Orientation = currentPage.Orientation,
                        Size        = new Size(currentPage.ActualWidth, currentPage.ActualHeight)
                    };

                    elementPlacementAnimator.AnimateTo(placement);
                });
            }
                public void Enter(ElementPlacement initialPlacement)
                {
                    currentPlacement = initialPlacement;

                    //size
                    maskingLayer.Width  = currentPlacement.Size.Width;
                    maskingLayer.Height = currentPlacement.Size.Height;

                    //position and orientation
                    maskingLayer.RenderTransform = currentPlacement.Transform;

                    //enter animation
                    var projection = new PlaneProjection {
                        CenterOfRotationY = 0.1
                    };

                    viewContainer.Projection = projection;
                    AddDoubleAnimation(projection, "RotationX", from: -90, to: 0, ms: 400);
                    AddDoubleAnimation(maskingLayer, "Opacity", from: 0, to: 1, ms: 400);

                    storyboard.Begin();
                }
                public void Exit(System.Action onCompleted)
                {
                    storyboard.Stop();
                    storyboard.Children.Clear();

                    //exit animation
                    var projection = new PlaneProjection {
                        CenterOfRotationY = 0.1
                    };

                    viewContainer.Projection = projection;
                    AddDoubleAnimation(projection, "RotationX", from: 0, to: 90, ms: 250);
                    AddDoubleAnimation(maskingLayer, "Opacity", from: 1, to: 0, ms: 350);

                    EventHandler handler = null;

                    handler = (o, e) => {
                        storyboard.Completed -= handler;
                        onCompleted();
                        currentPlacement = null;
                    };
                    storyboard.Completed += handler;
                    storyboard.Begin();
                }
示例#4
0
                public void AnimateTo(ElementPlacement newPlacement)
                {
                    storyboard.Stop();
                    storyboard.Children.Clear();


                    if (currentPlacement == null)
                    {
                        Enter(newPlacement);
                        return;
                    }


                    //size
                    AddDoubleAnimation(maskingLayer, "Width", from: currentPlacement.Size.Width, to: newPlacement.Size.Width, ms: 200);
                    AddDoubleAnimation(maskingLayer, "Height", from: currentPlacement.Size.Height, to: newPlacement.Size.Height, ms: 200);

                    //rotation at orientation change
                    var transformGroup = new TransformGroup();
                    var rotation       = new RotateTransform
                    {
                        CenterX = Application.Current.Host.Content.ActualWidth / 2,
                        CenterY = Application.Current.Host.Content.ActualHeight / 2
                    };

                    transformGroup.Children.Add(newPlacement.Transform);
                    transformGroup.Children.Add(rotation);
                    maskingLayer.RenderTransform = transformGroup;
                    AddDoubleAnimation(rotation, "Angle", from: newPlacement.AngleFromDefault - currentPlacement.AngleFromDefault, to: 0.0);

                    //slight fading at orientation change
                    AddFading(maskingLayer);

                    currentPlacement = newPlacement;
                    storyboard.Begin();
                }
示例#5
0
                public void Exit(System.Action onCompleted) {
                    storyboard.Stop();
                    storyboard.Children.Clear();

                    //exit animation
                    var projection = new PlaneProjection { CenterOfRotationY = 0.1 };
                    viewContainer.Projection = projection;
                    AddDoubleAnimation(projection, "RotationX", from:0, to:90, ms:250);
                    AddDoubleAnimation(maskingLayer, "Opacity", from:1, to:0, ms:350);

                    EventHandler handler = null;
                    handler = (o, e) => {
                        storyboard.Completed -= handler;
                        onCompleted();
                        currentPlacement = null;
                    };
                    storyboard.Completed += handler;
                    storyboard.Begin();
                }
示例#6
0
                public void AnimateTo(ElementPlacement newPlacement) {
                    storyboard.Stop();
                    storyboard.Children.Clear();

                    if(currentPlacement == null) {
                        Enter(newPlacement);
                        return;
                    }

                    //size
                    AddDoubleAnimation(maskingLayer, "Width", from:currentPlacement.Size.Width, to:newPlacement.Size.Width, ms:200);
                    AddDoubleAnimation(maskingLayer, "Height", from:currentPlacement.Size.Height, to:newPlacement.Size.Height, ms:200);

                    //rotation at orientation change
                    var transformGroup = new TransformGroup();
                    var rotation = new RotateTransform {
                        CenterX = Application.Current.Host.Content.ActualWidth / 2,
                        CenterY = Application.Current.Host.Content.ActualHeight / 2
                    };
                    transformGroup.Children.Add(newPlacement.Transform);
                    transformGroup.Children.Add(rotation);
                    maskingLayer.RenderTransform = transformGroup;
                    AddDoubleAnimation(rotation, "Angle", from:newPlacement.AngleFromDefault - currentPlacement.AngleFromDefault, to:0.0);

                    //slight fading at orientation change
                    AddFading(maskingLayer);

                    currentPlacement = newPlacement;
                    storyboard.Begin();
                }
示例#7
0
                public void Enter(ElementPlacement initialPlacement) {
                    currentPlacement = initialPlacement;

                    //size
                    maskingLayer.Width = currentPlacement.Size.Width;
                    maskingLayer.Height = currentPlacement.Size.Height;

                    //position and orientation
                    maskingLayer.RenderTransform = currentPlacement.Transform;

                    //enter animation
                    var projection = new PlaneProjection { CenterOfRotationY = 0.1 };
                    viewContainer.Projection = projection;
                    AddDoubleAnimation(projection, "RotationX", from:-90, to:0, ms:400);
                    AddDoubleAnimation(maskingLayer, "Opacity", from:0, to:1, ms:400);

                    storyboard.Begin();
                }
示例#8
0
            void ArrangePlacement() {
                maskingLayer.Dispatcher.BeginInvoke(() => {
                    var placement = new ElementPlacement {
                        Transform = (Transform)currentPage.SafeTransformToVisual(null),
                        Orientation = currentPage.Orientation,
                        Size = new Size(currentPage.ActualWidth, currentPage.ActualHeight)
                    };

                    elementPlacementAnimator.AnimateTo(placement);
                });
            }