stuck, confused; help!
in
Programming Questions
•
2 years ago
Hi,
i have tried to work this out myself, but am stuck and would really appreciate some mods to my code to get me started. i am trying to make make attached sketch so that the coloured segments increase and descrease in size as they are clicked. i have sort of got the bottom right segment working, but cant get others to move...Its a mess i know, and i should prob be converting cartesian to polar, but my maths brain is rubbish, sorry!
void setup() {
size(300, 300);
smooth();
translate(width/2, height/2);
size(300, 300);
smooth();
translate(width/2, height/2);
ellipse(0, 0, 120, 120);
}
}
void draw() {
background(255);
translate(width/2, height/2);
fill(230);
ellipse(0, 0, 120, 120);
if (mouseX>width/2&&mouseX<width/2+120&&mousePressed) {
fill(0, 100, 0, 100);
arc(0, 0, mouseY, mouseY, radians(0), radians(90));
}
fill(255, 0, 0, 190);
arc(0, 0, 120, 120, radians(90), radians(180));
fill(0, 0, 200, 20);
arc(0, 0, 90, 90, radians(180), radians(270));
fill(0, 220, 0, 30);
arc(0, 0, 120, 120, radians(270), radians(360));
fill(0, 0, 200, 20);
arc(0, 0, 90, 90, radians(180), radians(270));
fill(0, 220, 0, 30);
arc(0, 0, 120, 120, radians(270), radians(360));
}
2