let colors = ['#177e89', '#084c61', '#db3a34', '#ffc857', '#f73939', '#ffda33', '#0c4896', '#48b7f7', '#a480cf', '#f18701', '#f35b04', '#eb9486', '#ee92c2', '#3e000c', '#f9f8f8'];
fx = random(-0.1, 1.1) * width;
fy = random(-0.1, 1.1) * height;
background(random(colors));
shapes.sort((a, b) => a['n'] - b['n']);
for (let i = 0; i < shapes.length; i++) {
for (let i = 0; i < shapes.length; i++) {
function circlePacking() {
for (let i = 0; i < count; i++) {
let d = random(width * 0.8);
let n = int(map(dist(fx, fy, x, y), 0, sqrt(sq(width/2)+sq(height/2)), 1, 10000));
for (let j = 0; j < shapes.length; j++) {
if (dist(x, y, p.x, p.y) < (s + p.d) * 0.5) {
if (add) shapes.push(new Shape(x, y, s, n));
let n = int(random(5, 12));
for (let i = 0; i < n; i++) {
let dd = map(i, 0, n, d, 0);
circle(x - d * 0.2, y - d * 0.2, d * 0.2);
let a = atan2(y - fy, x - fx);
let col = color(random(colors));
line(x, y, x + l * cos(a), y + l * sin(a));