Advertisement
karbaev

gradient

Nov 16th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1.        static void Main(string[] args)
  2.         {
  3.  
  4.             int[] R = { 0, 51, 102, 153, 204, 255 };
  5.             int[] B = { 128, 152, 177, 201, 226, 250 };
  6.  
  7.             int nGradientColors = B.Length-1;
  8.             int nColorsBetween = 255/nGradientColors;
  9.  
  10.             Console.WriteLine(nColorsBetween);
  11.             for (int i = 0; i < B.Length - 1; i++)
  12.             {//пробегаемся по цветам градиента
  13.                 double step = (double)(B[i + 1] - B[i]) / (nColorsBetween );//шаг
  14.                 double colorValue = B[i];//начальный цвет
  15.                 for (int j = 0; j < nColorsBetween; j++)
  16.                 { //пробегаемся по диапазону между цветами
  17.                     int colorIntValue = (int)colorValue; //целое значение
  18.                     Console.WriteLine(colorIntValue);
  19.                     colorValue += step;
  20.                 }
  21.                 Console.WriteLine();
  22.             }
  23.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement