Easy question from new user! +Parallel lines drawing

Hello!

I’m new here and I just found this incredible software during the quarantine.

I’m reading the Processing: A Programming Handbook for Visual Designers and Artists book for learning, but I remained stuck while trying to do an exercise/experiment/design/etc drawing a few lines…

The code i’m using right now is this one:

size(800, 800);


strokeWeight(2);
for (int x = 5; x < 800; x += 7) {
float n = map(x, 5, 795, -1, 1);
float p = pow(n, 3);
float ypos = lerp(400, 800, p);
line(x, 0, x, ypos);
}
for (int x = 5; x < 800; x += 10) {
float n = map(x, 5, 795, -1, 1);
float p = pow(n, 3);
float ypos = lerp(400, 800, p);
m += 8;
line(-ypos*500,ypos*300, x,ypos);
}

and this is what I get

curvas1 copia

What I’m looking for is that the oblique?diagonal?stripes to have the same separation between them and not to be in function of the ypos variable, at the same time it keeps the shape it has now and not overlapping with the vertical stripes.

I tried everything and thats why I come here to ask you… I’ve accomplished to keep the separation between them but losing the shape or even worse things…

Sorry if I explain myself bad… English is not my native language.

Thanks!

1 Like

On your second for loop, set the increment to x+=7, same as the first for loop …

btw … you can move line(-ypos * 500, ypos * 300, x, ypos); into the first for loop and remove the other loop altogether.

1 Like