why doesnt my while-loop work?
in
Programming Questions
•
8 months ago
hi,
i'm trying that my ellipses are losing their transparency every turn (what's the correct term for it?),
but i dont get my while-loop working.
i'm trying that my ellipses are losing their transparency every turn (what's the correct term for it?),
but i dont get my while-loop working.
- void setup() {
colorMode(HSB, 255);
size(400, 400);
background(0);
smooth();
frameRate(60);
}
void draw() {
color rc = round (random (255)); // random color
float rx = random (width); // random x-position of ellipse
float ry = random (height); // random y-position of ellipse
float d = random (10,120); // width/height of ellipse
int t = 100; // transparency of ellipse
while (t >= 0) {
kreis(rc, rx, ry, d, t);
t = t - 5;
}
}
void kreis (color rc, float rx, float ry, float d, int t) {
noStroke();
fill(rc, rc, rc, t);
ellipse(rx, ry, d, d);
noFill();
stroke(rc, rc, rc, t);
ellipse(rx, ry, 4+d, 4+d);
}
1