function setup() {
createCanvas(400, 400);//create the canvas
}
function draw() {
translate(200,200)
strokeWeight(3)
stroke(0);
noFill();
push()
rotate(PI/6)
polygon(0,0,100,3)
pop()
noStroke()
fill(0)
circle(100*cos(-5*PI/6),100*sin(-5*PI/6),50)
circle(100*cos(-PI/6),100*sin(-PI/6),50)
circle(100*cos(3*PI/6),100*sin(3*PI/6),50)
fill(255);
push()
rotate(-PI/6)
polygon(0,0,100,3)
pop()
noLoop()
}
function polygon(x, y, radius, npoints) {
let angle = TWO_PI / npoints;
beginShape();
for (let a = 0; a < TWO_PI; a += angle) {
let sx = x + cos(a) * radius;
let sy = y + sin(a) * radius;
vertex(sx, sy);
}
endShape(CLOSE);
}