Nice sketch! Looks like
arc(x, y, w, h, pi, pi) produces a circle. You can see this if you comment out the
arcEnd = map(...) and add
arcEnd = pi. I guess the assumption is that when arc is called with the same start and stop you want a circle in p5.js. It probably makes sense sometimes but clearly it’s not what you’re looking for.
You could either change the to look something like
arcEnd = map(sin(offset + theta), -1, 1, pi + 0.01, pi*2) or add an if statement so the arc is only drawn when
(arcEnd !== pi). Hope that helps.