예제 #1
0
        public override IEnumerable <Timeline> CreateAnimation(FrameworkElement element)
        {
#if NETFX_CORE || WINDOWS_81_PORTABLE
            var frame = Window.Current.Content as Frame;
            var width = (frame != null) ? frame.ActualWidth : 1024;
#elif WINDOWS_PHONE
            var frame = Application.Current.RootVisual as PhoneApplicationFrame;
            var width = (frame != null) ? frame.ActualWidth : 250;
#endif

            return(new Timeline[]
            {
                element.AnimateProperty(AnimationProperty.TranslateX)
                .AddEasingKeyFrame(0.0, 0)
                .AddEasingKeyFrame(Duration / 2, -width / 2, new QuadraticEase())
                .AddEasingKeyFrame(Duration, 0.0, new QuadraticEase()),

                element.AnimateProperty(AnimationProperty.Opacity)
                .AddEasingKeyFrame(0.0, 1),

                element.AnimateObjectProperty(AnimationProperty.ZIndex)
                .AddDiscreteKeyFrame(Duration / 2, 1),

                element.AnimateProperty(AnimationProperty.CentreOfRotationX)
                .AddDiscreteKeyFrame(0.0, 1),
                element.AnimateProperty(AnimationProperty.RotationY)
                .AddEasingKeyFrame(0, 0)
                .AddEasingKeyFrame(Duration / 2, 5, new QuadraticEase {
                    EasingMode = EasingMode.EaseOut
                })
                .AddEasingKeyFrame(Duration, 0),

                element.AnimateProperty(AnimationProperty.ScaleX)
                .AddEasingKeyFrame(0.0, 0.95)
                .AddEasingKeyFrame(Duration / 2, 0.95)
                .AddEasingKeyFrame(Duration, 1),
                element.AnimateProperty(AnimationProperty.ScaleY)
                .AddEasingKeyFrame(0.0, 0.95)
                .AddEasingKeyFrame(Duration / 2, 0.95)
                .AddEasingKeyFrame(Duration, 1),
            });
        }
예제 #2
0
        public override IEnumerable <Timeline> CreateAnimation(FrameworkElement element)
        {
            var frame = Window.Current.Content as Frame;
            var width = (frame != null) ? frame.ActualWidth : 1024;

            return(new Timeline[]
            {
                element.AnimateProperty(AnimationProperty.TranslateX)
                .AddEasingKeyFrame(0.0, 0)
                .AddEasingKeyFrame(Duration / 2, width / 2, new QuadraticEase())
                .AddEasingKeyFrame(Duration, 0.0, new QuadraticEase {
                    EasingMode = EasingMode.EaseInOut
                }),

                element.AnimateObjectProperty(AnimationProperty.ZIndex)
                .AddDiscreteKeyFrame(Duration / 2, 0),

                element.AnimateProperty(AnimationProperty.CentreOfRotationX)
                .AddDiscreteKeyFrame(0.0, 0),
                element.AnimateProperty(AnimationProperty.RotationY)
                .AddEasingKeyFrame(0, 0)
                .AddEasingKeyFrame(Duration / 2, -25, new QuadraticEase {
                    EasingMode = EasingMode.EaseOut
                })
                .AddEasingKeyFrame(Duration, 0),

                element.AnimateProperty(AnimationProperty.ScaleX)
                .AddEasingKeyFrame(0.0, 1)
                .AddEasingKeyFrame(Duration, 0.95),     //, new CubicEase { EasingMode = EasingMode.EaseIn });
                element.AnimateProperty(AnimationProperty.ScaleY)
                .AddEasingKeyFrame(0.0, 1)
                .AddEasingKeyFrame(Duration, 0.95),     //, new CubicEase { EasingMode = EasingMode.EaseIn });

                element.AnimateProperty(AnimationProperty.Opacity)
                .AddEasingKeyFrame(Duration * 0.99, 1)
                .AddEasingKeyFrame(Duration, 0),
            });
        }
예제 #3
0
        public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
        {
            #if NETFX_CORE || WINDOWS_81_PORTABLE
            var frame = Window.Current.Content as Frame;
            var width = (frame != null) ? frame.ActualWidth : 1024;
            #elif WINDOWS_PHONE
            var frame = Application.Current.RootVisual as PhoneApplicationFrame;
            var width = (frame != null) ? frame.ActualWidth : 250;
            #endif

            return new Timeline[]
            {
                element.AnimateProperty(AnimationProperty.TranslateX)
                    .AddEasingKeyFrame(0.0, 0)
                    .AddEasingKeyFrame(Duration/2, width/2, new QuadraticEase())
                    .AddEasingKeyFrame(Duration, 0.0, new QuadraticEase {EasingMode = EasingMode.EaseInOut}),

                element.AnimateObjectProperty(AnimationProperty.ZIndex)
                    .AddDiscreteKeyFrame(Duration/2, 0),

                element.AnimateProperty(AnimationProperty.CentreOfRotationX)
                    .AddDiscreteKeyFrame(0.0, 0),
                element.AnimateProperty(AnimationProperty.RotationY)
                    .AddEasingKeyFrame(0, 0)
                    .AddEasingKeyFrame(Duration/2, -25, new QuadraticEase {EasingMode = EasingMode.EaseOut})
                    .AddEasingKeyFrame(Duration, 0),

                element.AnimateProperty(AnimationProperty.ScaleX)
                    .AddEasingKeyFrame(0.0, 1)
                    .AddEasingKeyFrame(Duration, 0.95), //, new CubicEase { EasingMode = EasingMode.EaseIn });
                element.AnimateProperty(AnimationProperty.ScaleY)
                    .AddEasingKeyFrame(0.0, 1)
                    .AddEasingKeyFrame(Duration, 0.95), //, new CubicEase { EasingMode = EasingMode.EaseIn });
            };
        }