Reputation: 59
I have to do smth. like this and I can't figure out what the problem is. Here is my code:
size(200,200);
background(255);
float w = 200 ;
float radius = 20;
while ( radius <= 200) {
stroke(0);
fill( w );
ellipse( 100 , 100 , radius, radius);
w -= 10;
radius += 20;
}
it should look like this:
Upvotes: 1
Views: 106
Reputation: 211278
You have to set "fill" color with an alpha channel. If you call fill()
with 1 parameter, then only the gray color is set. Use 2 parameters, to set the gray color and the alpha channel.
fill( w, w );
Since the default belnd mode is BLEND
, the objects are blendend. This means, if more objects are drawn at the same place, then the scene will become more saturated at this parts. So it is not necessary to consecutively change w
.
size(200,200);
background(255);
float w = 60;
float radius = 20;
while ( radius <= 200) {
stroke(0);
fill( w, w );
ellipse(100, 100, radius, radius);
radius += 20;
}
Preview:
Upvotes: 1