Hi, I’m trying to split a circle into 28 parts to look something like this:
But I can’t do it. Does someone know how to do it?
Use arc()
. Maybe in conjunction with a for
loop and rotate()
.
Post your attempt for more help.
I thought arc() was to cut the circle. I just want to split the circle to make each part interactive with the mouse
Ah, in that case you can just draw some lines:
void setup(){
size(400,400);
}
void draw(){
background(0);
ellipse(200,200,360,360);
pushMatrix();
translate(200,200);
for( int i = 0; i<14; i++){
line(-180,0,180,0);
rotate(PI/14.0);
}
popMatrix();
}
Oh, if you want interactions with sections, then it might be better to draw each section by itself.
You would use arc() to draw one sections. Draw 28 of them, and you draw a full circle!
Oh you can draw the arcs of different colors (fully filled) on an invisible PGraphics behind your visible image
Then you check the mouse against the color using pg.get( mouseX, mouseY);
arc works just add a bit to the angles
Welcome to the forum!!!
I’d do which-arc-is-my-mouse-over detecting with distance and angle from circle center…
Hello,
Get to know the resources available to you.
Resources < Click here to expand !
I encourage you to review the resources available here:
- The Processing website has references, examples, tutorials, etc.
https://processing.org/ - Those available with the Processing PDE (IDE).
An exploration of the tabs will reveal what is available; there are libraries and examples there. - The Coding Train
https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1_aw
https://thecodingtrain.com/ - Happy Coding
Processing Tutorials - Happy Coding - The Processing Foundation
https://processingfoundation.org/
Check out the tabs.
In the education tab, there is a reference to the Coding Train.
:)
how could I do that ?
I have it like this but the circle and the lines are still not interactive. The image rotates but the circle and the lines are still not rotating
How can I do what?
When the image rotate using rotate
include the code section in this rotation section of the code please