Table of Contents

Class KeySpline

Namespace
Avalonia.Animation
Assembly
Avalonia.Base.dll

Determines how an animation is used based on a cubic bezier curve. X1 and X2 must be between 0.0 and 1.0, inclusive. See https://docs.microsoft.com/en-us/dotnet/api/system.windows.media.animation.keyspline

[TypeConverter(typeof(KeySplineTypeConverter))]
public sealed class KeySpline : AvaloniaObject, INotifyPropertyChanged
Inheritance
KeySpline
Implements
Inherited Members
Extension Methods

Constructors

KeySpline()

Create a KeySpline with X1 = Y1 = 0 and X2 = Y2 = 1.

public KeySpline()

KeySpline(double, double, double, double)

Create a KeySpline with the given parameters

public KeySpline(double x1, double y1, double x2, double y2)

Parameters

x1 double

X coordinate for the first control point

y1 double

Y coordinate for the first control point

x2 double

X coordinate for the second control point

y2 double

Y coordinate for the second control point

Properties

ControlPointX1

X coordinate of the first control point

public double ControlPointX1 { get; set; }

Property Value

double

ControlPointX2

X coordinate of the second control point

public double ControlPointX2 { get; set; }

Property Value

double

ControlPointY1

Y coordinate of the first control point

public double ControlPointY1 { get; set; }

Property Value

double

ControlPointY2

Y coordinate of the second control point

public double ControlPointY2 { get; set; }

Property Value

double

Methods

GetSplineProgress(double)

Calculates spline progress from a linear progress.

public double GetSplineProgress(double linearProgress)

Parameters

linearProgress double

the linear progress

Returns

double

the spline progress

IsValid()

Check to see whether the KeySpline is valid by looking at its X values.

public bool IsValid()

Returns

bool

true if the X values for this KeySpline fall in acceptable range; false otherwise.

Parse(string, CultureInfo?)

Parse a KeySpline from a string. The string needs to contain 4 values in it for the 2 control points.

public static KeySpline Parse(string value, CultureInfo? culture)

Parameters

value string

string with 4 values in it

culture CultureInfo

culture of the string

Returns

KeySpline

A KeySpline with the appropriate values set

Exceptions

FormatException

Thrown if the string does not have 4 values