Table of Contents

Class Easings

Namespace
MLEM.Maths
Assembly
MLEM.dll

This class contains a set of easing functions, adapted from https://easings.net. These can be used for ui elements or any other kind of animations. By default, each function takes an input that ranges between 0 and 1, and produces an output that roughly ranges between 0 and 1. To change this behavior, you can use ScaleInput(Easing, float, float) and ScaleOutput(Easing, float, float).

public static class Easings
Inheritance
Easings
Inherited Members

Fields

InBack

public static readonly Easings.Easing InBack

Field Value

Easings.Easing

InBounce

public static readonly Easings.Easing InBounce

Field Value

Easings.Easing

InCirc

public static readonly Easings.Easing InCirc

Field Value

Easings.Easing

InCubic

public static readonly Easings.Easing InCubic

Field Value

Easings.Easing

InElastic

public static readonly Easings.Easing InElastic

Field Value

Easings.Easing

InExpo

public static readonly Easings.Easing InExpo

Field Value

Easings.Easing

InOutBack

public static readonly Easings.Easing InOutBack

Field Value

Easings.Easing

InOutBounce

public static readonly Easings.Easing InOutBounce

Field Value

Easings.Easing

InOutCirc

public static readonly Easings.Easing InOutCirc

Field Value

Easings.Easing

InOutCubic

public static readonly Easings.Easing InOutCubic

Field Value

Easings.Easing

InOutElastic

public static readonly Easings.Easing InOutElastic

Field Value

Easings.Easing

InOutExpo

public static readonly Easings.Easing InOutExpo

Field Value

Easings.Easing

InOutQuad

public static readonly Easings.Easing InOutQuad

Field Value

Easings.Easing

InOutQuart

public static readonly Easings.Easing InOutQuart

Field Value

Easings.Easing

InOutQuint

public static readonly Easings.Easing InOutQuint

Field Value

Easings.Easing

InOutSine

public static readonly Easings.Easing InOutSine

Field Value

Easings.Easing

InQuad

public static readonly Easings.Easing InQuad

Field Value

Easings.Easing

InQuart

public static readonly Easings.Easing InQuart

Field Value

Easings.Easing

InQuint

public static readonly Easings.Easing InQuint

Field Value

Easings.Easing

InSine

public static readonly Easings.Easing InSine

Field Value

Easings.Easing

Linear

A linear easing function that returns the input percentage without modifying it.

public static readonly Easings.Easing Linear

Field Value

Easings.Easing

One

An easing function that constantly returns 1, regardless of the input percentage. This is useful for chaining using AndThen(Easing, Easing).

public static readonly Easings.Easing One

Field Value

Easings.Easing

OutBack

public static readonly Easings.Easing OutBack

Field Value

Easings.Easing

OutBounce

public static readonly Easings.Easing OutBounce

Field Value

Easings.Easing

OutCirc

public static readonly Easings.Easing OutCirc

Field Value

Easings.Easing

OutCubic

public static readonly Easings.Easing OutCubic

Field Value

Easings.Easing

OutElastic

public static readonly Easings.Easing OutElastic

Field Value

Easings.Easing

OutExpo

public static readonly Easings.Easing OutExpo

Field Value

Easings.Easing

OutQuad

public static readonly Easings.Easing OutQuad

Field Value

Easings.Easing

OutQuart

public static readonly Easings.Easing OutQuart

Field Value

Easings.Easing

OutQuint

public static readonly Easings.Easing OutQuint

Field Value

Easings.Easing

OutSine

public static readonly Easings.Easing OutSine

Field Value

Easings.Easing

Zero

An easing function that constantly returns 0, regardless of the input percentage. This is useful for chaining using AndThen(Easing, Easing).

public static readonly Easings.Easing Zero

Field Value

Easings.Easing

Methods

AndReverse(Easing)

Causes the easing functino to play fully, and then play fully in reverse, in the span between an input of 0 and 1. In some places, this behavior is also called "auto-reversing".

public static Easings.Easing AndReverse(this Easings.Easing easing)

Parameters

easing Easings.Easing

The easing function to play in reverse as well

Returns

Easings.Easing

An auto-reversing version of the easing function

AndThen(Easing, Easing)

Causes the easing function to play fully, followed by other playing fully, in the span between an input of 0 and 1. Note that AndThen(Easing, params Easing[]) provides a version of this method for any amount of follow-up easing functions.

public static Easings.Easing AndThen(this Easings.Easing easing, Easings.Easing other)

Parameters

easing Easings.Easing

The first easing function to play.

other Easings.Easing

The second easing function to play.

Returns

Easings.Easing

A combined easing function of the two functions passed.

AndThen(Easing, params Easing[])

Causes the easing function to play fully, followed by all elements of others playing fully, in the span between an input of 0 and 1. This is an any-amount version of AndThen(Easing, Easing).

public static Easings.Easing AndThen(this Easings.Easing easing, params Easings.Easing[] others)

Parameters

easing Easings.Easing

The first easing function to play.

others Easing[]

The next easing functions to play.

Returns

Easings.Easing

A combined easing function of all of the functions passed.

Clamp(Easing, float, float)

Causes output from the easing function to be clamped between the min and max values passed.

public static Easings.Easing Clamp(this Easings.Easing easing, float min = 0, float max = 1)

Parameters

easing Easings.Easing

The easing function to clamp.

min float

The minimum output value to clamp to, defaults to 0.

max float

The maximum output value to clamp to, defaults to 1.

Returns

Easings.Easing

A clamped easing function.

ReverseInput(Easing)

Reverses the input of an easing function, which is usually between 0 and 1, to be passed into the easing function as if it were between 1 and 0.

public static Easings.Easing ReverseInput(this Easings.Easing easing)

Parameters

easing Easings.Easing

The easing function whose output to reverse.

Returns

Easings.Easing

The reversed easing function.

ReverseOutput(Easing)

Reverses the output of an easing function, which is usually between 0 and 1, to return as if it were between 1 and 0.

public static Easings.Easing ReverseOutput(this Easings.Easing easing)

Parameters

easing Easings.Easing

The easing function whose input to reverse.

Returns

Easings.Easing

The reversed easing function.

ScaleInput(Easing, float, float)

Scales the input of an easing function, which is usually between 0 and 1, to a given minimum and maximum. Note that the minimum needs to be smaller than the maximum.

public static Easings.Easing ScaleInput(this Easings.Easing easing, float min, float max)

Parameters

easing Easings.Easing

The easing function to scale

min float

The minimum input value

max float

The maximum input value

Returns

Easings.Easing

The scaled easing function

ScaleOutput(Easing, float, float)

Scales the output of an easing function, which is usually between 0 and 1, to a given minimum and maximum. Note that the minimum needs to be smaller than the maximum.

public static Easings.Easing ScaleOutput(this Easings.Easing easing, float min, float max)

Parameters

easing Easings.Easing

The easing function to scale

min float

The minimum output value

max float

The maximum output value

Returns

Easings.Easing

The scaled easing function