There’s a lot going on in that code. There doesn’t have to be. Here’s a simple example of what I think you’re trying to draw:
function setup() {
createCanvas(600,400);
}
function draw() {
background( 0 );
translate(width/2, height/2);
noStroke();
fill(128);
ellipse(0, 0, 150, 150);
for( var i = 0; i < 9; i++ ) {
rotate( TWO_PI/9.0 );
ellipse( 150, 0, 50, 50 );
stroke(196);
line( 0, 0, 150, 0 );
noStroke();
}
}