Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Loops 更改行中的椭圆颜色_Loops_Colors_Ellipse - Fatal编程技术网

Loops 更改行中的椭圆颜色

Loops 更改行中的椭圆颜色,loops,colors,ellipse,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

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

这是我的代码:

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);
    }
    }
  }
void设置()
{
尺寸(1180680);
背景(0);
noFill();
诺斯托克();
}
无效提款(){
填充(150,25,25);
对于(整数x=100;x<1100;x=x+120){
对于(整数y=100;y<200;y=y+100){
椭圆(x,y,100100);
}
}
填充(25150,25);
对于(整数x=100;x<1100;x=x+120){
对于(int j=220;j<250;j=j+100){
椭圆(x,j,100100);
}
}
填充(25、25、150);
对于(整数x=100;x<1100;x=x+120){
对于(整数w=340;w<350;w=w+100){
椭圆(x,w,100100);
}
}  
填充(255、204、25);
对于(整数x=100;x<1100;x=x+120){
对于(整数n=460;n<470;n=n+100){
椭圆(x,n,100100);
}
}
填充(204、25、255);
对于(整数x=100;x<1100;x=x+120){
对于(整数k=580;k<590;k=k+100){
椭圆(x,k,100100);
}
}
}

我不确定这是否是正确的方法,以获得网格这种方式与变化的颜色。是否有一种循环类型会改变一行中每个后续椭圆的颜色?我应该如何使颜色沿行逐渐流失?

这是哪种语言?您使用的是哪种API?如何/在何处绘制?这是使用Processing 2任何有帮助的都将不胜感激