xxxxxxxxxx
23
/* Add a feature to your finished 6/10 sketch so that when the cursor hovers over the star symbol it would continuously rotate like the example GIF */
r = 0;
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
strokeWeight(4);
stroke(0, 0, 255);
}
function draw() {
background(220);
translate(width / 2, height / 2);
rotate(r);
for (let i = 0; i < 5; i++) {
rotate(45 * i);
line(-40, -40, 40, 40);
}
//hovers
if (mouseX > 200 - 40 && mouseX < 200 + 40 && mouseY > 200 - 40 && mouseY < 200+ 40) {
r++
}
}