Hi there! I want to make a loop with diagonal lines whose inclination grows little by little. My loop draws lines 10 by 10, but I want to incline them 1 by 1 and I don’t know how. If I use variable ‘i’ I think increase start from 20, but if I create another variable that grows 1 by 1 does not work. Could you please help me?
size(1000,1000);
strokeWeight(3);
for (int i =-100; i<=1100; i+=20) {
for (int j =0; j<=1000; j++) {
stroke(255,0,0);
line(i+i,0,i,1000);
}
}
I have used your smart idea to make this growing loop and now I would like to make a decreasing one, as you can see on the picture, but I don’t find the way. Could you please help me?
void draw() {
background(0);
strokeWeight(3);
stroke(255,0,0);
// for (int w=0,i=10;i+w<width;i++) {
for (int w=0,i=10;i+w<width;i++) {
int d =i+w;
line(d,height,d,0);
// if (i>10)
w=w+15;
}
}
amazing! now I am trying something more complex, make the space between lines larger and also the thickness of the lines, as you can see on the picture. I have created a new variable on the loop but I think it is not working
size(1000,1000);
background(255,255,255);
stroke(255,0,0);
for(int i=0,w=0,u=0; i<1000; i+=16+w) {
strokeWeight(8+u);
line(i,0, i,1000);
if (i < 300)
w++;
else if(i <300)
u+=8;
else if (i < 600)
w--;
else
w = 0;
}
I really don’t know why these lines are not together if they have same thickness and they grow with same distances between them, do you know what I should improve?