本文整理匯總了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);
}