1

I am working on a Kinect app that uses hover buttons and, when a user hovers over a button, a loading circle should appear and fill. My current implementation is in pure C# and drawing to a canvas.

The arc is created like so:

this.loadArc = new Arc();
this.loadArc.StartAngle = 0;
this.loadArc.Width = 150;
this.loadArc.Height = 150;
this.loadArc.ArcThickness = 5;
this.loadArc.ClipToBounds = true;
this.loadArc.Fill = new SolidColorBrush(Colors.White);
canvas.Children.Add(this.loadArc);

And then a timer is started and the Arc fills like this:

this.loadArc.EndAngle += x; 

Where x is an angle determined by the time passed and the total time required to hover.

This works fine, but it seems like the arc tried to fill the available space and the shape kind of jumps around. I expected this to show the arc slowly filling to create a circle. Is there something trivial I am missing? Or, better yet, is there a more efficient way to do this (aside from a gif or similar)?

Thanks in advance!

Christopher Gwilliams
  • 1,321
  • 15
  • 29
  • You can use wpf animations. They take time to complete and have event when completed (see [this](http://stackoverflow.com/q/15795850/1997232)). – Sinatr Dec 19 '14 at 09:26
  • Thanks, the reason it is done in C# is because the angle changes based on the button. I have used storyboard for overlays. However, the problem would still be the same as the angle would change in the storyboard. Once the angle has passed 180 degrees, it looks fine but smaller angles are all janky. – Christopher Gwilliams Dec 19 '14 at 09:36
  • I created a storyboard in code and that, coupled with reducing the framerate, works well but the filling up of the angle still looks odd for smaller angles. – Christopher Gwilliams Dec 19 '14 at 09:58

0 Answers0