【发布时间】:2016-04-07 16:14:05
【问题描述】:
我想运行一个 for 循环,该循环将有一条棕色的线。这条线会越来越小,但不会太小。
最终图像将如下所示,但桌面为棕色:
//Back wall
fill(102, 102, 102);
rect(50,50,300,300);
//Top Left Corner
line(50,50,0,0);
//Top Right Corner
line(350,50,400,0);
//Bottom Left Corner
line(350,350,400,400);
//Bottom Riight Corner
line(50,350,0,400);
//Table
//Top Left
fill(48, 17, 0);
rect(163,312,3,38);
//Top Right
fill(48, 17, 0);
rect(230,312,3,38);
//Mesa
fill(48, 17, 0);
rect(126,322,142,5);
//Right Side
line(126,322,168,312);
//Top Side
line(234,312,168,312);
//Right Side
line(269,322,232,312);
//Bottom Left Leg
rect(126,327,5,41);
line(126,368,126,322);
//Bottom Right Leg
rect(263,327,5,41);
line(269,368,268,322);
我已经尝试过这个 for 循环:
for(var x = 200; x > 100; x--){
stroke(61, 34, 0);
line(x,200,x,200);
}
x 值将减小,直到 x = 100。但是,即使在确保 background(); 之后,它也没有显示线条变小。不在循环中。
附:给出的代码是分开的。
【问题讨论】: