public static LerpSteps ( this color, Color endingColor, int steps ) : Color[] | ||
color | this | |
endingColor | Color | |
steps | int | |
Результат | Color[] |
public static Color[] LerpSteps(this Color color, Color endingColor, int steps)
{
Color[] colors = new Color[steps];
float stopStrength = 1f / (steps - 1);
float lerpTotal = 0f;
colors[0] = color;
colors[steps - 1] = endingColor;
for (int i = 1; i < steps - 1; i++)
{
lerpTotal += stopStrength;
colors[i] = ColorHelper.Lerp(color, endingColor, lerpTotal);
}
return colors;
}