Categories

M Train-Interactive Code: Colorchange-Circle

CODE:

int r=50;
int change=3;
int cola=200;
int colb=60;

void setup() {
background(0);
size(400, 400);
}
void draw() {
fill(0, 0, 0, 10);
rect(0, 0, 400, 400);
stroke(cola, colb, colb);
strokeWeight(3);
fill(255, 255, 255, 0);
ellipse(200, 200, 2*r, 2*r);
if (mousePressed&&(mouseButton == LEFT)) {
cola=200;
colb=40;
}
if (mousePressed&&(mouseButton == RIGHT)) {
cola=60;
colb=200;
}
if (mousePressed) {
r=r+change;
}
if (r<=5||r>=200) {
change=change*-1;
}

}

No Comments

Sorry, the comment form is closed at this time.