You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
470 B
23 lines
470 B
2 years ago
|
var circles = [];
|
||
|
|
||
|
function setup(){
|
||
|
setFrameRate(60);
|
||
|
createCanvas(windowWidth, windowHeight);
|
||
|
strokeWeight(1);
|
||
|
}
|
||
|
|
||
|
function draw(){
|
||
|
fill(55);
|
||
|
while (true){
|
||
|
var circle = new Circle(random(windowWidth), random(windowHeight), 1);
|
||
|
if (circle.touchesCircle()) circle.valid = false;
|
||
|
if (circle.valid) circles.push(circle); break;
|
||
|
}
|
||
|
for (var c of circles){
|
||
|
if (c.touchesEdges() || c.touchesCircle()) c.done = true;
|
||
|
if (!c.done) c.grow();
|
||
|
c.draw();
|
||
|
}
|
||
|
}
|
||
|
|