我已经尝试过关于处理的 Goto 10 练习,但不知道我的错误在哪里。目的是制作类似 Goto 10 的场景,但我缺少一些东西。我相信循环可能会关闭。
//line size
int a = 15;
void setup(){
background(255);
size(500,500);
noLoop();
strokeWeight(2);
}
void draw(){
// Y
for(int lineY = 0; lineY < height/a; lineY++){
// X
for(int lineX = 0; lineX < width/a; lineX++){
float randomN = random(1);
pushMatrix();
if (randomN >= 0.5){
rotate(-90);
}
else {
rotate(-45);
}
line(0,0,a,0);
popMatrix();
translate(a, 0);
}
translate((-width), a);
}
}