From a59f1eb8af6b1eb7080427bb6226f494306b98cd Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 16 Nov 2021 15:08:35 +0100 Subject: [PATCH] Added missing easing functions Quart and Quint to Easings --- CHANGELOG.md | 1 + MLEM/Misc/Easings.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9892da..35b30d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Additions - Added a strikethrough formatting code - Added GenericFont SplitStringSeparate which differentiates between existing newline characters and splits due to maximum width - Added StaticSpriteBatch class +- Added missing easing functions Quart and Quint to Easings Improvements - Cache TokenizedString inner offsets for non-Left text alignments to improve performance diff --git a/MLEM/Misc/Easings.cs b/MLEM/Misc/Easings.cs index 93f9deb..46e30e4 100644 --- a/MLEM/Misc/Easings.cs +++ b/MLEM/Misc/Easings.cs @@ -29,6 +29,20 @@ namespace MLEM.Misc { /// https://easings.net/#easeInOutCubic public static readonly Easing InOutCubic = p => p < 0.5F ? 4 * p * p * p : 1 - (-2 * p + 2) * (-2 * p + 2) * (-2 * p + 2) / 2; + /// https://easings.net/#easeInQuart + public static readonly Easing InQuart = p => p * p * p * p; + /// https://easings.net/#easeOutQuart + public static readonly Easing OutQuart = p => 1 - (1 - p) * (1 - p) * (1 - p) * (1 - p); + /// https://easings.net/#easeInOutQuart + public static readonly Easing InOutQuart = p => p < 0.5F ? 8 * p * p * p * p : 1 - (-2 * p + 2) * (-2 * p + 2) * (-2 * p + 2) * (-2 * p + 2) / 2; + + /// https://easings.net/#easeInQuint + public static readonly Easing InQuint = p => p * p * p * p * p; + /// https://easings.net/#easeOutQuint + public static readonly Easing OutQuint = p => 1 - (1 - p) * (1 - p) * (1 - p) * (1 - p) * (1 - p); + /// https://easings.net/#easeInOutQuint + public static readonly Easing InOutQuint = p => p < 0.5F ? 16 * p * p * p * p * p : 1 - (-2 * p + 2) * (-2 * p + 2) * (-2 * p + 2) * (-2 * p + 2) * (-2 * p + 2) / 2; + /// https://easings.net/#easeInExpo public static readonly Easing InExpo = p => p == 0 ? 0 : (float) Math.Pow(2, 10 * p - 10); /// https://easings.net/#easeOutExpo