在 Processing 中停止 if 参数

Stop an if argument in Processing

大家好,我在这里寻求您的帮助 我已经练习编码处理一个月了,但我现在遇到了一个大问题:

float w=10;   //haut
float x=14;  //haut
float y=10;   // bas
float z=24;  // bas



void setup() { 
frameRate(120);
size(600,600);
background (0);
stroke(255);
smooth();

}

void draw() {
println(frameCount);


line (w,x,y,z);
w=w+10;
x=x;
y=y+10;
z=z;
if ( (w>580) && ( y>580 ) && (frameCount<601)  ) { x=x+30;  w=10;   
z=z+30;      y=10;}

问题是我希望线从 601 帧弯曲一点

像那样:

谢谢!

您的代码末尾缺少 }。 这是一个可能的语法:

float w=10;   //haut
float x=14;  //haut
float y=10;   // bas
float z=24;  // bas

void setup() { 
    frameRate(120);
    size(600,600);
    background (0);
    stroke(255);
    smooth();
}

void draw() {
    println(frameCount);

    line (w,x,y,z);
    w=w+10;
    x=x;
    y=y+10;
    z=z;
    if ( (w>580) && ( y>580 )  ) {
        x=x+30;
        w=10;   
        z=z+30;
        if (frameCount<=600){
            y = 10;
        }
        else{
            y = 15;
        }
    }
}