Can someone help to check why the circles are not random color?

let r,g,b,colorFill,R;

let col,canvas2;

function setup() {
createCanvas(windowWidth, windowHeight);
canvas2=createGraphics(windowWidth, windowHeight);
canvas2.clear();

}

function draw() {
background(col,0,160);
col=map(mouseX,0,windowWidth,0,255)
noStroke();
fill(0);
rectMode(CENTER);
rect(mouseX, 200, 20);

noStroke();
r=random(255);
g=random(255);
b=random(255);
fill(r,g,b);
XPosition=random(windowWidth),
YPosition=random(windowHeight),
canvas2.circle(XPosition,YPosition,20);
image(canvas2,0,0)
}

sure
you need

canvas2.fill(r,g,b);

1 Like

Thanks. it works!!! :star_struck: