Unit 2 – LA 2 – 2.1
This was a very smal lesson, so I will keep it short, we worked with hovering and this is what I created:
var d1, d2;
function setup() {
createCanvas(450, 150);
}
function draw() {
background('#000000');
fill('#ffffff');
rect(0, 0, 225, 150);
var d1 = dist(mouseX, mouseY, 110, 75);
var d2 = dist(mouseX, mouseY, 330, 75);
if (d1 < 30/2) {
fill(225);
} else {
fill('#000000');
}
ellipse(110, 75, 30, 30);
if (d2 < 30/2) {
fill(225);
} else {
fill('#ffffff');
}
ellipse(330, 75, 30, 30);
}