cesca
February 28, 2020, 10:24pm
5
cesca:
var circles = ; setup = () => { createCanvas(2145, 1210); for (var c = 0; c < 2200; c++) { var circle = { x: random(width), y: random (height), r: random (70, 5) }; var overlap = false; var protection = 0; for (var j = 0; j < circles.length; j++){ var other = circles[j]; var d = dist(circle.x,circle.y, other.x, other.y); if (d < circle.r + other.r){ overlap = true; } } if (!overlap) { circles.push(circle); } protection++; if (protection > 10000) { //break; } } } draw = () => { for (var i = 0; i < circles.length; i++){ if(mouseX && mouseY < circles[i].r){ fill(random(255), random(255), random(255)); strokeWeight(3); stroke(119,136,153); ellipse(circles[i].x, circles[i].y, circles[i].r2, circles[i].r 2); } else{ fill(255, 255, 255); stroke(119,136,153); strokeWeight(3); ellipse(circles[i].x, circles[i].y, circles[i].r2, circles[i].r 2); } textSize(300); strokeWeight(5); fill(255, 255, 255); textStyle(BOLD); textFont(‘Varela Round’); text(‘cesca’, 700, 650); } }
LOL i know! i wrote that in my description, but I don’t know how to target the specific circle the mouse is on. i tried “dist(mouseX, mouseY, circle.x, circle.y) < circle.r” but it doesn’t work.