I have a p5.js sketch that draws radial gradients on the canvas in the browser window. They appear as they should, except when two or more overlap, when it looks like this: .
This is the class that is called to draw a radial gradient:
function Grey()
{
this.radius = int( random( 10, 200 ) );
this.x = random( 0 + this.radius, width - this.radius );
this.y = random( 0 + this.radius, height - this.radius );
this.display = function()
{
push();
for ( var i = 1; i <= this.radius; i++ )
{
var c = int( map( i, 1, this.radius, 0, 255 ) );
stroke( c );
ellipse( this.x, this.y, i, i );
}
pop();
};
}
edit: I have tried all available blending modes, neither was better than the default BLEND
.
edit 2: code in p5.js editor