This is one technique using pushMatrix()…rotate()…popMatrix:
float startAngle;
float endAngle;
float biteSize;
void setup() {
size(410, 200);
}
void draw() {
background(0);
fill(255, 255, 0);
// Update start and stop angles.
biteSize = PI / 16; //smaller the denominator, bigger the bite
startAngle = biteSize * sin(frameCount * 0.1) + biteSize;
endAngle = TWO_PI - startAngle;
// Draw the arc.
arc(50, 50, 80, 80, startAngle, endAngle, PIE);
pushMatrix();
translate(150,50);
rotate(radians(90));
arc(0, 0, 80, 80, startAngle, endAngle, PIE);
popMatrix();
pushMatrix();
translate(250,50);
rotate(radians(180));
arc(0, 0, 80, 80, startAngle, endAngle, PIE);
popMatrix();
pushMatrix();
translate(350,50);
rotate(radians(270));
arc(0, 0, 80, 80, startAngle, endAngle, PIE);
popMatrix();
}
Alternate technique by changing start/end angles (converted to p5.js):
var startAngle;
var endAngle;
let biteSize;
function setup() {
createCanvas(450, 200);
}
function draw() {
background(0);
fill(255, 255, 0);
biteSize = PI / 16; //smaller denominator => bigger bite
// Right
startAngle = radians(12) + biteSize * sin(frameCount * 0.1);
endAngle = radians(348) - biteSize * sin(frameCount * 0.1);
arc(50, 50, 80, 80, startAngle, endAngle, PIE);
// Left
startAngle = radians(-168.75) + biteSize * sin(frameCount * 0.1);
endAngle = radians(168.75) - biteSize * sin(frameCount * 0.1);
arc(150, 50, 80, 80, startAngle, endAngle, PIE);
// Up
startAngle = radians(-78.75) + biteSize * sin(frameCount * 0.1);
endAngle = radians(258.75) - biteSize * sin(frameCount * 0.1);
arc(250, 50, 80, 80, startAngle, endAngle, PIE);
// Down
startAngle = radians(-258.75) + biteSize * sin(frameCount * 0.1);
endAngle = radians(78.75) - biteSize * sin(frameCount * 0.1);
arc(350, 50, 80, 80, startAngle, endAngle, PIE);
}