Ejemplo n.º 1
0
        private void UpdateEllipsePosition(Point point)
        {
            var left = LeftPositionConverter.Convert(point.X);
            var top  = TopPositionConverter.Convert(point.Y);

            Canvas.SetLeft(ellipse, left);
            Canvas.SetTop(ellipse, top);
        }
Ejemplo n.º 2
0
        private Storyboard CreateMoveEllipseStoryboard(Point point, TimeSpan duration)
        {
            Storyboard storyboard = new Storyboard();

            var animationTime = KeyTime.FromTimeSpan(duration);

            var animationLeft = CreateMoveAnimation(LeftPositionConverter.Convert(point.X), animationTime);

            Storyboard.SetTargetProperty(animationLeft, new PropertyPath(Canvas.LeftProperty));
            Storyboard.SetTarget(animationLeft, ellipse);

            storyboard.Children.Add(animationLeft);


            var animationTop = CreateMoveAnimation(TopPositionConverter.Convert(point.Y), animationTime);

            Storyboard.SetTargetProperty(animationTop, new PropertyPath(Canvas.TopProperty));
            Storyboard.SetTarget(animationTop, ellipse);

            storyboard.Children.Add(animationTop);

            return(storyboard);
        }