本文整理汇总了C#中Windows.UI.Xaml.Media.Animation.EasingFunctionBase.Ease方法的典型用法代码示例。如果您正苦于以下问题:C# EasingFunctionBase.Ease方法的具体用法?C# EasingFunctionBase.Ease怎么用?C# EasingFunctionBase.Ease使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.Media.Animation.EasingFunctionBase
的用法示例。
在下文中一共展示了EasingFunctionBase.Ease方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
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);
}
示例2: PlotEasingFunctionGraph
// Plots a graph of the passed easing function using the given sampling interval on the "Graph" Canvas control
private void PlotEasingFunctionGraph(EasingFunctionBase easingFunction, double samplingInterval)
{
UISettings UserSettings = new UISettings();
Graph.Children.Clear();
Path path = new Path();
PathGeometry pathGeometry = new PathGeometry();
PathFigure pathFigure = new PathFigure() { StartPoint = new Point(0, 0) };
PathSegmentCollection pathSegmentCollection = new PathSegmentCollection();
// Note that an easing function is just like a regular function that operates on doubles.
// Here we plot the range of the easing function's output on the y-axis of a graph.
for (double i = 0; i < 1; i += samplingInterval)
{
double x = i * GraphContainer.Width;
double y = easingFunction.Ease(i) * GraphContainer.Height;
LineSegment segment = new LineSegment();
segment.Point = new Point(x, y);
pathSegmentCollection.Add(segment);
}
pathFigure.Segments = pathSegmentCollection;
pathGeometry.Figures.Add(pathFigure);
path.Data = pathGeometry;
path.Stroke = new SolidColorBrush(UserSettings.UIElementColor(UIElementType.ButtonText));
path.StrokeThickness = 1;
// Add the path to the Canvas
Graph.Children.Add(path);
}