changing fill color with if() and mouseReleased()
in
Programming Questions
•
2 years ago
i want this to make a circle each time i make a click, but also that it changes its color from red to green, (green to blue and blue to red, with alpha. ) so each team i click the circle is a different color.
maybe if() is not correct to use with color() but i don't know in what other manner i can do it.
- color red= color(255, 0, 0, 10);
- color green= color(0, 255, 0, 10);
- color blue= color(0, 0, 255, 10);
- void setup() {
- size(240, 420);
- background(255);
- smooth();
- }
- void draw() {
- noStroke();
- fill(red);
- if (mousePressed == true) {
- ellipse(mouseX, mouseY, 50, 50);
- }
- }
- void mouseReleased()
- {
- if (color(red))
- {
- color(green);
- }
- {
- if(color(green))
- {
- color(blue);
- }
- }
- {
- if(color(blue))
- {
- color(red);
- }
- }
thank you
1