From ef96bd435820da2d039a7acdbc369b8e44bfee5d Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Fri, 16 Feb 2024 17:22:55 -0800 Subject: [PATCH 1/2] Fix variable name in `MathUtils.smoothLerp` --- source/funkin/util/MathUtil.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/util/MathUtil.hx b/source/funkin/util/MathUtil.hx index c8c4f5109..a078d6996 100644 --- a/source/funkin/util/MathUtil.hx +++ b/source/funkin/util/MathUtil.hx @@ -70,6 +70,6 @@ class MathUtil // var halfLife:Float = -duration / logBase(2, precision); // lerp(current, target, 1 - exp2(-elapsed / halfLife)); - return lerp(current, target, 1 - Math.pow(p, elapsed / duration)); + return lerp(current, target, 1 - Math.pow(precision, elapsed / duration)); } } From 16df3f0e9dfc520ad7d7fb2d57cb32b7f1ba1b2c Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 16 Feb 2024 22:13:51 -0500 Subject: [PATCH 2/2] Move E to a final constant as Mike suggested. --- source/funkin/util/MathUtil.hx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/source/funkin/util/MathUtil.hx b/source/funkin/util/MathUtil.hx index a078d6996..5fed1d3e1 100644 --- a/source/funkin/util/MathUtil.hx +++ b/source/funkin/util/MathUtil.hx @@ -5,13 +5,11 @@ package funkin.util; */ class MathUtil { - public static var E(get, never):Float; - - static function get_E():Float - { - // Math.E is not a constant in Haxe, so we'll just define it ourselves. - return 2.71828182845904523536; // Approximation. - } + /** + * Euler's constant and the base of the natural logarithm. + * Math.E is not a constant in Haxe, so we'll just define it ourselves. + */ + public static final E:Float = 2.71828182845904523536; /** * Perform linear interpolation between the base and the target, based on the current framerate.