xxxxxxxxxx
38
var blackX;
var whiteX;
var blackY;
var whiteY;
function setup() {
createCanvas(600, 600);
}
function draw() {
noStroke();
background(125, 170, 200);
translate(width / 2, height / 2);
fill(255);
circle(0, 0, width / 2);
blackX = map(min(max(0, mouseX), width), 0, 300, 0, 40);
blackY = map(min(max(0, mouseY), height), 0, 300, 0, 40);
fill(0);
translate(-25, -25);
push();
translate(-25, -25);
ellipse(blackX, blackY, 150, 150);
pop();
push();
fill(255);
translate(-10, -10);
whiteX = map(min(mouseX, width + 40), 0, 300, -60, 20);
whiteY = map(min(mouseY, height + 40), 0, 300, -60, 20);
ellipse(whiteX, whiteY, 20, 20);
pop();
}