From 1281fe2437cffc54eb61f54f50cf72e13590f043 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 12 Jul 2024 13:05:58 -0500 Subject: [PATCH] A bit more code cleanup --- GradientDriverEasing/GradientDriverEasing.cs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/GradientDriverEasing/GradientDriverEasing.cs b/GradientDriverEasing/GradientDriverEasing.cs index 9e0a29f..b4c226d 100644 --- a/GradientDriverEasing/GradientDriverEasing.cs +++ b/GradientDriverEasing/GradientDriverEasing.cs @@ -230,10 +230,7 @@ private static Button CreatePositionEasingButton(ValueGradientDriver insta btn.LocalPressed += (_, _) => { int pCount = instance.Points.Count; - for (int i = 0; i < pCount; i++) - { - instance.Points[i].Position.Value = fFunc(min.Value, max.Value, (float)i / (pCount - 1)); - } + for (int i = 0; i < pCount; i++) instance.Points[i].Position.Value = fFunc(min.Value, max.Value, (float)i / (pCount - 1)); }; return btn; } @@ -262,14 +259,8 @@ private static T ConfiguredLerp(T a, T b, float ratio) { if (Config_LerpColorByHSV && (typeof(T) == typeof(colorX) || typeof(T) == typeof(color))) { - if (a is colorX colorXa && b is colorX colorXb) - { - return (T)(object)HSVLerp(colorXa, colorXb, ratio); - } - else if (a is color colora && b is color colorb) - { - return (T)(object)HSVLerp(colora, colorb, ratio); - } + if (a is colorX colorXa && b is colorX colorXb) return (T)(object)HSVLerp(colorXa, colorXb, ratio); + else if (a is color colora && b is color colorb) return (T)(object)HSVLerp(colora, colorb, ratio); } return Config_UseUnclampedLerp ? Coder.LerpUnclamped(a, b, ratio) : Coder.Lerp(a, b, ratio); @@ -286,10 +277,7 @@ private static color HSVLerp(color a, color b, float ratio) return hsvc.ToRGB(); } - private static colorX HSVLerp(colorX a, colorX b, float ratio) - { - return new colorX(HSVLerp((color)a, (color)b, ratio)).SetProfile(a.Profile); - } + private static colorX HSVLerp(colorX a, colorX b, float ratio) => new colorX(HSVLerp((color)a, (color)b, ratio)).SetProfile(a.Profile); private static bool IsFakeLerpType() => FakeLerpTypes.Contains(typeof(T));