1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-06-21 04:29:14 +02:00

Added ReverseInput and ReverseOutput to Easings

This commit is contained in:
Ell 2022-05-10 20:56:14 +02:00
parent 61439aa521
commit 7ebbe49786
2 changed files with 19 additions and 0 deletions

View file

@ -14,6 +14,7 @@ Additions
- Added consuming variants of IsPressed methods to InputHandler and Keybind
- Added SpriteBatchContext struct and extensions
- Added InputHandler.InvertPressBehavior
- Added ReverseInput and ReverseOutput to Easings
### MLEM.Ui
Additions

View file

@ -114,6 +114,24 @@ namespace MLEM.Misc {
return p => easing(p) * (max - min) + min;
}
/// <summary>
/// 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.
/// </summary>
/// <param name="easing">The easing function whose output to reverse.</param>
/// <returns>The reversed easing function.</returns>
public static Easing ReverseInput(this Easing easing) {
return p => easing(1 - p);
}
/// <summary>
/// Reverses the output of an easing function, which is usually between 0 and 1, to return as if it were between 1 and 0.
/// </summary>
/// <param name="easing">The easing function whose input to reverse.</param>
/// <returns>The reversed easing function.</returns>
public static Easing ReverseOutput(this Easing easing) {
return p => 1 - easing(p);
}
/// <summary>
/// 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".