why dont it fade away?
in
Programming Questions
•
1 years ago
hiya,
how come the circle don't fade to noFill when you move the mouse from the rect?!?
- int x=50;
- int y= 50;
- int w=50;
- int h=50;
- float r=50;
- float g=0;
- float b=0;
- float t=0;
- void setup() {
- //background(175);
- smooth();
- size(200, 200);
- }
- void draw() {
- strokeWeight(1);
- fill (255);
- rect(x, y, w, h);
- if (mouseX > x &&mouseX < x+w && mouseY> y&& mouseY<y+h) {
- r=r+10;
- t=t+10;
- fill(r, g, b, t);
- }
- else {
- r=r-1;
- t=t-8;
- fill(r, g, b, t);
- // fill(255,255);
- }
- strokeWeight(3);
- ellipse(x, y, w, h);
- r= constrain(r, 0, 255);
- t= constrain(t, 0, 255);
- }
1