//Function that animates the circle to a certain state with a certain timing public void AnimateCircleAngle(double PercentBefore, double PercentAfter, double seconds, bool initialAnimation = true, bool useEase = true) { //We multiply the percentage by 3.6 because a full circle is 360 degrees, divide 360 by 100 and you get 3.6 //So half a circle would be 50(%) * 3.6 = 180 degrees, half a circle. DoubleAnimation da = new DoubleAnimation(PercentBefore * 3.6, PercentAfter * 3.6, TimeSpan.FromSeconds(seconds)); if (useEase) { SineEase ease = new SineEase(); da.EasingFunction = ease; } if (initialAnimation) { da.Completed += (sender, e) => { AnimateCircleThickness(5, 15); Status = "Aan het verwerken"; }; Status = "Een ogenblik geduld"; AnimateLabelPeriods(statusLabel); } ProgressGraphic.BeginAnimation(Microsoft.Expression.Shapes.Arc.EndAngleProperty, da); }
public void StopAnimations() { DoubleAnimation da = new DoubleAnimation(ProgressGraphic.StrokeThickness, ProgressGraphic.StrokeThickness, TimeSpan.FromMilliseconds(700)); ProgressGraphic.BeginAnimation(Microsoft.Expression.Shapes.Arc.StrokeThicknessProperty, da); ProgressGraphic.BeginAnimation(Microsoft.Expression.Shapes.Arc.StartAngleProperty, null); ProgressGraphic.BeginAnimation(Microsoft.Expression.Shapes.Arc.EndAngleProperty, null); ProgressGraphic.EndAngle = 360; // To keep it full AnimateCircleThickness(ProgressGraphic.StrokeThickness, 5, false, false); statusLabel.Opacity = 0; }
//Function that animates the circle to a certain state private void AnimateCircleAngle(double PercentBefore, double PercentAfter) { //Make time relative based on how much we are animating double time = PercentAfter - PercentBefore; //We multiply the percentage by 3.6 because a full circle is 360 degrees, divide 360 by 100 and you get 3.6 //So half a circle would be 50(%) * 3.6 = 180 degrees, half a circle. DoubleAnimation da = new DoubleAnimation(PercentBefore * 3.6, PercentAfter * 3.6, TimeSpan.FromSeconds(time * 0.025)); SineEase ease = new SineEase(); da.EasingFunction = ease; ProgressGraphic.BeginAnimation(Microsoft.Expression.Shapes.Arc.EndAngleProperty, da); }
public void AnimateCircleThickness(double widthBefore, double widthAfter, bool RepeatForever = true, bool AutoReverse = true) { DoubleAnimation da = new DoubleAnimation(widthBefore, widthAfter, TimeSpan.FromMilliseconds(700)); da.AutoReverse = AutoReverse; if (RepeatForever) { da.RepeatBehavior = RepeatBehavior.Forever; } SineEase ease = new SineEase(); da.EasingFunction = ease; ProgressGraphic.BeginAnimation(Microsoft.Expression.Shapes.Arc.StrokeThicknessProperty, da); }