コード例 #1
0
 public static Color ColorLerp(Color c1, Color c2, float n)
 {
     n = GameMath.Clamp(0, 1, n);
     return(new Color((byte)(c1.R + n * (c2.R - c1.R)), (byte)(c1.G + n * (c2.G - c1.G)), (byte)(c1.B + n * (c2.B - c1.B)), (byte)(c1.A + n * (c2.A - c1.A))));
 }
コード例 #2
0
 public static float Lerp(float from, float to, float t)
 {
     return(from + (to - from) * GameMath.Clamp(0, 1, t));
 }