Skip to main content

KeySpline Class

Definition

Assembly:Avalonia.Base
Package:Avalonia

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

public class KeySpline

Inheritance: object -> AvaloniaObject -> KeySpline

Constructors

NameDescription
KeySpline (2 overloads)Create a Avalonia.Animation.KeySpline with X1 = Y1 = 0 and X2 = Y2 = 1.

KeySpline overloads

KeySpline Constructor

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

public KeySpline()

KeySpline Constructor

Create a Avalonia.Animation.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

Methods

NameDescription
GetSplineProgressCalculates spline progress from a linear progress.
IsValidCheck to see whether the Avalonia.Animation.KeySpline is valid by looking at its X values.
ParseParse a Avalonia.Animation.KeySpline from a string. The string needs to contain 4 values in it for the 2 control points.
Bind (8 overloads)Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject.
CheckAccessReturns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject.
ClearValue (4 overloads)Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject.
CoerceValueCoerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject.
EqualsCompares two objects using reference equality. Inherited from AvaloniaObject.
GetBaseValueInherited from AvaloniaObject.
GetHashCodeGets the hash code for the object. Inherited from AvaloniaObject.
GetValue (3 overloads)Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
IsAnimatingChecks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject.
IsSetChecks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject.
SetCurrentValue (2 overloads)Sets the value of a dependency property without changing its value source. Inherited from AvaloniaObject.
SetValue (3 overloads)Sets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
VerifyAccessChecks that the current thread is the UI thread and throws if not. Inherited from AvaloniaObject.

GetSplineProgress Method

Calculates spline progress from a linear progress.

public double GetSplineProgress(double linearProgress)

Parameters

linearProgress double

the linear progress

Returns

double

the spline progress

IsValid Method

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

public bool IsValid()

Returns

bool

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

Parse Method

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

public Avalonia.Animation.KeySpline Parse(string value, System.Globalization.CultureInfo culture)

Parameters

value string

string with 4 values in it

culture System.Globalization.CultureInfo

culture of the string

Returns

Avalonia.Animation.KeySpline

A Avalonia.Animation.KeySpline with the appropriate values set

Exceptions

Properties

NameDescription
ControlPointX1X coordinate of the first control point
ControlPointX2X coordinate of the second control point
ControlPointY1Y coordinate of the first control point
ControlPointY2Y coordinate of the second control point
DispatcherReturns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject.
ItemInherited from AvaloniaObject.

ControlPointX1 Property

X coordinate of the first control point

public double ControlPointX1 { get; set; }

ControlPointX2 Property

X coordinate of the second control point

public double ControlPointX2 { get; set; }

ControlPointY1 Property

Y coordinate of the first control point

public double ControlPointY1 { get; set; }

ControlPointY2 Property

Y coordinate of the second control point

public double ControlPointY2 { get; set; }

Events

NameDescription
PropertyChangedRaised when a Avalonia.AvaloniaProperty value changes on this object. Inherited from AvaloniaObject.