Hi there! I have this amazing Code as a polygon generator. It is really useful for me in order yo create random shapes. Now I want to draw polygons inside the screen, because ofently they appear out of It, how could I do something like that?
Thanks
void setup() {
noFill();
stroke(255);
strokeWeight(2);
background(0);
drawMoreRandomQuad(random(width), random(height), 200,400);
}
void draw() {
}
void drawMoreRandomQuad(float x, float y, float minSize, float maxSize)
{
float startAngle = random(HALF_PI);
float angle = startAngle;
beginShape();
for (int i = 0; i < 6; i++) {
float r = random(minSize, maxSize);
float vx = x + r * cos(angle);
float vy = y + r * sin(angle);
vertex(vx, vy);
angle += random(0, min(startAngle + TWO_PI - angle, PI));
}
endShape(CLOSE);
}