hello! I am a beginner in processing and I have an idea of drawing a flower. Starting from the middle of the canvas, lines are drawn to create petals while rotating and eventually creating a flower shape. I attempted to code my idea but it's still off? I also tried getting help from AI but it is not much of a help? If anyone can help me create my idea illustrated in the provided photo, that would be deeply appreciated. I have provided the code I have now as well. Thank you.
float angle = 0;
float radius = 1;
float petalLength = 100;
int numPetals = 100;
void setup() {
size(1200, 800);
background(255);
noFill();
stroke(0);
}
void draw() {
translate(width / 2, height / 2); //starting point
if (angle < TWO_PI) {
float x1 = cos(angle) * radius;
float y1 = sin(angle) * radius;
float x2 = cos(angle) * (radius + petalLength);
float y2 = sin(angle) * (radius + petalLength);
line(x1, y1, x2, y2);
angle += TWO_PI / numPetals;
} else {
// circle as flower's core
fill(100,0,20);
ellipse(0, 0, 20, 20);
// Reset angle for the next flower
angle = 0;
// Increase the radius for the next set of petals
radius += 20;
// Change the number of petals for variety
numPetals = int(random(5, 15));
}
}