Update EaseUtil.cs

This commit is contained in:
陈思海 2026-04-01 14:53:56 +08:00
parent ff545585d7
commit 4dff3a98bc

View File

@ -90,9 +90,9 @@ public class EaseUtil
public static double EaseInOutExpo(float x) public static double EaseInOutExpo(float x)
{ {
return x == 0 ? 0 : return x == 0 ? 0 :
x == 1 ? 1 : x == 1 ? 1 :
x < 0.5 ? Math.Pow(2, 20 * x - 10) / 2 : x < 0.5 ? Math.Pow(2, 20 * x - 10) / 2 :
(2 - Math.Pow(2, -20 * x + 10)) / 2; (2 - Math.Pow(2, -20 * x + 10)) / 2;
} }
public static double EaseInCirc(float x) public static double EaseInCirc(float x)
@ -131,9 +131,7 @@ public class EaseUtil
double c1 = 1.70158; double c1 = 1.70158;
double c2 = c1 * 1.525; double c2 = c1 * 1.525;
return x < 0.5 ? return x < 0.5 ? Math.Pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 : (Math.Pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;
Math.Pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2) / 2 :
(Math.Pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;
} }
public static double EaseInElastic(float x) public static double EaseInElastic(float x)
@ -152,9 +150,9 @@ public class EaseUtil
{ {
double c5 = 2 * Math.PI / 4.5; double c5 = 2 * Math.PI / 4.5;
return x == 0 ? 0 : return x == 0 ? 0 :
x == 1 ? 1 : x == 1 ? 1 :
x < 0.5 ? -(Math.Pow(2, 20 * x - 10) * Math.Sin((20 * x - 11.125) * c5)) / 2 : x < 0.5 ? -(Math.Pow(2, 20 * x - 10) * Math.Sin((20 * x - 11.125) * c5)) / 2 :
Math.Pow(2, -20 * x + 10) * Math.Sin((20 * x - 11.125) * c5) / 2 + 1; Math.Pow(2, -20 * x + 10) * Math.Sin((20 * x - 11.125) * c5) / 2 + 1;
} }
public static double EaseInBounce(float x) public static double EaseInBounce(float x)