处理:几个圆圈相互融合+变色

processing: several circles into each other + changing color

我必须做某事。像这样,我无法弄清楚问题是什么。 这是我的代码:

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;
}

它应该是这样的:

您必须使用 Alpha 通道设置 "fill" 颜色。如果您使用 1 个参数调用 fill(),则只会设置灰色。使用 2 个参数来设置灰色和 alpha 通道。

fill( w, w );

由于默认的 belnd 模式是 BLEND,对象是 blendend。这意味着,如果在同一个地方绘制了更多的对象,那么场景将在这部分变得更加饱和。所以没必要连续改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;
}

预览: