2016-08-08 2 views
0

지금은 완전히 잃어 버렸습니다. 내 애니메이션에 어떤 문제가 있습니까? 왜 작동하지 않는거야? 어떤 도움을 주시면 감사하겠습니다! 나는 막대가 채워지는 것처럼 "구르는"순환 진행 바를 개발하고 싶습니다.UWP - 내 간단한 애니메이션이 실행되지 않는 이유

다음 코드는 MainPage의 Loaded Handler에있는 빈 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; 

감사합니다.

답변

관련 문제