Blending in an ellipse
in
Programming Questions
•
2 years ago
I am trying to blend a circle onto a background such that at the center of the circle, the color is 100% that of the circle and 0% of the background, and on the edge of the circle it is 0% color of the circle and 100% of the background. For example, a blue circle on a black background is blue in the center, fading blue to black as it goes outward from the center and is black at the end and outside the circle.
I wrote the following code to do it:
color c = color(0,0,255);
for (int r=0; r<255; r++) {
fill(c,1);
ellipse(x,y,2*r,2*r);
}
But at the end, the center point color is only (0,0,128). After r=128, it stops increasing. How can I get this right? Thanks!
gene
1