예제 #1
0
        private void CenterAnimationCompleted(object sender, object e)
        {
            if (centerAnimation != null)
            {
                centerAnimation.Completed -= CenterAnimationCompleted;
                centerAnimation            = null;

                InternalSetValue(CenterProperty, TargetCenter);
                InternalSetValue(CenterPointProperty, MapTransform.Transform(TargetCenter));
                RemoveAnimation(CenterPointProperty); // remove holding animation in WPF

                ResetTransformOrigin();
                UpdateTransform();
            }
        }
예제 #2
0
        private static Timeline GenerateToAnimation(FrameworkElement root, Timeline timeline, IEasingFunction easingFunction, bool isEntering)
        {
            Timeline result = null;

            Color?targetColor = GetTargetColor(timeline, isEntering);

            if (targetColor.HasValue)
            {
                ColorAnimation ca = new ColorAnimation()
                {
                    To = targetColor, EasingFunction = easingFunction
                };
                result = ca;
            }

            if (result == null)
            {
                double?targetDouble = GetTargetDouble(timeline, isEntering);
                if (targetDouble.HasValue)
                {
                    DoubleAnimation da = new DoubleAnimation()
                    {
                        To = targetDouble, EasingFunction = easingFunction
                    };
                    result = da;
                }
            }

            if (result == null)
            {
                Point?targetPoint = GetTargetPoint(timeline, isEntering);
                if (targetPoint.HasValue)
                {
                    PointAnimation pa = new PointAnimation()
                    {
                        To = targetPoint, EasingFunction = easingFunction
                    };
                    result = pa;
                }
            }

            if (result != null)
            {
                CopyStoryboardTargetProperties(root, timeline, result);
            }

            return(result);
        }
예제 #3
0
        //---------------------------------------------------------//
        /// <summary>
        /// Adds a ScatterViewItem to the ScatterView, and animates it
        /// on from the specified side of the screen (Left or Right).
        /// </summary>
        /// <param name="item">The item to add.</param>
        /// <param name="fromDirection">The direction from which puzzle pieces enter.</param>
        private void AddPiece(ScatterViewItem item, Direction fromDirection)
        {
            // Add the piece to the ScatterView at the correct location
            Debug.Assert(fromDirection == Direction.Right || fromDirection == Direction.Left);

            double screenHeight = scatter.ActualHeight;
            double screenWidth  = scatter.ActualWidth;

            item.Center      = fromDirection == Direction.Right ? new Point(screenWidth, screenHeight / 2) : new Point(-100, screenHeight / 2);
            item.Orientation = allowRotation ? random.Next(0, 360) : 0;
            scatter.Items.Add(item);

            // Load the animation
            Storyboard add = ((Storyboard)Resources["AddPiece"]).Clone();

            foreach (AnimationTimeline animation in add.Children)
            {
                // If this is a double animation, it animates the item's orientation
                DoubleAnimation orientation = animation as DoubleAnimation;
                if (orientation != null && allowRotation)
                {
                    // Spin the orientation a little.
                    orientation.To = item.Orientation + random.Next(-135, 135);
                }

                // If this is a point animation, then it animates the item's center
                PointAnimation center = animation as PointAnimation;
                if (center != null)
                {
                    var padding = 100;

                    // Get a random point to animate the item to
                    center.To = new Point(
                        random.Next(padding, (int)(screenWidth) - padding),
                        random.Next(padding, (int)(screenHeight) - padding));
                }
            }

            // Set up a callback that passes the ScatterViewItem that will be needed when the animation completes
            add.Completed += delegate(object sender, EventArgs e)
            {
                OnAddAnimationCompleted(item);
            };

            // Start the animation
            item.BeginStoryboard(add, HandoffBehavior.SnapshotAndReplace);
        }
        /// <summary>
        ///     Makes menu bar drop down.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuBarWindow_ContainerManipulationCompleted(object sender,
                                                                  ContainerManipulationCompletedEventArgs e)
        {
            const double newOrientation = 0;
            double       orientation    = menuBar.ActualOrientation;

            var d  = new Duration(TimeSpan.FromMilliseconds(300));
            var da = new DoubleAnimation(orientation, newOrientation, d);
            var sb = new Storyboard();

            sb.Children.Add(da);

            Storyboard.SetTarget(da, menuBar);
            Storyboard.SetTargetProperty(da, new PropertyPath("Orientation"));
            sb.FillBehavior = FillBehavior.Stop;

            sb.Begin();
            menuBar.Orientation = newOrientation;

            double y = menuBar.Center.Y;

            var point = new Point(menuBar.Center.X, menuBar.Center.Y);

            point.X = 360;
            if (y < 280)
            {
                point.Y = 260;
            }

            else
            {
                point.Y = 530;
            }

            var da2 = new PointAnimation(menuBar.ActualCenter, point, d);

            var sb2 = new Storyboard();

            sb2.Children.Add(da2);

            Storyboard.SetTarget(da2, menuBar);
            Storyboard.SetTargetProperty(da2, new PropertyPath("Center"));
            sb2.FillBehavior = FillBehavior.Stop;

            sb2.Begin();
            menuBar.Center = point;
        }
예제 #5
0
        // Token: 0x06000D00 RID: 3328 RVA: 0x0003062C File Offset: 0x0002E82C
        private static Timeline GenerateToAnimation(FrameworkElement root, Timeline timeline, IEasingFunction easingFunction, bool isEntering)
        {
            Timeline timeline2   = null;
            Color?   targetColor = VisualStateManager.GetTargetColor(timeline, isEntering);

            if (targetColor != null)
            {
                ColorAnimation colorAnimation = new ColorAnimation
                {
                    To             = targetColor,
                    EasingFunction = easingFunction
                };
                timeline2 = colorAnimation;
            }
            if (timeline2 == null)
            {
                double?targetDouble = VisualStateManager.GetTargetDouble(timeline, isEntering);
                if (targetDouble != null)
                {
                    DoubleAnimation doubleAnimation = new DoubleAnimation
                    {
                        To             = targetDouble,
                        EasingFunction = easingFunction
                    };
                    timeline2 = doubleAnimation;
                }
            }
            if (timeline2 == null)
            {
                Point?targetPoint = VisualStateManager.GetTargetPoint(timeline, isEntering);
                if (targetPoint != null)
                {
                    PointAnimation pointAnimation = new PointAnimation
                    {
                        To             = targetPoint,
                        EasingFunction = easingFunction
                    };
                    timeline2 = pointAnimation;
                }
            }
            if (timeline2 != null)
            {
                VisualStateManager.CopyStoryboardTargetProperties(root, timeline, timeline2);
            }
            return(timeline2);
        }
        private void AnimateTransition(Point point, TimeSpan duration, EventHandler completed)
        {
            PointAnimation pointAnimation = new PointAnimation();

            pointAnimation.From     = circleGeometry.Center;
            pointAnimation.To       = point;
            pointAnimation.Duration = duration;

            storyboard = new Storyboard();
            storyboard.Children.Add(pointAnimation);

            Storyboard.SetTargetName(pointAnimation, "circleGeometry");
            Storyboard.SetTargetProperty(pointAnimation, new PropertyPath(EllipseGeometry.CenterProperty));

            storyboard.Completed += completed;
            storyboard.Begin(this);
        }
예제 #7
0
        public MainWindow()
        {
            InitializeComponent();
            Rect myRect = new Rect();

            myRect.X      = 395;
            myRect.Y      = 245;
            myRect.Width  = 20;
            myRect.Height = 20;
            RectangleGeometry Ball = new RectangleGeometry();

            Ball.Rect = myRect;

            Path myPath = new Path();

            myPath.Fill = Brushes.White;
            myPath.Data = Ball;

            while (Playing == true)
            {
                PointAnimation myPointAnimation = new PointAnimation(e.GetPosition(this), TimeSpan.FromSeconds(1)); //the new possition and how long it takes to move
                Ball.BeginAnimation(RectangleGeometry.CenterProperty, myPointAnimation);                            // trigger
            }
            myCanvas.Children.Add(myPath);


            Rectangle paddle1 = new Rectangle();

            paddle1.Height = 70;
            paddle1.Width  = 20;
            Canvas.SetLeft(paddle1, 75);
            Canvas.SetTop(paddle1, 215);
            paddle1.Fill   = Brushes.CornflowerBlue;
            paddle1.Stroke = Brushes.White;
            myCanvas.Children.Add(paddle1);

            Rectangle paddle2 = new Rectangle();

            paddle2.Height = 70;
            paddle2.Width  = 20;
            paddle2.Fill   = Brushes.Orange;
            paddle2.Stroke = Brushes.White;
            Canvas.SetLeft(paddle2, 685);
            Canvas.SetTop(paddle2, 215);
            myCanvas.Children.Add(paddle2);
        }
예제 #8
0
        /// <summary>
        ///		Crea la animación de punto sobre un control
        /// </summary>
        private void CreatePointAnimation(UIElement control, Point?from, Point?to, PropertyPath propertyPath, ActionBaseModel action)
        {
            PointAnimation animation = new PointAnimation();

            // Asigna las propiedades From y To de la animación
            if (from != null)
            {
                animation.From = from;
            }
            if (to != null)
            {
                animation.To = to;
            }
            // Asigna las funciones
            animation.EasingFunction = AssignEasingFuntion(action);
            // Asigna la animación al storyBoard
            AddAnimationToStoryBoard(control, animation, action, propertyPath);
        }
        /// <summary>
        /// Animate moves current position
        /// </summary>
        public void AnimatePan(Point point)
        {
            PointAnimation animator = new PointAnimation();

            animator.From = Centre;
            animator.To   = point;
            animator.DecelerationRatio = 0.5;
            animator.Duration          = TimeSpan.FromSeconds(0.3);
            animator.FillBehavior      = FillBehavior.Stop;

            animator.Completed += delegate
            {
                Centre = point;
                // OnFinishedMoving();
            };

            BeginAnimation(CentreProperty, animator);
        }
예제 #10
0
        public static void ApplyPointAnimation(Storyboard existingStoryBoard, DependencyObject target, String targetName,
                                               String propertyName, Point oldPoint, Point newPoint, Double animationTime, Double beginTime)
        {
            PointAnimation pointAnimation = new PointAnimation();

            pointAnimation.From       = oldPoint;
            pointAnimation.To         = newPoint;
            pointAnimation.SpeedRatio = 2;
            pointAnimation.Duration   = new Duration(new TimeSpan(0, 0, 0, (int)animationTime * 1000));
            //pointAnimation.BeginTime = new TimeSpan(0, 0, 0, (int)beginTime * 1000);

            target.SetValue(FrameworkElement.NameProperty, targetName);

            Storyboard.SetTarget(pointAnimation, target);
            Storyboard.SetTargetProperty(pointAnimation, new PropertyPath(propertyName));
            Storyboard.SetTargetName(pointAnimation, (String)target.GetValue(FrameworkElement.NameProperty));

            existingStoryBoard.Children.Add(pointAnimation);
        }
예제 #11
0
        /// <summary>
        /// Moves and resizes the object.
        /// </summary>
        /// <param name="target">The target object.</param>
        /// <param name="position">Ending position.</param>
        /// <param name="width">New width.</param>
        /// <param name="height">New height.</param>
        /// <param name="milliseconds">Duration of the animation in milliseconds.</param>
        /// <param name="completed">Event handler called when animation completed.</param>
        public static void MoveAndResize(this DependencyObject target, Point position, double width, double height,
                                         double milliseconds, EventHandler completed = null)
        {
            Duration        duration         = new Duration(TimeSpan.FromMilliseconds(milliseconds));
            DoubleAnimation doubleAnimation1 = new DoubleAnimation();
            DoubleAnimation doubleAnimation2 = new DoubleAnimation();
            PointAnimation  pointAnimation   = new PointAnimation();

            doubleAnimation1.Duration = duration;
            doubleAnimation2.Duration = duration;
            pointAnimation.Duration   = duration;

            Storyboard storyboard = new Storyboard();

            storyboard.Duration = duration;

            storyboard.Children.Add(doubleAnimation1);
            storyboard.Children.Add(doubleAnimation2);
            storyboard.Children.Add(pointAnimation);

            Storyboard.SetTarget(doubleAnimation1, target);
            Storyboard.SetTarget(doubleAnimation2, target);
            Storyboard.SetTarget(pointAnimation, target);

            Storyboard.SetTargetProperty(doubleAnimation1, new PropertyPath("(Width)"));
            Storyboard.SetTargetProperty(doubleAnimation2, new PropertyPath("(Height)"));
            Storyboard.SetTargetProperty(pointAnimation, new PropertyPath("(Position)"));

            doubleAnimation1.To = width;
            if (!height.IsNotSet())
            {
                doubleAnimation2.To = height;
            }

            pointAnimation.To = position;

            if (completed != null)
            {
                storyboard.Completed += completed;
            }

            storyboard.Begin();
        }
예제 #12
0
        /// <summary>
        /// Creats animation for shifting all lines according to Y axis
        /// </summary>
        /// <param name="value"></param>
        private void ShiftYVisibleField(double value)
        {
            pointsY = new List <Point>();
            PointAnimation shiftYAnimationS = new PointAnimation(new Point(_pathFigureOfMainLine.StartPoint.X, _bottomOfChart)
                                                                 , _durationOfAnimations);

            _pathFigureOfMainLine.BeginAnimation(PathFigure.StartPointProperty, shiftYAnimationS);

            foreach (LineSegment lineSegment in _pathFigureOfMainLine.Segments)
            {
                PointAnimation shiftYAnimation = new PointAnimation(new Point(lineSegment.Point.X, lineSegment.Point.Y + value)
                                                                    , _durationOfAnimations);

                pointsY.Add(new Point(lineSegment.Point.X, lineSegment.Point.Y + value));

                shiftYAnimation.Completed += ShiftYAnimation_Completed;
                lineSegment.BeginAnimation(LineSegment.PointProperty, shiftYAnimation);
            }
        }
예제 #13
0
        private void AnimateToCropRectangle(Rect thumbsRectangle, Rect imageRectangle)
        {
            var storyboard = new Storyboard();
            var ease       = new CubicEase {
                EasingMode = EasingMode.EaseInOut
            };

            storyboard.Children.Add(CreateAnimation(thumbsRectangle.Width, m_thumbsContainer, "FrameworkElement.Width", ease, true));
            storyboard.Children.Add(CreateAnimation(thumbsRectangle.Height, m_thumbsContainer, "FrameworkElement.Height", ease, true));
            storyboard.Children.Add(CreateAnimation(thumbsRectangle.Left, m_thumbsContainer, "(Canvas.Left)", ease, false));
            storyboard.Children.Add(CreateAnimation(thumbsRectangle.Top, m_thumbsContainer, "(Canvas.Top)", ease, false));

            storyboard.Children.Add(CreateAnimation(imageRectangle.Width / m_imageSize.Width, m_imageThumbTransform, "CompositeTransform.ScaleX", ease, false));
            storyboard.Children.Add(CreateAnimation(imageRectangle.Height / m_imageSize.Height, m_imageThumbTransform, "CompositeTransform.ScaleY", ease, false));
            storyboard.Children.Add(CreateAnimation((imageRectangle.Width - thumbsRectangle.Width) / 2.0 - thumbsRectangle.X + imageRectangle.X, m_imageThumbTransform, "CompositeTransform.TranslateX", ease, false));
            storyboard.Children.Add(CreateAnimation((imageRectangle.Height - thumbsRectangle.Height) / 2.0 - thumbsRectangle.Y + imageRectangle.Y, m_imageThumbTransform, "CompositeTransform.TranslateY", ease, false));

            switch (m_innerClip)
            {
            case RectangleGeometry rectangle:
                rectangle.Rect = thumbsRectangle;
                break;

            case EllipseGeometry ellipse:
                var centerAnimation = new PointAnimation();
                centerAnimation.To                       = new Point(thumbsRectangle.Left + thumbsRectangle.Width / 2, thumbsRectangle.Top + thumbsRectangle.Height / 2);
                centerAnimation.EasingFunction           = ease;
                centerAnimation.Duration                 = TimeSpan.FromMilliseconds(300);
                centerAnimation.EnableDependentAnimation = true;

                Storyboard.SetTarget(centerAnimation, ellipse);
                Storyboard.SetTargetProperty(centerAnimation, "EllipseGeometry.Center");

                storyboard.Children.Add(centerAnimation);

                storyboard.Children.Add(CreateAnimation(thumbsRectangle.Width / 2.0, ellipse, "EllipseGeometry.RadiusX", ease, true));
                storyboard.Children.Add(CreateAnimation(thumbsRectangle.Height / 2.0, ellipse, "EllipseGeometry.RadiusY", ease, true));
                break;
            }

            storyboard.Begin();
        }
예제 #14
0
        /// <summary>
        /// Sets the pointer animation to execute and sets the time to animate. This allow the same
        /// code to handle normal operation using the Dashboard.AnimationDuration or for dragging the
        /// needle during bidirectional operation (TimeSpan.Zero)
        /// </summary>
        /// <param name="normalizedValue">The normalized Value.</param>
        /// <param name="duration">The duration.</param>
        private void SetPointerByAnimationOverSetTime(double normalizedValue, TimeSpan duration)
        {
            double         pos = normalizedValue * 100;
            PointAnimation pa  = GetChildPointAnimation(AnimateIndicatorStoryboard, "_startPoint");

            pa.To       = new Point(pos, 0);
            pa.Duration = new Duration(duration);
            pa          = GetChildPointAnimation(AnimateIndicatorStoryboard, "_topLeft");
            pa.To       = new Point(pos, 0);
            pa.Duration = new Duration(duration);
            pa          = GetChildPointAnimation(AnimateIndicatorStoryboard, "_botLeft");
            pa.To       = new Point(pos, 15);
            pa.Duration = new Duration(duration);

            Start(AnimateIndicatorStoryboard);
            SplineDoubleKeyFrame s = SetFirstChildSplineDoubleKeyFrameTime(AnimateGrabHandleStoryboard, pos - 10);

            s.KeyTime = KeyTime.FromTimeSpan(duration);
            Start(AnimateGrabHandleStoryboard);
        }
예제 #15
0
파일: BookPage.xaml.cs 프로젝트: mvkolos/BM
        private void TurnPage(int duration)
        {
            Status = PageStatus.TurnAnimation;

            UIElement source = this as UIElement;

            CornerPoint = _cornerPoint;

            //this.BeginAnimation(BookPage.CornerPointProperty, null);
            PointAnimation anim =
                new PointAnimation(
                    OriginToOppositePoint(this, origin),
                    new Duration(TimeSpan.FromMilliseconds(duration)));

            anim.AccelerationRatio = 0.6;

            anim.CurrentTimeInvalidated += new EventHandler(anim_CurrentTimeInvalidated);
            anim.Completed += new EventHandler(anim_Completed);
            // this.BeginAnimation(BookPage.CornerPointProperty, anim);
        }
예제 #16
0
        private void InitializeStoryboard()
        {
            _pointAnimation = new PointAnimation()
            {
                To             = new Point(),
                Duration       = new Duration(TimeSpan.FromSeconds(0.5)),
                EasingFunction = new CubicEase()
            };
            Storyboard.SetTarget(_pointAnimation, this);
            Storyboard.SetTargetProperty(_pointAnimation, new PropertyPath("Location"));

            _locationAnimator = new Storyboard();
            _locationAnimator.Children.Add(_pointAnimation);
            _locationAnimator.Completed += delegate
            {
                _isAnimating = false;
                var pt = _pointAnimation.To.Value;
                Location = pt;
            };
        }
        /// <summary>
        /// Setup the animation for the point
        /// </summary>
        /// <param name="element">Element to run the animation on</param>
        /// <param name="prop">Property to run the animation on</param>
        /// <param name="from">starting point</param>
        /// <param name="to">destination point</param>
        /// <param name="acceleration">acceleration rate</param>
        /// <param name="deceleration">deceleration rate</param>
        /// <param name="durationMS">duration of the animation in milliseconds</param>
        /// <param name="callbackFunc">callback function</param>
        public static AnimationClock AnimatePointEasingEquation(
            DependencyObject element,
            DependencyProperty prop,
            Point?from,
            Point to,
            int durationMS,
            double?acceleration,
            double?deceleration,
            EventHandler callbackFunc)
        {
            Point defaultFrom = element.GetValue(prop) == null ?
                                new Point(0, 0) :
                                (Point)element.GetValue(prop);

            PointAnimation anim = new PointAnimation();

            anim.From = from.GetValueOrDefault(defaultFrom);
            anim.To   = to;

            return(Animate(element, prop, anim, durationMS, null, null, callbackFunc));
        }
        private void UpdateGradientAnimation()
        {
            if (this.to != null)
            {
                this.startPointAnimator = new PointAnimation(this.to.StartPoint, this.Duration);
                this.endPointAnimator   = new PointAnimation(this.to.EndPoint, this.Duration);

                this.gradientStopAnimations = new GradientStopAnimator[this.to.GradientStops.Count];

                for (int GradientStopIndex = 0; GradientStopIndex < this.to.GradientStops.Count; GradientStopIndex++)
                {
                    this.gradientStopAnimations[GradientStopIndex] = new GradientStopAnimator(this.to.GradientStops[GradientStopIndex], this.Duration);
                }
            }
            else
            {
                this.startPointAnimator     = null;
                this.endPointAnimator       = null;
                this.gradientStopAnimations = null;
            }
        }
예제 #19
0
        /// <summary>
        /// We construct the docking animation in code since dynamic
        /// property binding support is limited in user controls
        /// </summary>
        /// <param name="target"></param>
        /// <param name="durationInMilliseconds"></param>
        public DockAnimation(DockableScatterViewItem target, float durationInMilliseconds)
        {
            _dockableScatterViewItem = target;

            StoryboardDuration = durationInMilliseconds;

            DockStoryboard = new Storyboard();
            DockStoryboard.FillBehavior = FillBehavior.Stop;
            DockStoryboard.Completed   += DockStoryboard_Completed;

            OrientationAnimation = new DoubleAnimation();
            DockStoryboard.Children.Add(OrientationAnimation);

            PositionAnimation = new PointAnimation();
            DockStoryboard.Children.Add(PositionAnimation);

            Storyboard.SetTarget(OrientationAnimation, target);
            Storyboard.SetTargetProperty(OrientationAnimation, new PropertyPath(DockableScatterViewItem.OrientationProperty));

            Storyboard.SetTarget(PositionAnimation, target);
            Storyboard.SetTargetProperty(PositionAnimation, new PropertyPath(DockableScatterViewItem.CenterProperty));
        }
        private void f2()
        {
            Point        pt1   = new Point(10, 10);
            Point        pt1to = new Point(100, 120);
            Point        pt2   = new Point(100, 10);
            Point        pt2to = new Point(150, 30);
            Point        pt3   = new Point(50, 50);
            Point        pt3to = new Point(30, 80);
            PathGeometry pgeom = new PathGeometry();
            PathFigure   pfig1 = new PathFigure();
            LineSegment  ls1   = new LineSegment(pt1, true);
            LineSegment  ls2   = new LineSegment(pt2, true);
            LineSegment  ls3   = new LineSegment(pt3, true);

            PointAnimation pa1 = new PointAnimation(pt1to, new Duration(new TimeSpan(0, 0, 4)));
            PointAnimation pa2 = new PointAnimation(pt2to, new Duration(new TimeSpan(0, 0, 4)));
            PointAnimation pa3 = new PointAnimation(pt3to, new Duration(new TimeSpan(0, 0, 4)));

            pfig1.StartPoint = pt3;
            pfig1.Segments.Add(ls1);
            pfig1.Segments.Add(ls2);
            pfig1.Segments.Add(ls3);

            pgeom.Figures.Add(pfig1);
            Path myPath = new Path();

            myPath.Stroke          = Brushes.Black;
            myPath.StrokeThickness = 3;
            myPath.Fill            = Brushes.Blue;
            myPath.Data            = pgeom;

            // Add this to the Grid I named 'MyGrid'
            mainGrid.Children.Add(myPath);

            ls1.BeginAnimation(LineSegment.PointProperty, pa1);
            ls2.BeginAnimation(LineSegment.PointProperty, pa2);
            ls3.BeginAnimation(LineSegment.PointProperty, pa3);
            pfig1.BeginAnimation(PathFigure.StartPointProperty, pa3);
        }
예제 #21
0
        private async Task ChangePage(Step step)
        {
            var timeSpan   = TimeSpan.FromMilliseconds(1200);
            var timeSpan2  = TimeSpan.FromMilliseconds(600);
            var duration   = new Duration(timeSpan);
            var duration2  = new Duration(timeSpan2);
            var stepInt    = (int)step;
            var toS        = -2 + 2 * stepInt / 4;
            var toE        = 1 + 2 * stepInt / 4;
            var animationS = new PointAnimation(new Point(0.5, toS), duration);
            var animationE = new PointAnimation(new Point(0.5, toE), duration);

            winBg.BeginAnimation(LinearGradientBrush.StartPointProperty, animationS);
            winBg.BeginAnimation(LinearGradientBrush.EndPointProperty, animationE);

            var disappearAnimation = new DoubleAnimation(0, duration2);
            var appearAnimation    = new DoubleAnimation(1, duration2);

            grid.Children[(int)currentStep].BeginAnimation(UIElement.OpacityProperty, disappearAnimation);
            await Task.Delay(timeSpan2);

            grid.Children[(int)currentStep].Visibility = Visibility.Collapsed;
            grid.Children[stepInt].Visibility          = Visibility.Visible;

            grid.Children[stepInt].BeginAnimation(UIElement.OpacityProperty, appearAnimation);
            await Task.Delay(timeSpan2);

            currentStep = step;

            if (currentStep == Step.SelectLanguage)
            {
                languageLb.Focus();
            }
            if (currentStep == Step.Welcome)
            {
                handleBar.Visibility = Visibility.Collapsed;
            }
        }
예제 #22
0
        /// <summary>
        /// Moves and resizes the object.
        /// </summary>
        /// <param name="target">The target object.</param>
        /// <param name="storyboard">The storyboard.</param>
        /// <param name="position">Ending position.</param>
        /// <param name="width">New width.</param>
        /// <param name="height">New height.</param>
        /// <param name="milliseconds">Duration of the animation in milliseconds.</param>
        public static void MoveAndResize(this DependencyObject target, Storyboard storyboard, Point position, double width, double height,
                                         double milliseconds)
        {
            Duration        duration         = new Duration(TimeSpan.FromMilliseconds(milliseconds));
            DoubleAnimation doubleAnimation1 = new DoubleAnimation()
            {
                To = width, Duration = duration
            };                                                                                      //note: Silverlight doesn't support parameters in DoubleAnimation's constructor
            DoubleAnimation doubleAnimation2 = new DoubleAnimation();
            PointAnimation  pointAnimation   = new PointAnimation()
            {
                To = position, Duration = duration
            };

            doubleAnimation2.Duration = duration;
            if (!height.IsNotSet())
            {
                doubleAnimation2.To = height;
            }

            storyboard.Stop();
            storyboard.Children.Clear();
            storyboard.Duration = duration;

            storyboard.Children.Add(doubleAnimation1);
            storyboard.Children.Add(doubleAnimation2);
            storyboard.Children.Add(pointAnimation);

            Storyboard.SetTarget(doubleAnimation1, target);
            Storyboard.SetTarget(doubleAnimation2, target);
            Storyboard.SetTarget(pointAnimation, target);

            Storyboard.SetTargetProperty(doubleAnimation1, new PropertyPath("(Width)"));
            Storyboard.SetTargetProperty(doubleAnimation2, new PropertyPath("(Height)"));
            Storyboard.SetTargetProperty(pointAnimation, new PropertyPath("(Position)"));

            storyboard.Begin();
        }
예제 #23
0
        private void button3_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            w = (int)this.image.ActualWidth;           //image的宽、高
            h = (int)this.image.ActualHeight;
            EllipseGeometry eg = new EllipseGeometry();

            p1                   = new Point(0, 0);
            eg.Center            = p1;
            eg.RadiusX           = 12;
            eg.RadiusY           = 12;
            path                 = new Path();
            path.Fill            = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0));//绿色
            path.StrokeThickness = 0;
            path.Data            = eg;
            //层次设置,SetZIndex设置Z轴(正方向面对读者)顺序,数值越大离桌面越远
            //默认值0,附于桌面
            Canvas.SetZIndex(path, 3);                                //置于现有对象顶层
            this.canvas1.Children.Add(path);                          //椭圆作为canvas1的子对象
            timer.Interval         = TimeSpan.FromMilliseconds(2000); //定时
            timer.Tick            += new EventHandler(timerTick);
            pa                     = new PointAnimation();
            pa.Duration            = new Duration(TimeSpan.FromMilliseconds(1000));
            sb3                    = new Storyboard();
            this.sb3.Completed    += new System.EventHandler(Storyboard3_Completed);
            this.button1.IsEnabled = false;
            this.button2.IsEnabled = false;
            this.button3.IsEnabled = false;
            this.button4.IsEnabled = false;
            sb3.RepeatBehavior     = new RepeatBehavior(5); //故事板运行5次
            sb3.Duration           = pa.Duration;           //故事板时间间隔
            sb3.Children.Add(pa);                           //故事板添加动画对象
            Storyboard.SetTargetProperty(pa, new PropertyPath("Center"));
            //设置故事板启动的动画及目标对象
            Storyboard.SetTarget(pa, eg);
            sb3.BeginTime = TimeSpan.FromSeconds(2);
            timer.Start();
            sb3.Begin();
        }
예제 #24
0
        public static AnimationClock AnimateElementPoint(DependencyObject element, DependencyProperty property, Point targetValue, double fromTime, double toTime, IEasingFunction ease = null)
        {
            if (!(element is IAnimatable))
            {
                throw new InvalidOperationException("Element must be IAnimatable.");
            }

            StopAnimation(element, property);

            if (ease == null)
            {
                ease = new CircleEase();
            }

            Point initialValue = (Point)element.GetValue(property);

            PointAnimation anim = new PointAnimation(initialValue, targetValue, new Duration(TimeSpan.FromSeconds(toTime - fromTime)));

            anim.EasingFunction = ease;

            //PointAnimationUsingKeyFrames anim = new PointAnimationUsingKeyFrames();

            //anim.KeyFrames.Add(new SplinePointKeyFrame(initialValue,
            //                            KeyTime.FromTimeSpan(TimeSpan.FromSeconds(fromTime))));
            //anim.KeyFrames.Add(new SplinePointKeyFrame(targetValue,
            //                            KeyTime.FromTimeSpan(TimeSpan.FromSeconds(toTime))
            //                            , new KeySpline(0.0, 0, 0.05, 1))
            //                         );

            if (fromTime > 0.0)
            {
                return(AnimateElementDelayHelper(element, property, anim, fromTime));
            }
            else
            {
                return(AnimateElementHelper(element, property, anim));
            }
        }
예제 #25
0
        private void SetupTracker()
        {
            if (TargetTracker != null)
            {
                TargetTracker.PositionChanged += TargetTracker_PositionChanged;

                _TargetPointAnimation = new PointAnimation();
                Storyboard.SetTarget(_TargetPointAnimation, TargetTracker);
                Storyboard.SetTargetProperty(_TargetPointAnimation, "Position");
                _TargetPointAnimation.EasingFunction = new ElasticEase()
                {
                    EasingMode = EasingMode.EaseOut, Oscillations = 1, Springiness = 0.5
                };
                _TargetPointAnimation.EnableDependentAnimation = true;
                _TargetPointAnimation.Duration = TimeSpan.FromSeconds(0.2d);
                _TargetPointAnimation.To       = new Point(0, 0);

                TargetMoveComplateAnimation = new Storyboard();
                TargetMoveComplateAnimation.Children.Add(_TargetPointAnimation);
                TargetMoveComplateAnimation.Completed += TargetMoveComplateAnimation_Completed;
            }
            if (SourceTracker != null)
            {
                SourceTracker.PositionChanged += SourceTracker_PositionChanged;

                _SourcePointAnimation = new PointAnimation();
                Storyboard.SetTarget(_SourcePointAnimation, SourceTracker);
                Storyboard.SetTargetProperty(_SourcePointAnimation, "Position");
                _SourcePointAnimation.EnableDependentAnimation = true;
                _SourcePointAnimation.Duration = TimeSpan.FromSeconds(0.05d);
                _SourcePointAnimation.From     = new Point(0, 0);

                SourceMoveComplateAnimation = new Storyboard();
                SourceMoveComplateAnimation.Children.Add(_SourcePointAnimation);
                SourceMoveComplateAnimation.Completed += SourceMoveComplateAnimation_Completed;
            }
        }
예제 #26
0
        private static Point?GetTargetPoint(Timeline timeline, bool isEntering)
        {
            PointAnimation pa = timeline as PointAnimation;

            if (pa != null)
            {
                return(pa.From.HasValue ? pa.From : pa.To);
            }

            PointAnimationUsingKeyFrames pak = timeline as PointAnimationUsingKeyFrames;

            if (pak != null)
            {
                if (pak.KeyFrames.Count == 0)
                {
                    return(null);
                }

                PointKeyFrame keyFrame = pak.KeyFrames[isEntering ? 0 : pak.KeyFrames.Count - 1];
                return(keyFrame.Value);
            }

            return(null);
        }
        /// <summary>
        ///     Sets item window visible and animates it.
        /// </summary>
        private void SetItemWindowVisible()
        {
            var startingPosition = new Point(960, 160);
            var endingPosition   = new Point(960, 500);
            var d = new Duration(TimeSpan.FromMilliseconds(500));

            sviItemWindow.Center = startingPosition;

            sviItemWindow.Visibility = Visibility.Visible;

            var ani = new PointAnimation(startingPosition, endingPosition, d);

            var sb = new Storyboard();

            sb.Children.Add(ani);

            Storyboard.SetTarget(ani, sviItemWindow);
            Storyboard.SetTargetProperty(ani, new PropertyPath("Center"));
            ani.FillBehavior = FillBehavior.Stop;

            sb.Begin();
            sviItemWindow.Center = endingPosition;
            AddView("sviItemWindow");
        }
        private void UpdateMenuBar()
        {
            const double newOrientation = 0;
            double       orientation    = menuBar.ActualOrientation;

            var d  = new Duration(TimeSpan.FromMilliseconds(300));
            var da = new DoubleAnimation(orientation, newOrientation, d);
            var sb = new Storyboard();

            sb.Children.Add(da);

            Storyboard.SetTarget(da, menuBar);
            Storyboard.SetTargetProperty(da, new PropertyPath("Orientation"));
            sb.FillBehavior = FillBehavior.Stop;

            sb.Begin();
            menuBar.Orientation = newOrientation;

            var point = new Point(menuBar.Center.X, menuBar.Center.Y);

            point.X = 360;
            point.Y = 530;

            var da2 = new PointAnimation(menuBar.ActualCenter, point, d);

            var sb2 = new Storyboard();

            sb2.Children.Add(da2);

            Storyboard.SetTarget(da2, menuBar);
            Storyboard.SetTargetProperty(da2, new PropertyPath("Center"));
            sb2.FillBehavior = FillBehavior.Stop;

            sb2.Begin();
            menuBar.Center = point;
        }
예제 #29
0
        /// <summary>
        /// 创建Point值之间的线性动画
        /// </summary>
        public static PointAnimation BuildPointAnimation(PointModel Model)
        {
            PointAnimation _pointAnimation = new PointAnimation();

            _pointAnimation.From           = Model.From;
            _pointAnimation.To             = Model.To;
            _pointAnimation.Duration       = new Duration(TimeSpan.FromSeconds(Model.Duration));
            _pointAnimation.AutoReverse    = Model.AutoReverse;
            _pointAnimation.BeginTime      = TimeSpan.FromSeconds(Model.BeginTime);
            _pointAnimation.By             = Model.By;
            _pointAnimation.FillBehavior   = Model.FillBehavior;
            _pointAnimation.RepeatBehavior = Model.RepeatBehavior;
            _pointAnimation.SpeedRatio     = Model.SpeedRatio;

            if (Model.EasingFunction != null)
            {
                _pointAnimation.EasingFunction = Model.EasingFunction;
            }


            Storyboard.SetTarget(_pointAnimation, Model.Target);
            Storyboard.SetTargetProperty(_pointAnimation, new PropertyPath(Model.PropertyPath));
            return(_pointAnimation);
        }
예제 #30
0
        /*!
         * \fn void showShootTrace()
         * \brief Affiche l'animation de la trace du shoot sur l'ecran de jeu
         * \return
         */
        public virtual void showShootTrace()
        {
            List <double> shootList = App.wrapper.getLastShootTrace();
            Storyboard    sb        = new Storyboard();

            for (int i = 0; i + 2 < shootList.Count;)
            {
                LineGeometry l  = new LineGeometry();
                double       x1 = shootList[i] * sqLong;
                i++;
                double y1 = shootList[i] * sqHaut;
                i++;
                double x2 = shootList[i] * sqLong;
                double y2 = shootList[i + 1] * sqHaut;
                l.StartPoint = new Point(x1, y1);
                l.EndPoint   = new Point(x1, y1);
                Point          realEndPoint = new Point(x2, y2);
                PointAnimation pointAnim    = new PointAnimation();
                PointAnimation pointAnim2   = new PointAnimation();
                pointAnim.From       = l.StartPoint;
                pointAnim2.From      = l.StartPoint;
                pointAnim.To         = realEndPoint;
                pointAnim2.To        = realEndPoint;
                pointAnim.Duration   = TimeSpan.FromMilliseconds(100);
                pointAnim2.Duration  = TimeSpan.FromMilliseconds(300);
                pointAnim.BeginTime  = TimeSpan.FromMilliseconds(i * 100 - 100);
                pointAnim2.BeginTime = TimeSpan.FromMilliseconds(i * 100);
                l.BeginAnimation(LineGeometry.EndPointProperty, pointAnim);
                l.BeginAnimation(LineGeometry.StartPointProperty, pointAnim2);
                Path myPath = new Path();
                myPath.StrokeThickness = 2;
                myPath.Stroke          = System.Windows.Media.Brushes.Cyan;
                myPath.Data            = l;
                gridGame2.Children.Add(myPath);
            }
        }
예제 #31
0
        private void CenterAnimationCompleted(object sender, object e)
        {
            if (centerAnimation != null)
            {
                centerAnimation.Completed -= CenterAnimationCompleted;
                centerAnimation = null;

                InternalSetValue(CenterProperty, TargetCenter);
                InternalSetValue(CenterPointProperty, mapTransform.Transform(TargetCenter));
                RemoveAnimation(CenterPointProperty); // remove holding animation in WPF

                ResetTransformOrigin();
                UpdateTransform();
            }
        }
예제 #32
0
        private void TargetCenterPropertyChanged(Location targetCenter)
        {
            if (!internalPropertyChange)
            {
                AdjustCenterProperty(TargetCenterProperty, ref targetCenter);

                if (!targetCenter.Equals(Center))
                {
                    if (centerAnimation != null)
                    {
                        centerAnimation.Completed -= CenterAnimationCompleted;
                    }

                    // animate private CenterPoint property by PointAnimation
                    centerAnimation = new PointAnimation
                    {
                        From = mapTransform.Transform(Center),
                        To = mapTransform.Transform(targetCenter, Center.Longitude),
                        Duration = AnimationDuration,
                        EasingFunction = AnimationEasingFunction
                    };

                    centerAnimation.Completed += CenterAnimationCompleted;
                    this.BeginAnimation(CenterPointProperty, centerAnimation);
                }
            }
        }
    private void MoveGhostToMousePosition( Point mousePosition )
    {
      // Ensure the opacity of the ghost is correctly set
      this.ShowDraggedColumnGhosts();

      Point currentAdornerPosition = mousePosition;

      if( m_elementToDraggedElementAdorner.Count == 0 )
        return;

      int remainingDuration = this.ReturnToOriginalPositionDuration;

      if( m_ghostToMousePositionAnimationClock != null )
      {
        PointAnimation pointAnimation = m_ghostToMousePositionAnimationClock.Timeline as PointAnimation;

        Point currentValue = pointAnimation.To.GetValueOrDefault();

        double deltaX = currentValue.X - mousePosition.X;
        double deltaY = currentValue.Y - mousePosition.Y;

        bool dragingX = Math.Abs( deltaX ) > SystemParameters.MinimumHorizontalDragDistance;
        bool dragingY = Math.Abs( deltaY ) > SystemParameters.MinimumVerticalDragDistance;

        // If the target value is already the correct one, no need to stop animation and create another one
        if( ( pointAnimation != null ) && ( !dragingX && !dragingY ) )
        {
          return;
        }
        else
        {
          if( m_ghostToMousePositionAnimationClock.CurrentState == ClockState.Active )
          {
            // The remaining duration is the Timeline Duration less the elapsed time
            remainingDuration = pointAnimation.Duration.TimeSpan.Milliseconds - m_ghostToMousePositionAnimationClock.CurrentTime.Value.Milliseconds;
          }
        }
      }

      this.PauseGhostToMousePositionAnimation();

      PointAnimation animation = new PointAnimation( currentAdornerPosition, mousePosition, new Duration( TimeSpan.FromMilliseconds( remainingDuration ) ) );

      m_ghostToMousePositionAnimationClock = animation.CreateClock( true ) as AnimationClock;
      m_ghostToMousePositionAnimationClock.Completed += this.GhostToMousePosition_Completed;

      foreach( var adorner in this.GetElementAdorners() )
      {
        adorner.ApplyAnimationClock( DraggedElementAdorner.OffsetProperty, m_ghostToMousePositionAnimationClock, HandoffBehavior.SnapshotAndReplace );
      }

      m_ghostToMousePositionAnimationClock.Controller.Begin();
    }
    private void MoveGhostToTargetAndDetach()
    {
      if( m_elementToDraggedElementAdorner.Count == 0 )
      {
        this.DetachManager();
        return;
      }

      this.PauseMoveGhostToTargetAndDetachAnimation();

      var draggedCell = this.DraggedElement as Cell;
      if( draggedCell == null )
        return;

      var parentRow = draggedCell.ParentRow;
      if( ( parentRow == null ) || ( parentRow.CellsHostPanel == null ) )
        return;

      var draggedAdorner = m_elementToDraggedElementAdorner[ draggedCell ];
      var currentDraggedAdornerPosition = ( draggedAdorner != null ) ? draggedAdorner.Offset : default( Point );
      var fromPoint = currentDraggedAdornerPosition;

      if( draggedAdorner != null )
      {
        // Calculate the animation from the current ColumnManagerCell, since it could be a MergedColumnMangerCell dragging any number of columns.
        // If calculating the animation from a different cell, the animation could be starting from a wrong position and give a bad visual effect.
        var animations = this.ReorderingInfoManagerInstance.RequiredAnimations;
        if( animations.AnimateToLeft.Count > 0 )
        {
          var siblingCell = parentRow.Cells[ draggedCell.ParentColumn.PreviousVisibleColumn ];
          var targetPosition = siblingCell.PointToScreen( new Point( siblingCell.ActualWidth, 0d ) );
          var relativePosition = draggedAdorner.PointFromScreen( targetPosition );

          fromPoint = new Point( -relativePosition.X, -relativePosition.Y );
        }
        else if( animations.AnimateToRight.Count > 0 )
        {
          var siblingCell = parentRow.Cells[ draggedCell.ParentColumn.NextVisibleColumn ];
          var targetPosition = siblingCell.PointToScreen( new Point( -draggedCell.ActualWidth, 0d ) );
          var relativePosition = draggedAdorner.PointFromScreen( targetPosition );

          fromPoint = new Point( -relativePosition.X, -relativePosition.Y );
        }
      }

      PointAnimation animation = new PointAnimation( fromPoint, ColumnReorderingDragSourceManager.EmptyPoint, m_columnAnimationDuration );

      m_ghostToTargetAndDetachAnimationClock = animation.CreateClock( true ) as AnimationClock;
      m_ghostToTargetAndDetachAnimationClock.Completed += this.MoveGhostToTargetAndDetach_Completed;

      //Animate all cells of all columns.
      foreach( var entry in this.GetElementAdornerEntries() )
      {
        var cell = entry.Key as Cell;
        if( cell == null )
        {
          Debug.Assert( false, "Only Cells should be dragged by this manager" );
          continue;
        }

        var adorner = entry.Value;
        adorner.ApplyAnimationClock( DraggedElementAdorner.OffsetProperty, m_ghostToTargetAndDetachAnimationClock, HandoffBehavior.SnapshotAndReplace );
      }

      m_ghostToTargetAndDetachAnimationClock.Controller.Begin();
    }
    private void MoveGhostToTargetColumn( Point mousePostion )
    {
      if( m_elementToDraggedElementAdorner.Count == 0 )
        return;

      int remainingDuration = this.ReturnToOriginalPositionDuration;

      if( m_ghostToTargetColumnAnimationClock != null )
      {
        PointAnimation pointAnimation = m_ghostToTargetColumnAnimationClock.Timeline as PointAnimation;

        // If the target value is already the correct one, no need to stop animation and create another one
        if( ( pointAnimation != null ) && ( pointAnimation.To == ColumnReorderingDragSourceManager.EmptyPoint ) )
        {
          return;
        }
        else
        {
          if( m_ghostToTargetColumnAnimationClock.CurrentState == ClockState.Active )
          {
            // The remaining duration is the Timeline Duration less the elapsed time
            remainingDuration = pointAnimation.Duration.TimeSpan.Milliseconds - m_ghostToTargetColumnAnimationClock.CurrentTime.Value.Milliseconds;
          }
        }
      }

      // We must apply the DraggedCell FadeIn animation to let the DraggedCell reappears while the ghosts are moving to their target position
      this.ApplyDraggedElementFadeInAnimation();

      this.PauseMoveGhostToTargetColumnAnimation();

      PointAnimation animation = new PointAnimation( mousePostion, ColumnReorderingDragSourceManager.EmptyPoint, new Duration( TimeSpan.FromMilliseconds( remainingDuration ) ) );

      m_ghostToTargetColumnAnimationClock = animation.CreateClock( true ) as AnimationClock;
      m_ghostToTargetColumnAnimationClock.Completed += this.GhostToTargetAnimation_Completed;

      foreach( var adorner in this.GetElementAdorners() )
      {
        adorner.ApplyAnimationClock( DraggedElementAdorner.OffsetProperty, m_ghostToTargetColumnAnimationClock, HandoffBehavior.SnapshotAndReplace );
      }
    }
    private void MoveGhostToTargetAndDetach()
    {
      if( m_elementToDraggedElementAdorner.Count == 0 )
      {
        this.DetachManager();
        return;
      }

      this.PauseMoveGhostToTargetAndDetachAnimation();

      Cell draggedCell = this.DraggedElement as Cell;

      if( draggedCell == null )
        return;

      bool animationInitialized = false;

      DraggedElementAdorner draggedAdorner = m_elementToDraggedElementAdorner[ draggedCell ];

      Nullable<Point> currentDraggedAdornerPosition = null;

      if( draggedAdorner != null )
      {
        currentDraggedAdornerPosition = draggedAdorner.Offset;
      }

      foreach( UIElement element in m_elementToDraggedElementAdorner.Keys )
      {
        Cell cell = element as Cell;

        if( cell == null )
        {
          Debug.Assert( false, "Only Cells should be dragged by this manager" );
          continue;
        }

        DraggedElementAdorner adorner = m_elementToDraggedElementAdorner[ element ];

        if( !animationInitialized )
        {
          TableViewColumnVirtualizationManager columnVirtualizationManager = this.DraggedDataGridContext.ColumnVirtualizationManager as TableViewColumnVirtualizationManager;

          if( columnVirtualizationManager == null )
            return;

          double offset = columnVirtualizationManager.FieldNameToOffset[ draggedCell.FieldName ];

          if( ( draggedCell.ParentRow == null ) || ( draggedCell.ParentRow.CellsHostPanel == null ) )
            return;

          // Get the position of the Mouse according to the DragContainer
          Point mouseToDragContainer = Mouse.GetPosition( this.DragContainer );

          // Get the position of the Mouse according to the DraggedElementAdorner
          Point adornerToMouse = Mouse.GetPosition( adorner );

          // Get the position of the Cell according to the ParentRow.CellsHostPanel for the dragged Cell
          Panel cellsHost = cell.ParentRow.CellsHostPanel;
          Point newCellInCellsHostToDragContainer = cellsHost.TranslatePoint( new Point( offset, 0 ), this.DragContainer );

          // Get the position of the Cell according to its CellsHost in order to know
          // if it was dragged from the Fixed to the Scrolling Cells.
          Point cellToCellsHost = cell.TranslatePoint( ColumnReorderingDragSourceManager.EmptyPoint, cell.ParentRow.CellsHostPanel );

          double initialX = mouseToDragContainer.X - newCellInCellsHostToDragContainer.X - adornerToMouse.X;

          // The DraggedCell is a FixedCell and it offset is greater than  the FixedColumnWidth
          if( columnVirtualizationManager.FixedFieldNames.Contains( cell.FieldName ) && ( cellToCellsHost.X > columnVirtualizationManager.FixedColumnsWidth ) )
          {
            // In this case, we must take the HorizontalOffset into consideration
            initialX -= this.DraggedDataGridContext.DataGridControl.ScrollViewer.HorizontalOffset;
          }
          else
          {
            // The offset of the Cell according the CellsHost is less than 0 and
            // there is a Compensation offset to ensure all the ScrollingCells are
            // in view even if the HorizontalOffset would have scrolled them
            // outside the ViewPort
            if( ( ( newCellInCellsHostToDragContainer.X - columnVirtualizationManager.FixedColumnsWidth ) < 0 ) && ( columnVirtualizationManager.FirstColumnCompensationOffset > 0 ) )
            {
              initialX -= columnVirtualizationManager.FirstColumnCompensationOffset;
            }
          }

          Point fromPoint = new Point( initialX, currentDraggedAdornerPosition.GetValueOrDefault().Y );

          PointAnimation animation = new PointAnimation( fromPoint, ColumnReorderingDragSourceManager.EmptyPoint, m_columnAnimationDuration );

          m_ghostToTargetAndDetachAnimationClock = animation.CreateClock( true ) as AnimationClock;
          m_ghostToTargetAndDetachAnimationClock.Completed += this.MoveGhostToTargetAndDetach_Completed;

          animationInitialized = true;
        }

        adorner.ApplyAnimationClock( DraggedElementAdorner.OffsetProperty, m_ghostToTargetAndDetachAnimationClock, HandoffBehavior.SnapshotAndReplace );
      }

      m_ghostToTargetAndDetachAnimationClock.Controller.Begin();
    }