Hi there!
I would like to create a drawing with a line with random points , something similar to the picture attached. I have found a Code and I am trying but It does not work. Can you please help me with that and tell me what I need to change? Thank you so much
int startX = 100;
int startY = 100;
int endX = 200;
int endY = 200;
int firstX = startX;
int firstY = startX;
int totalLines = 12;
void setup() {
size(400, 400);
background(255);
noLoop();
}
void draw() {
for (int x=0; x< totalLines;x++) {
strokeWeight(2);
stroke(0);
strokeJoin(ROUND);
startX = endX;
startY = endY;
endX = int(random(0, 0));
endY = int(random(0, 0));
liner(endX, endY, startX, startY);
}
}
void liner(int x1, int y1, int x2, int y2) {
line(x1, y1, x2, y2);
pushMatrix();
translate(x2, y2);
popMatrix();
}