当前位置: 首页>>代码示例>>C#>>正文


C# Line.BeginAnimation方法代码示例

本文整理汇总了C#中Line.BeginAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# Line.BeginAnimation方法的具体用法?C# Line.BeginAnimation怎么用?C# Line.BeginAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Line的用法示例。


在下文中一共展示了Line.BeginAnimation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Move

 public static void Move(EBPrimitive distance)
 {
     Turtle.VerifyAccess();
     double animateTime = Math.Abs((double)distance.GetAsDecimal() * 320.0 / (double)(Turtle._speed * Turtle._speed));
     if (Turtle._speed == 10)
     {
         animateTime = 5.0;
     }
     double num = Turtle._angle / 180.0 * 3.1415926535897931;
     double newY = Turtle._currentY - distance * System.Math.Cos(num);
     double newX = Turtle._currentX + distance * System.Math.Sin(num);
     Shapes.Animate("_turtle", newX, newY, animateTime);
     if (Turtle._penDown)
     {
         GraphicsWindow.Invoke(delegate
         {
             string name = Shapes.GenerateNewName("_turtleLine");
             Line line = new Line
             {
                 Name = name,
                 X1 = Turtle._currentX,
                 Y1 = Turtle._currentY,
                 Stroke = GraphicsWindow._pen.Brush,
                 StrokeThickness = GraphicsWindow._pen.Thickness
             };
             GraphicsWindow.AddShape(name, line);
             DoubleAnimation animation = new DoubleAnimation
             {
                 From = new double?(Turtle._currentX),
                 To = new double?(newX),
                 Duration = new Duration(TimeSpan.FromMilliseconds(animateTime))
             };
             DoubleAnimation animation2 = new DoubleAnimation
             {
                 From = new double?(Turtle._currentY),
                 To = new double?(newY),
                 Duration = new Duration(TimeSpan.FromMilliseconds(animateTime))
             };
             line.BeginAnimation(Line.X2Property, animation);
             line.BeginAnimation(Line.Y2Property, animation2);
         });
     }
     Turtle._currentX = newX;
     Turtle._currentY = newY;
     Turtle.WaitForReturn(animateTime);
 }
开发者ID:exaphaser,项目名称:OmniBeanEB,代码行数:46,代码来源:Turtle.cs

示例2: AnimEdge

 /// <summary>
 /// Animates a single edge
 /// </summary>
 /// <param name="edge">Edge to be animated</param>
 /// <param name="opacityAnim">Animation to be used</param>
 /// <param name="animatedBrush">Brush to be used</param>
 /// <param name="colorAnim">Color to be used</param>
 private void AnimEdge(Line edge, DoubleAnimation opacityAnim, SolidColorBrush animatedBrush, ColorAnimation colorAnim)
 {
     animatedBrush.BeginAnimation(SolidColorBrush.ColorProperty, colorAnim);
     edge.Stroke = animatedBrush;
     edge.BeginAnimation(Line.OpacityProperty, opacityAnim);
 }
开发者ID:AndrejKolar,项目名称:GraphDecomposition,代码行数:13,代码来源:MainWindow.xaml.cs

示例3: UpdateTree

        private void UpdateTree(Task displayTask, MoveDirections dir)
        {
            TreeCanvas.Children.Clear();
            var children = displayTask.SelectChildrenTasks();
            var visual = new TaskVisual { Height = 150, Width = 150 };
            LevelUp.IsEnabled = displayTask.ParentId != -1;
            visual.Removing.IsEnabled = LevelUp.IsEnabled;
            visual.Desc.Text = displayTask.Description;
            visual.Date.Text = "С " + displayTask.BeginDate.ToShortDateString() + " по " +
                               displayTask.EndDate.ToShortDateString();
            TreeCanvas.Children.Add(visual);
            int i = children.Count + 1;
            _realCanvasWidth = visual.Width * i;
            OverflowCanvas();
            visual.SetValue(Canvas.LeftProperty, (TreeCanvas.MinWidth - visual.Width) / 2);
            visual.SetValue(Canvas.TopProperty, 20.0);
            visual.PreviewMouseLeftButtonDown += ClearStepChanger;
            _parent = visual;
            if (displayTask.ChildrenAreSteps())
            {
                visual.Add.Click += AddStep;
            }
            else
                visual.Add.Click += AddTask;
            bool evenCount = children.Count % 2 == 0;
            int center = children.Count / 2;
            var centerLeft = (double)visual.GetValue(Canvas.LeftProperty);
            int module = (i - 1) / 2;
            var anim = new ThicknessAnimation(dir == MoveDirections.Down ? new Thickness(0, -1000, 0, 200) : new Thickness(0, 200, 0, -1000), new Thickness(0, 0, 0, 0),
                                                  new Duration(TimeSpan.FromSeconds(1)));
            if (dir != MoveDirections.None)
                visual.BeginAnimation(MarginProperty, anim);
            visual.Background = !displayTask.HasUncomplitedTasks() ? Brushes.LimeGreen : Brushes.Orange;
            visual.Removing.Click += RemoveTask;
            visual.Edit.Click += EditTask;

            foreach (var task in children)
            {
                var child = new TaskVisual
                    {
                        Height = 150,
                        Width = 150,
                        Desc = { Text = task.Description },
                        Date =
                            {
                                Text = "С " + task.BeginDate.ToShortDateString() + " по " +
                                       task.EndDate.ToShortDateString()
                            },
                        Field = { Background = !task.HasUncomplitedTasks() ? Brushes.LimeGreen : Brushes.Orange }
                    };
                child.Removing.Visibility = Visibility.Collapsed;
                child.Edit.Visibility = Visibility.Collapsed;
                TreeCanvas.Children.Add(child);
                i--;
                double offset = !evenCount
                                    ? (i == center + 1
                                           ? centerLeft
                                           : (i > center + 1
                                                  ? centerLeft + (visual.Width + visual.Width / children.Count) * module
                                                  : centerLeft - (visual.Width + visual.Width / 2) * i))
                                    : (i > center
                                           ? centerLeft + visual.Width / 2 + visual.Width / children.Count / 2 +
                                             (visual.Width / children.Count + visual.Width) * (module - 1)
                                           : centerLeft - visual.Width / 2 - visual.Width / children.Count / 2 -
                                             (visual.Width / children.Count + visual.Width) * (i - 1));
                module--;

                child.SetValue(Canvas.LeftProperty, offset);
                child.SetValue(Canvas.TopProperty, visual.Height + 180);
                child.Add.Visibility = Visibility.Collapsed;
                var lane = new Line
                    {
                        StrokeThickness = 5,
                        Fill = Brushes.DarkCyan,
                        X1 = (double)visual.GetValue(Canvas.LeftProperty) + visual.Width / 2,
                        Y1 = 20 + visual.Height,
                        Stroke = Brushes.DarkCyan,
                        X2 = (double)child.GetValue(Canvas.LeftProperty) + child.Width / 2,
                        Y2 = (double)child.GetValue(Canvas.TopProperty),
                        SnapsToDevicePixels = true
                    };
                lane.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
                TreeCanvas.Children.Add(lane);

                if (dir != MoveDirections.None)
                {
                    child.BeginAnimation(MarginProperty, anim);
                    lane.BeginAnimation(MarginProperty, anim);
                }
                child.PreviewMouseLeftButtonUp += SelectChild;

            }
            if (TreeCanvas.Children.Count == 1)
            {
                visual.Width = visual.Height = 300;
            }
            if (displayTask.ChildrenAreSteps())
            {
                var steps = displayTask.SelectChildrenSteps();
                var list = new ListBox
//.........这里部分代码省略.........
开发者ID:ElGamzoGamingStudio,项目名称:DB-project,代码行数:101,代码来源:MainWindow.xaml.cs

示例4: Add

        public void Add(Gesture_Event_Linking link)
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                Gesture_Event_Linking temp = null;
                foreach (Gesture_Event_Linking gesture in cardLinks.Keys) {
                    if (gesture.Equals(link)) {
                        temp = gesture;
                    }
                }
                if (temp != null)
                {
                    Remove(temp);
                    return;
                }
                Line follower = new Line();
                follower.X1 = link.Card1.CurrentPosition.X;
                follower.Y1 = link.Card1.CurrentPosition.Y;

                follower.X2 = link.Points[0].CurrentPoint.Position.X;
                follower.Y2 = link.Points[0].CurrentPoint.Position.Y;
                follower.Stroke = new SolidColorBrush(link.Card1.HightlightColor);
                follower.StrokeThickness = 3;
                follower.Opacity = 1;

                cardLinks[link] = follower;
                Link_List.AddLink(link);
                Image image = new Image();
                image.Source = arrowImage[link.Card1.Owner];
                image.Width = 50;
                image.Height = 50;
                image.Stretch = Stretch.Fill;
                arrows[follower] = new Image[] { image };
                moveArrow(follower);
                this.Children.Add(follower);
                this.Children.Add(image);
                Canvas.SetZIndex(image, cardLinks.Count);

                DoubleAnimation animation = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(STATICS.ANIMATION_DURATION));
                follower.BeginAnimation(Canvas.OpacityProperty, animation);
                image.BeginAnimation(Canvas.OpacityProperty, animation);

            }));
        }
开发者ID:nius1989,项目名称:CardDesign_TechSnack,代码行数:44,代码来源:Linking_Gesture_Layer.xaml.cs


注:本文中的Line.BeginAnimation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。