{
const svg = DOM.svg(width,height);
let centerX = width/2;
let centerY = height/2;
function toRadians(angle) {
return angle * (Math.PI / 180);
};
let circleArray = [];
for (let i = 0; i <= circles; i++) {
circleArray[i] = (360/circles)*i;
}
d3.select(svg).append("g").attr("transform", `translate(${width/3}, ${-height/2}) rotate(45)`).selectAll("circle")
.data(circleArray)
.enter()
.append("circle")
.attr("fill","none")
.attr("stroke","red")
.attr("stroke-width",1)
.attr("r",radius)
.attr("cx",d => centerX
+ amplitude * Math.sin(period * (toRadians(d) + phaseShift)) )
.attr("cy",(d,i) => (i < circles/2 ? height / 3 : height / 3 * 2)
+ amplitude * Math.cos(period * (toRadians(d) + phaseShift)) );
return svg;
}