Skip to content

Class Easings

Definition

Namespace: StardewUI.Animation
Assembly: StardewUI.dll

Common registration and lookup for easing functions.

public static class Easings

Inheritance
Object ⇦ Easings

Members

Methods

Name Description
Add(string, Easing) Registers a new easing, if one with the same name is not already registered.
CubicBezier(Single, Single, Single, Single) Creates a Cubic Bézier (AKA key spline) easing from two control points.
Named(string) Retrieves an easing function, given its registered name.
Parse(string) Parses an Easing value from a string value.
Parse(ReadOnlySpan<Char>) Parses an Easing value from a string value.
TryParse(ReadOnlySpan<Char>, Easing) Attempts to parse an Easing value from a string value.

Details

Methods

Add(string, Easing)

Registers a new easing, if one with the same name is not already registered.

public static void Add(string name, StardewUI.Animation.Easing easing);
Parameters

name   string
The name of the easing function.

easing   Easing
The easing function.

Remarks

If an easing with the specified name already exists, the call is ignored.


CubicBezier(float, float, float, float)

Creates a Cubic Bézier (AKA key spline) easing from two control points.

public static StardewUI.Animation.Easing CubicBezier(float x1, float y1, float x2, float y2);
Parameters

x1   Single
The X value of the first control point.

y1   Single
The Y value of the first control point.

x2   Single
The X value of the second control point.

y2   Single
The Y value of the second control point.

Returns

Easing

The easing function described by the control points.


Named(string)

Retrieves an easing function, given its registered name.

public static StardewUI.Animation.Easing Named(string name);
Parameters

name   string
An easing function name, such as EaseOutCubic.

Returns

Easing

The easing function registered with the specified name, or null if no such function was registered.


Parse(string)

Parses an Easing value from a string value.

public static StardewUI.Animation.Easing Parse(string value);
Parameters

value   string
The string value to parse.

Returns

Easing

The parsed easing function.


Parse(ReadOnlySpan<Char>)

Parses an Easing value from a string value.

public static StardewUI.Animation.Easing Parse(ReadOnlySpan<System.Char> value);
Parameters

value   ReadOnlySpan<Char>
The string value to parse.

Returns

Easing

The parsed easing function.


TryParse(ReadOnlySpan<Char>, Easing)

Attempts to parse an Easing value from a string value.

public static bool TryParse(ReadOnlySpan<System.Char> value, out StardewUI.Animation.Easing result);
Parameters

value   ReadOnlySpan<Char>
The string value to parse.

result   Easing
The parsed easing function, if successful; otherwise null.

Returns

Boolean

true if the value was parsed successfully, otherwise false.

Remarks

Works with both named easings, and known easing functions like CubicBezier.