AnimationUWP.EasingChartControl.Draw C# (CSharp) Method

Draw() public method

public Draw ( EasingFunctionBase easingFunction ) : void
easingFunction Windows.UI.Xaml.Media.Animation.EasingFunctionBase
return void
        public void Draw(EasingFunctionBase easingFunction)
        {
            canvas1.Children.Clear();


            var pathSegments = new PathSegmentCollection();

            for (double i = 0; i < 1; i += SamplingInterval)
            {
                double x = i * canvas1.Width;
                double y = easingFunction.Ease(i) * canvas1.Height;

                var segment = new LineSegment();
                segment.Point = new Point(x, y);

                pathSegments.Add(segment);

            }
            var p = new Path();
            p.Stroke = new SolidColorBrush(Colors.Black);
            p.StrokeThickness = 3;
            var figures = new PathFigureCollection();
            figures.Add(new PathFigure() { Segments = pathSegments });
            p.Data = new PathGeometry() { Figures = figures };
            canvas1.Children.Add(p);
        }
    }
EasingChartControl