在行中更改椭圆颜色

时间:2014-10-08 13:25:10

标签: loops colors ellipse

我正在尝试制作一个椭圆网格,每一行都有不同的颜色。随着行的进行,颜色需要逐渐变淡,直到最后一列为白色

这是我的代码:

void setup ()
{
  size (1180,680);
  background (0);
  noFill ();
  noStroke ();
}

void draw () {



  fill (150,25,25);                
  for (int x = 100; x < 1100; x = x+120) {
    for (int y = 100; y < 200; y = y+100) {
      ellipse (x,y,100,100); 
   }
  }


  fill (25,150,25);                       
  for (int x = 100; x < 1100; x = x+120) {
    for (int j = 220; j < 250; j = j+100){
      ellipse (x,j,100,100);
    }
  }

  fill (25, 25, 150);             
  for (int x = 100; x < 1100; x = x+120) {
    for (int w = 340; w < 350; w = w+100){
      ellipse (x,w,100,100);
    }
  }  

  fill (255, 204, 25);                  
  for (int x = 100; x < 1100; x = x+120) {
    for (int n = 460; n < 470; n = n+100){
      ellipse (x,n,100,100);
    }
  }

  fill (204, 25, 255);
  for (int x = 100; x < 1100; x = x+120) {
    for (int k = 580; k < 590; k = k+100){
        ellipse (x,k,100,100);
    }
    }
  }

我不确定这是否是通过改变颜色以这种方式获得网格的正确方法。是否有一种循环可以改变一行中的每个后续椭圆颜色?我应该如何在排上逐渐消失颜色?

0 个答案:

没有答案