About a wrong color selector, please ^^
in
Programming Questions
•
1 year ago
Hello guys !
I was drawing some ellipses and a rectangle to create an island and i would like to pick up colors that i choose in rgb to fill the island, the sea and the ombrel with the appropriate colors but when my mouse is on the button, all the elements become a same color, why ? Can you help me please ?
and i was wondering how can i make my ellipse (the island) remain yellow when my mouse is pressed, i tried "if mousepressed" , of course, it didn t work but i think i lack something ...
Thanks for your precious help : )
This is my code :
color sable,mer,ombrelle;
void setup (){
size (500,250);
smooth();
background(7,207,240);
colorMode(RGB);
sable = color (224,203,168);// rgb
mer = color (8,150,190);
ombrelle = color (255,0,0);
}
void draw(){
color souris = get(mouseX,mouseY); // remplit forme entiere
noStroke();
fill(sable);
rect(0,0,20,20);
fill(mer);
rect(0,20,20,20);
fill (ombrelle);
rect(0,40,20,20);
//sea
fill(souris);
noStroke();
rect(0,100,1080,650);
// îsland
fill(souris);
noStroke();
ellipse (50,200,1000,150);
//ombrelle
noStroke();
fill (souris);
ellipse (150,100,200,90);
//dessus baton
stroke (100,50,30);
fill (0,50,50);
rect (150,70,10,22);
//baton
stroke (100,50,30);
fill (0,50,50);
rect (150,145,10,70);
}
I was drawing some ellipses and a rectangle to create an island and i would like to pick up colors that i choose in rgb to fill the island, the sea and the ombrel with the appropriate colors but when my mouse is on the button, all the elements become a same color, why ? Can you help me please ?
and i was wondering how can i make my ellipse (the island) remain yellow when my mouse is pressed, i tried "if mousepressed" , of course, it didn t work but i think i lack something ...
Thanks for your precious help : )
This is my code :
color sable,mer,ombrelle;
void setup (){
size (500,250);
smooth();
background(7,207,240);
colorMode(RGB);
sable = color (224,203,168);// rgb
mer = color (8,150,190);
ombrelle = color (255,0,0);
}
void draw(){
color souris = get(mouseX,mouseY); // remplit forme entiere
noStroke();
fill(sable);
rect(0,0,20,20);
fill(mer);
rect(0,20,20,20);
fill (ombrelle);
rect(0,40,20,20);
//sea
fill(souris);
noStroke();
rect(0,100,1080,650);
// îsland
fill(souris);
noStroke();
ellipse (50,200,1000,150);
//ombrelle
noStroke();
fill (souris);
ellipse (150,100,200,90);
//dessus baton
stroke (100,50,30);
fill (0,50,50);
rect (150,70,10,22);
//baton
stroke (100,50,30);
fill (0,50,50);
rect (150,145,10,70);
}
1