xxxxxxxxxx
31
var x1, x2, y1, y2, c, d, e;
function setup() {
createCanvas(400, 400);
// random coordinates for 1st ellipse
x1 = random(0, width-10);
y1 = random(0, height-10);
// random coordinates for 2nd ellipse
x2 = random(0, width-10);
y2 = random(0, height-10);
// random color for rectangle
c = color(random(0,255), random(0,255), random(0,255));
// random canvas color
d = color(random(0,255), random(0,255), random(0,255));
// random ellipse color
e = color(random(0,255), random(0,255), random(0,255));
}
function draw() {
background(d);
fill(c);
rect(width/4,height/4,width/2,height/2);
fill(e);
ellipse(x1, y1, 20);
ellipse(x2, y2, 20);
}