Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/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
Processing 加工中的三个椭圆旋转木马_Processing_Increment_Ellipse - Fatal编程技术网

Processing 加工中的三个椭圆旋转木马

Processing 加工中的三个椭圆旋转木马,processing,increment,ellipse,Processing,Increment,Ellipse,我正试图创建一个垂直旋转木马处理三个椭圆。 我可以用两个椭圆来完成这项工作——旋转木马一次又一次地重复它自己。 到目前为止还不错——它认为我可以用同样的逻辑处理三个问题,但我错了。我开始认为它适用于更多的变量,但又错了…我在逻辑中遗漏了什么?我真的不知道如何设置值,使它无缝地重复自己 下面是两个示例(这一个是“无缝的”): 这是我的WIP,有三个…(顺便说一句,颜色只是为了看得更清楚): 有三个变量的一个总是从所有变量的起始点开始——但我认为使用单个变量会改变它 谢谢你的帮助 我自己找到了解决办

我正试图创建一个垂直旋转木马处理三个椭圆。 我可以用两个椭圆来完成这项工作——旋转木马一次又一次地重复它自己。 到目前为止还不错——它认为我可以用同样的逻辑处理三个问题,但我错了。我开始认为它适用于更多的变量,但又错了…我在逻辑中遗漏了什么?我真的不知道如何设置值,使它无缝地重复自己

下面是两个示例(这一个是“无缝的”):

这是我的WIP,有三个…(顺便说一句,颜色只是为了看得更清楚):

有三个变量的一个总是从所有变量的起始点开始——但我认为使用单个变量会改变它


谢谢你的帮助

我自己找到了解决办法!我用了一个技巧——我用了一个循环,用了四个而不是三个——最后你只看到了三个

float yspeed = 1;
float circleY;
int d = 360;
void setup() {

  size(540, 810 );
  circleY = 0;
}

void draw() {
  background(255);
  fill(0);
  noStroke();
  //  fill(255,0,0);
  translate(0, - height/2);

  for (int i = 0; i< 5; i++) {    
    ellipse(width/2, circleY+height/2*i, d, d);
  }
  circleY = circleY + yspeed;  


  if (circleY > 405) {
    circleY= 0;
  }
}
float yspeed=1;
浮圈;
int d=360;
无效设置(){
尺寸(540810);
circleY=0;
}
作废提款(){
背景(255);
填充(0);
仰泳();
//填充(255,0,0);
平移(0,-高度/2);
对于(int i=0;i<5;i++){
椭圆(宽度/2,圆圈+高度/2*i,d,d);
}
circleY=circleY+Y速度;
如果(圆圈>405){
circleY=0;
}
}
float yspeed1 = 5;
float yspeed2 = 5;
float yspeed3 = 5;
float circleY1;
float circleY2;
float circleY3;
int d = 720;
void setup() {

  size(1080, 1620);
  circleY1 = 0;
  circleY2 = 0;
  circleY3 = 0;
}

void draw() {
  background(255);
  noStroke();

  fill(255, 0, 0);
  ellipse(width/2, circleY1, d, d);
  circleY1= circleY1 + yspeed1;
  if (circleY1 > height+d/2  ) {
    circleY1=0;
  }

  fill(0, 255, 0);
  ellipse(width/2, circleY2-810, d, d);
  circleY2= circleY2 + yspeed2;
  if (circleY2 > height+d/2  ) {
    circleY2=0  ;
  }


  fill(0, 0, 255);
  ellipse(width/2, circleY2-1620, d, d);
  circleY3= circleY3 + yspeed3;
  if (circleY3 > height+d/2  ) {
    circleY3=0  ;
  }
}
float yspeed = 1;
float circleY;
int d = 360;
void setup() {

  size(540, 810 );
  circleY = 0;
}

void draw() {
  background(255);
  fill(0);
  noStroke();
  //  fill(255,0,0);
  translate(0, - height/2);

  for (int i = 0; i< 5; i++) {    
    ellipse(width/2, circleY+height/2*i, d, d);
  }
  circleY = circleY + yspeed;  


  if (circleY > 405) {
    circleY= 0;
  }
}