Exemplo n.º 1
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            context.Storyboard.Duration = this.totalDuration;
            if (this.InOutAnimationMode == InOutAnimationMode.In)
            {
                this.applicationHeaderElement = RadSlideContinuumAnimation.GetApplicationHeaderElement(context.Target);
                this.headerElement            = RadSlideContinuumAnimation.GetHeaderElement(context.Target);

                if (this.headerElement != null)
                {
                    this.headerElementScreenShotInfo = new ElementScreenShotInfo(this.headerElement);
                    this.headerElementScreenShotInfo.Popup.IsOpen = true;
                    this.ApplyPageHeaderAnimation(context);
                }

                if (this.applicationHeaderElement != null)
                {
                    this.applicationHeaderElementScreenShotInfo = new ElementScreenShotInfo(this.applicationHeaderElement);
                    this.applicationHeaderElementScreenShotInfo.Popup.IsOpen = true;
                    this.ApplyApplicationHeaderElementAnimation(context);
                }
            }

            this.ApplyPageAnimation(context);
            base.UpdateAnimationOverride(context);
        }
Exemplo n.º 2
0
        private void ApplyPageHeaderAnimation(AnimationContext context)
        {
            if (this.InOutAnimationMode == InOutAnimationMode.Out)
            {
                return;
            }

            this.headerElementAnimation = new RadMoveAndFadeAnimation();
            this.headerElementScreenShotInfo.ScreenShotContainer.Opacity = 0;
            this.headerElementAnimation.FadeAnimation.StartOpacity       = 0;
            this.headerElementAnimation.FadeAnimation.EndOpacity         = this.headerElementScreenShotInfo.OriginalOpacity;
            Point startPoint = new Point(0, 250);
            Point endPoint   = new Point(0, 0);

            this.headerElementAnimation.MoveAnimation.StartPoint = startPoint;
            this.headerElementAnimation.MoveAnimation.EndPoint   = endPoint;

            this.headerElementAnimation.InitialDelay = TimeSpan.FromMilliseconds(70);                //// totalDuration.TimeSpan.TotalMilliseconds/2);
            this.headerElementAnimation.Duration     = new Duration(TimeSpan.FromMilliseconds(190)); //// new Duration(TimeSpan.FromMilliseconds(totalDuration.TimeSpan.TotalMilliseconds / 2));

            ExponentialEase easing = new ExponentialEase();

            easing.EasingMode = EasingMode.EaseOut;

            this.headerElementAnimation.Easing = easing;
            this.headerElementAnimation.Ended += this.HeaderElementAnimation_Ended;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">An AnimationContext that provides internal animation information.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            base.UpdateAnimationOverride(context);

            if (context == null)
            {
                return;
            }

            Point  from     = GetPoint(context.Target, this.StartPoint);
            Point  to       = GetPoint(context.Target, this.EndPoint);
            double duration = this.Duration.TimeSpan.TotalSeconds;

            RectangleGeometry geom = new RectangleGeometry();

            context.Target.Clip = geom;

            if (this.reverseClipAnimation)
            {
                context.SingleProperty("ClipStartXProperty", 0, 0, duration, -to.X);
                context.SingleProperty("ClipStartYProperty", 0, 0, duration, -to.Y);
            }
            else
            {
                context.SingleProperty("ClipStartXProperty", 0, -from.X, duration, 0);
                context.SingleProperty("ClipStartYProperty", 0, -from.Y, duration, 0);
            }

            SetAnimationCompleteCallback(context);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Sets the initial animation values to the provided target element.
        /// </summary>
        /// <param name="target"></param>
        public override void ApplyInitialValues(UIElement target)
        {
            base.ApplyInitialValues(target);
            AnimationContext context = new AnimationContext(target);

            context.InitializeOpacity(this.StartOpacity);
        }
Exemplo n.º 5
0
        private void AnimateAxes(AnimationContext context)
        {
            double from;
            double to;

            PerspectiveAnimationAxis axes = this.Axes;
            double duration = this.Duration.TimeSpan.TotalSeconds;

            if ((axes & PerspectiveAnimationAxis.X) == PerspectiveAnimationAxis.X)
            {
                // animate the X-axis
                from = this.StartAngleX;
                to   = this.EndAngleX;
                this.UpdateStartEnd(ref from, ref to);
                context.RotationX(new double[] { 0, from, duration, to });
            }

            if ((axes & PerspectiveAnimationAxis.Y) == PerspectiveAnimationAxis.Y)
            {
                // animate the Y-axis
                from = this.StartAngleY;
                to   = this.EndAngleY;
                this.UpdateStartEnd(ref from, ref to);
                context.RotationY(new double[] { 0, from, duration, to });
            }

            if ((axes & PerspectiveAnimationAxis.Z) == PerspectiveAnimationAxis.Z)
            {
                // animate the Y-axis
                from = this.StartAngleZ;
                to   = this.EndAngleZ;
                this.UpdateStartEnd(ref from, ref to);
                context.RotationZ(new double[] { 0, from, duration, to });
            }
        }
Exemplo n.º 6
0
        /// <inheritdoc/>
        public override void ApplyInitialValues(UIElement target)
        {
            base.ApplyInitialValues(target);

            AnimationContext context = new AnimationContext(target);

            if (this.CenterX.HasValue)
            {
                context.InitializeCenterOfRotationX(this.CenterX.Value);
            }

            if (this.CenterY.HasValue)
            {
                context.InitializeCenterOfRotationY(this.CenterY.Value);
            }

            if (this.CenterZ.HasValue)
            {
                context.InitializeCenterOfRotationZ(this.CenterZ.Value);
            }

            context.InitializeRotationX(this.StartAngleX);
            context.InitializeRotationY(this.StartAngleY);
            context.InitializeRotationZ(this.StartAngleZ);
        }
        private void ApplyPageHeaderAnimation(AnimationContext context)
        {
            this.headerElementAnimation = new RadMoveAndFadeAnimation();

            if (this.InOutAnimationMode == InOutAnimationMode.Out)
            {
                this.headerElementAnimation.FadeAnimation.EndOpacity = 0;
                this.headerElementAnimation.InitialDelay             = TimeSpan.FromMilliseconds(400);
                this.headerElementAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(0));
            }
            else
            {
                this.headerElementAnimation.FadeAnimation.StartOpacity = 0;
                this.headerElementAnimation.FadeAnimation.EndOpacity   = this.headerElementScreenShotInfo.OriginalOpacity;

                this.headerElementAnimation.MoveAnimation.StartPoint = new Point(0, -1 * (this.headerElementScreenShotInfo.OriginalLocation.Y + (2 * this.headerElement.ActualHeight)));
                this.headerElementAnimation.MoveAnimation.EndPoint   = new Point(0, 0);

                ExponentialEase easing = new ExponentialEase();
                easing.Exponent   = 5;
                easing.EasingMode = EasingMode.EaseOut;
                this.headerElementAnimation.Easing = easing;
            }

            this.headerElementAnimation.Ended += this.HeaderElementAnimation_Ended;
        }
Exemplo n.º 8
0
        private void ApplyItemOpacityAnimation(FrameworkElement itemToAnimate, AnimationContext context, TimeSpan animationDelay)
        {
            double   endOpacity   = 1;
            double   startOpacity = 0;
            TimeSpan beginTime    = animationDelay;
            TimeSpan duration     = TimeSpan.FromMilliseconds(200);

            if (this.InOutAnimationMode == InOutAnimationMode.Out)
            {
                beginTime    = beginTime.Add(this.ItemAnimationDuration.TimeSpan);
                duration     = TimeSpan.FromMilliseconds(10);
                endOpacity   = 0;
                startOpacity = 1;
            }

            itemToAnimate.Opacity = startOpacity;
            DoubleAnimation opacityAnimation = new DoubleAnimation();

            opacityAnimation.To = endOpacity;

            opacityAnimation.Duration  = duration;
            opacityAnimation.BeginTime = beginTime;

            Storyboard.SetTarget(opacityAnimation, itemToAnimate);
            Storyboard.SetTargetProperty(opacityAnimation, "(UIElement.Opacity)");
            context.Storyboard.Children.Add(opacityAnimation);
        }
Exemplo n.º 9
0
        /// <summary>
        ///        When overridden in a derived class this method updates the animation
        ///        before it is played.
        /// </summary>
        /// <param name="target">The control for which the animation needs to be updated.</param>
        /// <param name="storyboard">Storyboard that needs to be updated.</param>
        /// <param name="args">A set of arguments used for animation creation.</param>
        /// <remarks>
        ///        <para>
        ///            Currently the method sets the <see cref="SpeedRatio"/> of the storyboard to
        ///            the global <strong>AnimationSpeedRatio</strong> if the local <see cref="SpeedRatio"/> is null.
        ///            If the local <see cref="SpeedRatio"/> value is set, it will be used.
        ///        </para>
        /// </remarks>
        internal void UpdateAnimation(UIElement target, Storyboard storyboard, params object[] args)
        {
            storyboard.BeginTime = this.InitialDelay;
            AnimationContext context = new AnimationContext(target, storyboard, args);

            this.UpdateAnimationOverride(context);
            storyboard.SpeedRatio  = this.GetSpeedRatio();
            storyboard.AutoReverse = this.AutoReverse.GetValueOrDefault();
        }
        /// <summary>
        /// Sets the initial animation values to the provided target element.
        /// </summary>
        /// <param name="target"></param>
        public override void ApplyInitialValues(UIElement target)
        {
            base.ApplyInitialValues(target);

            AnimationContext initializationContext = new AnimationContext(target);

            double startY = this.Initialize(initializationContext.Target as FrameworkElement, this.StartY);

            initializationContext.InitializeMoveY(startY);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            if (context == null)
            {
                return;
            }

            context.Opacity(0, this.StartOpacity, this.Duration.TimeSpan.TotalSeconds, this.EndOpacity);
            base.UpdateAnimationOverride(context);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Sets the initial animation values to the provided target element.
        /// </summary>
        public override void ApplyInitialValues(UIElement target)
        {
            base.ApplyInitialValues(target);
            AnimationContext context = new AnimationContext(target);

            if (this.StartWidth.HasValue)
            {
                context.InitializeWidth(this.StartWidth.Value);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected virtual void UpdateAnimationOverride(AnimationContext context)
        {
            if (context == null)
            {
                return;
            }

            context.EaseAll(this.Easing);
            context.Target.RenderTransformOrigin = this.AnimationOrigin;
        }
Exemplo n.º 14
0
        private static void SetAnimationCompleteCallback(AnimationContext context)
        {
            EventHandler <object> completeHandler = null;

            completeHandler += (sender, e) =>
            {
                context.Target.ClearValue(UIElement.ClipProperty);
                context.Storyboard.Completed -= completeHandler;
            };
            context.Storyboard.Completed += completeHandler;
        }
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            context.EnsureDefaultTransforms();

            double startY = this.Initialize(context.Target as FrameworkElement, this.StartY);
            double endY   = this.Initialize(context.Target as FrameworkElement, this.EndY);

            context.MoveY(this.GetMoveArguments(startY, endY));

            base.UpdateAnimationOverride(context);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            if (this.MoveDirection.HasValue)
            {
                Pair <Point, Point> points = this.GetStartEndPoints(context.Target as FrameworkElement);
                this.xAnimation.StartX = points.First.X;
                this.yAnimation.StartY = points.First.Y;
                this.xAnimation.EndX   = points.Second.X;
                this.yAnimation.EndY   = points.Second.Y;
            }

            base.UpdateAnimationOverride(context);
        }
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            context.EnsureDefaultTransforms();
            ScaleTransform transform = context.Target.GetScaleTransform();

            double fromX = this.StartScaleX.HasValue ? this.StartScaleX.Value : transform.ScaleX;
            double toX   = this.EndScaleX.HasValue ? this.EndScaleX.Value : transform.ScaleX;

            double duration = this.Duration.TimeSpan.TotalSeconds;

            context.ScaleX(0, fromX, duration, toX);

            base.UpdateAnimationOverride(context);
        }
 private void ApplyPageAnimation(AnimationContext context)
 {
     this.pageAnimation = new RadFadeAnimation();
     if (this.InOutAnimationMode == InOutAnimationMode.Out)
     {
         this.pageAnimation.StartOpacity = 1;
         this.pageAnimation.EndOpacity   = 0;
     }
     else
     {
         this.pageAnimation.StartOpacity = 0;
         this.pageAnimation.EndOpacity   = 1;
     }
 }
Exemplo n.º 19
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            if (context == null)
            {
                return;
            }

            this.containerToAnimate = RadTileAnimation.GetContainerToAnimate(context.Target);
            if (this.containerToAnimate == null)
            {
                // TODO - try cast the context.Target to ITemsControl or panel
                return;
            }

            this.itemsToAnimate = this.GetItemsToAnimate();
            if (this.InOutAnimationMode == InOutAnimationMode.Out)
            {
                this.elementToDelay = RadTileAnimation.GetElementToDelay(context.Target);
                if (this.elementToDelay == null)
                {
                    this.elementToDelay = this.FindElementToDelay();
                }

                // move the delayed element to the end of the sequence
                if (this.elementToDelay != null && this.itemsToAnimate.Remove(this.elementToDelay))
                {
                    this.itemsToAnimate.Add(this.elementToDelay);
                }
            }

            for (int i = 0; i < this.itemsToAnimate.Count; i++)
            {
                FrameworkElement itemToAnimate = this.itemsToAnimate[i];

                TimeSpan animationDelay = TimeSpan.FromMilliseconds((this.SequentialItemDelay.TotalMilliseconds * i) + this.InitialDelay.TotalMilliseconds);

                if (this.InOutAnimationMode == InOutAnimationMode.Out && itemToAnimate == this.elementToDelay)
                {
                    animationDelay = animationDelay.Add(this.SelectedItemDelay);
                }

                this.ApplyItemProjectionAnimation(itemToAnimate, context, animationDelay);

                this.ApplyItemOpacityAnimation(itemToAnimate, context, animationDelay);
            }

            base.UpdateAnimationOverride(context);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            double duration    = this.Duration.TimeSpan.TotalSeconds;
            double startHeight = GetHeight(context.Target, this.StartHeight);
            double endHeight   = GetHeight(context.Target, this.EndHeight);

            context.EnsureDefaultTransforms();

            if (this.Width.HasValue)
            {
                (context.Target as FrameworkElement).Width = this.Width.Value;
            }

            context.Height(0, startHeight, duration, endHeight);
            base.UpdateAnimationOverride(context);
        }
        private void ApplyContinuumElementAnimation(AnimationContext context)
        {
            this.continuumElementAnimation = new RadMoveAndFadeAnimation();
            FrameworkElement rootVisual = Window.Current.Content as FrameworkElement;

            QuadraticEase easing = new QuadraticEase();

            if (this.InOutAnimationMode == InOutAnimationMode.Out)
            {
                double durationInMs = 200;
                double keyTime      = 0.2 * durationInMs;
                easing.EasingMode = EasingMode.EaseIn;
                this.continuumElementAnimation.MoveAnimation.StartPoint = new Point(0, 0);
                DoubleKeyFrameCollection middlePointsY = new DoubleKeyFrameCollection();
                middlePointsY.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(keyTime)), Value = 20
                });
                this.continuumElementAnimation.MoveAnimation.MiddlePointsYAxis = middlePointsY;

                DoubleKeyFrameCollection middlePointsX = new DoubleKeyFrameCollection();
                middlePointsX.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(keyTime)), Value = 10
                });
                this.continuumElementAnimation.MoveAnimation.MiddlePointsXAxis = middlePointsX;

                this.continuumElementAnimation.MoveAnimation.EndPoint     = new Point(rootVisual.ActualWidth, this.continuumElement.ActualHeight);
                this.continuumElementAnimation.FadeAnimation.StartOpacity = 1;
                this.continuumElementAnimation.FadeAnimation.EndOpacity   = 0;

                this.continuumElementAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(durationInMs));
            }
            else
            {
                this.continuumElementAnimation.MoveAnimation.StartPoint   = new Point((-1 * this.continuumElement.ActualWidth) - this.continuumElementScreenShotInfo.OriginalLocation.X, -2 * this.continuumElement.ActualHeight);
                this.continuumElementAnimation.MoveAnimation.EndPoint     = new Point(0, 0);
                this.continuumElementAnimation.FadeAnimation.StartOpacity = 0;
                this.continuumElementAnimation.FadeAnimation.EndOpacity   = 1;
                this.continuumElementAnimation.Duration = TimeSpan.FromMilliseconds(200);
                easing.EasingMode = EasingMode.EaseOut;
            }

            this.continuumElementAnimation.Easing = easing;

            this.continuumElementAnimation.Ended += this.ContinuumElementAnimation_Ended;
        }
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            int currentIndex = 0;

            foreach (RadAnimation animation in this.Children)
            {
                if (animation.Duration > this.Duration)
                {
                    // Clamp durations which are greater than that of the group so that we can be sure that all animations
                    // will stop at their end values.
                    animation.Duration = this.Duration;
                }

                Storyboard childBoard = context.Storyboard.Children[currentIndex++] as Storyboard;
                animation.UpdateAnimation(context.Target, childBoard, context.Arguments);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            if (context == null)
            {
                return;
            }

            context.EnsureDefaultTransforms();

            FrameworkElement target = context.Target as FrameworkElement;

            double startX = this.Initialize(target, this.StartX);
            double endX   = this.Initialize(target, this.EndX);

            context.MoveX(this.GetMoveArguments(startX, endX));

            base.UpdateAnimationOverride(context);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            if (context == null)
            {
                return;
            }

            context.EnsureDefaultTransforms();
            ScaleTransform transform = context.Target.GetScaleTransform();

            double fromX = StartScaleX ?? transform.ScaleX;
            double toX   = EndScaleX ?? transform.ScaleX;

            double duration = this.Duration.TimeSpan.TotalSeconds;

            context.ScaleX(0, fromX, duration, toX);

            base.UpdateAnimationOverride(context);
        }
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            if (context == null)
            {
                return;
            }

            this.continuumElement = RadContinuumAnimation.GetContinuumElement(context.Target);
            if (this.continuumElement == null)
            {
                return;
            }

            // TODO UNO
            //if (!(this.continuumElement is TextBlock))
            //{
            //    TextBlock textBlock = ElementTreeHelper.FindVisualDescendant<TextBlock>(this.continuumElement);
            //    if (textBlock != null)
            //    {
            //        this.continuumElement = textBlock;
            //    }
            //}

            /////context.Storyboard.Duration = new Duration(TimeSpan.FromMilliseconds(500));
            this.headerElement = RadContinuumAnimation.GetHeaderElement(context.Target);
            if (this.headerElement != null)
            {
                this.headerElementScreenShotInfo = new ElementScreenShotInfo(this.headerElement);
                this.headerElementScreenShotInfo.Popup.IsOpen = true;
            }

            this.continuumElementScreenShotInfo = new ElementScreenShotInfo(this.continuumElement);
            this.continuumElementScreenShotInfo.Popup.IsOpen = true;

            this.ApplyPageAnimation();
            this.ApplyContinuumElementAnimation();
            if (this.headerElement != null)
            {
                this.ApplyPageHeaderAnimation();
            }

            base.UpdateAnimationOverride(context);
        }
Exemplo n.º 26
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            if (context == null)
            {
                return;
            }

            context.EnsureDefaultTransforms();
            ScaleTransform transform = context.Target.GetScaleTransform();

            double fromY = this.StartScaleY.HasValue ? this.StartScaleY.Value : transform.ScaleY;
            double toY   = this.EndScaleY.HasValue ? this.EndScaleY.Value : transform.ScaleY;

            double duration = this.Duration.TimeSpan.TotalSeconds;

            context.ScaleY(0, fromY, duration, toY);

            base.UpdateAnimationOverride(context);
        }
        private void SetPlaneProjection(AnimationContext context)
        {
            if (context.Target.Projection == null)
            {
                PlaneProjection projection = new PlaneProjection();
                context.Target.Projection = projection;
            }

            if (this.CenterX.HasValue)
            {
                context.InitializeCenterOfRotationX(this.CenterX.Value);
            }
            if (this.CenterY.HasValue)
            {
                context.InitializeCenterOfRotationY(this.CenterY.Value);
            }
            if (this.CenterZ.HasValue)
            {
                context.InitializeCenterOfRotationZ(this.CenterZ.Value);
            }
        }
Exemplo n.º 28
0
        private void ApplyPageAnimation(AnimationContext context)
        {
            this.pageAnimation = new RadMoveAndFadeAnimation();
            if (this.InOutAnimationMode == InOutAnimationMode.Out)
            {
                this.pageAnimation.FadeAnimation.StartOpacity = 1;
                this.pageAnimation.FadeAnimation.EndOpacity   = 0;

                this.pageAnimation.MoveAnimation.EndPoint   = new Point(0, 200);
                this.pageAnimation.MoveAnimation.StartPoint = new Point(0, 0);
                this.pageAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(100));
            }
            else
            {
                this.pageAnimation.FadeAnimation.StartOpacity = 0;
                this.pageAnimation.FadeAnimation.EndOpacity   = 1;

                this.pageAnimation.MoveAnimation.StartPoint = new Point(0, 200);
                this.pageAnimation.MoveAnimation.EndPoint   = new Point(0, 0);
                this.pageAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(250));
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            if (context == null)
            {
                return;
            }

            double duration   = this.Duration.TimeSpan.TotalSeconds;
            double startWidth = GetWidth(context.Target, this.StartWidth);
            double endWidth   = GetWidth(context.Target, this.EndWidth);

            context.EnsureDefaultTransforms();

            context.Width(0, startWidth, duration, endWidth);

            if (this.Height.HasValue)
            {
                (context.Target as FrameworkElement).Height = this.Height.Value;
            }

            base.UpdateAnimationOverride(context);
        }
Exemplo n.º 30
0
        private void ApplyApplicationHeaderElementAnimation(AnimationContext context)
        {
            if (this.InOutAnimationMode == InOutAnimationMode.Out)
            {
                return;
            }

            QuadraticEase easing = new QuadraticEase();

            easing.EasingMode = EasingMode.EaseOut;

            this.applicationHeaderElementAnimation = new RadMoveAndFadeAnimation();

            Point startPoint = new Point(this.applicationHeaderElement.ActualWidth, -1 * (this.applicationHeaderElement.ActualHeight + this.applicationHeaderElementScreenShotInfo.OriginalLocation.Y));
            Point endPoint   = new Point(0, 0);

            this.applicationHeaderElementAnimation.MoveAnimation.StartPoint   = startPoint;
            this.applicationHeaderElementAnimation.MoveAnimation.EndPoint     = endPoint;
            this.applicationHeaderElementAnimation.FadeAnimation.StartOpacity = 0;
            this.applicationHeaderElementAnimation.FadeAnimation.EndOpacity   = 1;
            this.applicationHeaderElementAnimation.Easing   = easing;
            this.applicationHeaderElementAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(260));
            this.applicationHeaderElementAnimation.Ended   += this.ApplicationHeaderElementAnimation_Ended;
        }