changing colors
in
Programming Questions
•
8 months ago
Hi. I'm fairy knew to processing but I'm doing a project where I need each individual ellipse to change a different color when I click it. At the moment I have no idea how to do that. Here's what I have so far:
PImage brain;
//string word[]{"homework","boyfriend","food","coffee","hate","love","college","oregon","no","yes","beer","party","late","time","class","money"};
//int amount[]{31,150,21,60,72,231,23,43,240,130,12,62,15,65,111,86};
//int level[]{5,5,2,2,5,4,5,1,3,2,5,4,5,2,2,5};
boolean circle1 = false;
boolean circle2 = false;
boolean circle3 = false;
boolean circle4 = false;
boolean circle5 = false;
boolean circle6 = false;
boolean circle7 = false;
boolean circle8 = false;
boolean circle9 = false;
boolean circle10 = false;
boolean circle11 = false;
boolean circle12 = false;
boolean circle13 = false;
boolean circle14 = false;
boolean circle15 = false;
boolean circle16 = false;
void setup(){
size(800,800);
//brain = loadImage("image.png");
//brain.resize(800,800);
//background(brain);
smooth();
stroke(58,111,222);
}
void draw(){
//background(brain);
//circle1,homework
fill(222,119,71,70);
ellipse(620,351,36,36);
//circle2,boyfriend
fill(222,119,72,70);
ellipse(609,450,150,150);
//circle3,food
fill(222,119,73,70);
ellipse(581,358,21,21);
//circle4,coffee
fill(222,119,74,70);
ellipse(531,368,60,60);
//circle5,hate
fill(222,119,75,70);
ellipse(573,301,72,72);
//circle6,love
fill(222,119,75,70);
ellipse(147,455,231,231);
//circle7,college
fill(222,119,76,70);
ellipse(521,411,23,23);
//circle8,oregon
fill(222,119,77,70);
ellipse(504,306,43,43);
//circle9,no
fill(222,119,78,70);
ellipse(444,170,240,240);
//circle10,yes
fill(222,119,79,70);
ellipse(427,425,130,130);
//circle11,beer
fill(222,120,71,70);
ellipse(472,350,12,12);
//circle12,party
fill(222,121,71,70);
ellipse(437,323,62,62);
//circle13,late
fill(222,122,71,70);
ellipse(375,297,15,15);
//circle14,time
fill(222,123,71,70);
ellipse(356,343,65,65);
//circle15,class
fill(222,124,71,70);
ellipse(244,264,111,111);
//circle16,money
fill(222,125,71,70);
ellipse(298,399,86,86);
}
How can I get it so that each ellipse changes color?
PImage brain;
//string word[]{"homework","boyfriend","food","coffee","hate","love","college","oregon","no","yes","beer","party","late","time","class","money"};
//int amount[]{31,150,21,60,72,231,23,43,240,130,12,62,15,65,111,86};
//int level[]{5,5,2,2,5,4,5,1,3,2,5,4,5,2,2,5};
boolean circle1 = false;
boolean circle2 = false;
boolean circle3 = false;
boolean circle4 = false;
boolean circle5 = false;
boolean circle6 = false;
boolean circle7 = false;
boolean circle8 = false;
boolean circle9 = false;
boolean circle10 = false;
boolean circle11 = false;
boolean circle12 = false;
boolean circle13 = false;
boolean circle14 = false;
boolean circle15 = false;
boolean circle16 = false;
void setup(){
size(800,800);
//brain = loadImage("image.png");
//brain.resize(800,800);
//background(brain);
smooth();
stroke(58,111,222);
}
void draw(){
//background(brain);
//circle1,homework
fill(222,119,71,70);
ellipse(620,351,36,36);
//circle2,boyfriend
fill(222,119,72,70);
ellipse(609,450,150,150);
//circle3,food
fill(222,119,73,70);
ellipse(581,358,21,21);
//circle4,coffee
fill(222,119,74,70);
ellipse(531,368,60,60);
//circle5,hate
fill(222,119,75,70);
ellipse(573,301,72,72);
//circle6,love
fill(222,119,75,70);
ellipse(147,455,231,231);
//circle7,college
fill(222,119,76,70);
ellipse(521,411,23,23);
//circle8,oregon
fill(222,119,77,70);
ellipse(504,306,43,43);
//circle9,no
fill(222,119,78,70);
ellipse(444,170,240,240);
//circle10,yes
fill(222,119,79,70);
ellipse(427,425,130,130);
//circle11,beer
fill(222,120,71,70);
ellipse(472,350,12,12);
//circle12,party
fill(222,121,71,70);
ellipse(437,323,62,62);
//circle13,late
fill(222,122,71,70);
ellipse(375,297,15,15);
//circle14,time
fill(222,123,71,70);
ellipse(356,343,65,65);
//circle15,class
fill(222,124,71,70);
ellipse(244,264,111,111);
//circle16,money
fill(222,125,71,70);
ellipse(298,399,86,86);
}
How can I get it so that each ellipse changes color?
1