HW#5A
//FAN LAN
//HW#5A
//September 18, 2019
-------------------------------------------------------------
//September 18, 2019
-------------------------------------------------------------
Draw Line Grid
background(0);
strokeWeight(1);
stroke(255);
size(600, 400);
int x=0;//initialized condition
while (x<width) { //boolean expression
line(x,0,x,height);
x=x+20; //incrementationn operation
}
for(int y=0; y<width; y=y+20){
line (0,y,width, y);
}
------------------------------------------------------------
Draw Box Grid
size(600, 400);
background(0);
strokeWeight(1);
fill(0);
stroke(255);
for (int x=0; x<width; x=x+20) {
for (int y=0; y<height; y=y+20) {
rect(x, y, 20, 20);
}
}
-------------------------------------------------------------
Draw Point Grid
background(0);
strokeWeight(1);
stroke(255);
size(600, 400);
for (int x=0; x<width; x=x+20) {
for (int y=0; y<height; y=y+20) {
point(x,y);
}
}
Comments
Post a Comment