UWP - 为什么我的简单动画不是 运行
UWP - Why is my simple animation not running
我现在完全迷路了。我的动画有什么问题?为什么不是运行?任何帮助将不胜感激!我想开发一种圆形进度条,它是 "rolling in" 就好像进度条被填满了一样。
以下代码在 MainPage 的已加载处理程序中的空 UWP 应用程序中运行。没有别的...
ArcSegment myArcSegment = new ArcSegment();
myArcSegment.Size = new Size(90, 80);
myArcSegment.SweepDirection = SweepDirection.Clockwise;
PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
myPathSegmentCollection.Add(myArcSegment);
PathFigure myPathFigure = new PathFigure();
myPathFigure.StartPoint = new Point(100, 200);
myPathFigure.Segments = myPathSegmentCollection;
PathFigureCollection myPathFigureCollection = new PathFigureCollection();
myPathFigureCollection.Add(myPathFigure);
PathGeometry myPathGeometry = new PathGeometry();
myPathGeometry.Figures = myPathFigureCollection;
Path myPath = new Path();
myPath.Stroke = new SolidColorBrush(Colors.Aqua);
myPath.StrokeThickness = 1;
myPath.Data = myPathGeometry;
PointAnimation mySizeAnimation = new PointAnimation();
mySizeAnimation.Duration = TimeSpan.FromSeconds(2);
mySizeAnimation.From = new Point(90, 80);
mySizeAnimation.To = new Point(500, 200);
Storyboard.SetTarget(mySizeAnimation, myArcSegment);
Storyboard.SetTargetProperty(mySizeAnimation, nameof(ArcSegment.Point));
Storyboard ellipseStoryboard = new Storyboard();
ellipseStoryboard.Children.Add(mySizeAnimation);
myPath.Loaded += delegate (object o, RoutedEventArgs e)
{
ellipseStoryboard.Begin();
};
Canvas containerCanvas = new Canvas();
containerCanvas.Children.Add(myPath);
Content = containerCanvas;
感谢您的帮助!
天哪...我刚刚读了这个post:http://blog.jerrynixon.com/2012/06/windows-8-animated-pie-slice.html
无意中我读到了关于 EnableDependendAnimation 属性... 从未听说过,但将其设置为 true刚刚制作了动画 运行。我现在会仔细阅读。无论如何谢谢!
我现在完全迷路了。我的动画有什么问题?为什么不是运行?任何帮助将不胜感激!我想开发一种圆形进度条,它是 "rolling in" 就好像进度条被填满了一样。
以下代码在 MainPage 的已加载处理程序中的空 UWP 应用程序中运行。没有别的...
ArcSegment myArcSegment = new ArcSegment();
myArcSegment.Size = new Size(90, 80);
myArcSegment.SweepDirection = SweepDirection.Clockwise;
PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
myPathSegmentCollection.Add(myArcSegment);
PathFigure myPathFigure = new PathFigure();
myPathFigure.StartPoint = new Point(100, 200);
myPathFigure.Segments = myPathSegmentCollection;
PathFigureCollection myPathFigureCollection = new PathFigureCollection();
myPathFigureCollection.Add(myPathFigure);
PathGeometry myPathGeometry = new PathGeometry();
myPathGeometry.Figures = myPathFigureCollection;
Path myPath = new Path();
myPath.Stroke = new SolidColorBrush(Colors.Aqua);
myPath.StrokeThickness = 1;
myPath.Data = myPathGeometry;
PointAnimation mySizeAnimation = new PointAnimation();
mySizeAnimation.Duration = TimeSpan.FromSeconds(2);
mySizeAnimation.From = new Point(90, 80);
mySizeAnimation.To = new Point(500, 200);
Storyboard.SetTarget(mySizeAnimation, myArcSegment);
Storyboard.SetTargetProperty(mySizeAnimation, nameof(ArcSegment.Point));
Storyboard ellipseStoryboard = new Storyboard();
ellipseStoryboard.Children.Add(mySizeAnimation);
myPath.Loaded += delegate (object o, RoutedEventArgs e)
{
ellipseStoryboard.Begin();
};
Canvas containerCanvas = new Canvas();
containerCanvas.Children.Add(myPath);
Content = containerCanvas;
感谢您的帮助!
天哪...我刚刚读了这个post:http://blog.jerrynixon.com/2012/06/windows-8-animated-pie-slice.html
无意中我读到了关于 EnableDependendAnimation 属性... 从未听说过,但将其设置为 true刚刚制作了动画 运行。我现在会仔细阅读。无论如何谢谢!