the box
in
Programming Questions
•
1 year ago
Hi,
I would like to make something like this with for loop or array function. I exported drawing from AutoCAD to an image for an example.
I was thinking to make it like this and than to multiply it.
My code isn't so great:
-
size(610,480);background(255);
int y = 120; // Vertical location of each lineint x = 120; // Initial horizontal location for first lineint spacing = 50; // How far apart is each lineint len = 300; // Length of each line
// A variable to mark where the legs end.int endLegs = 400;stroke(200);
// Draw each leg inside a while loop.while (x <= endLegs) {line (x,y,x,y + len);x = x + spacing;}while (y <= 400) {line (x,y,x-len,y);line(x,y,x+spacing, y+spacing);y = y + spacing;}
Thanks!
1