function circles(svg) {
console.log('circles called');
const circle = svg
.selectAll('circle')
.data(circleArray)
.join('circle')
.attr('stroke', (d, i) => color(i))
.attr('opacity', 0.6)
.attr("fill", "none")
.attr("stroke-width", 2);
return (counter, transition) => {
const toRadians = angle => {
return angle * (Math.PI / counter);
};
circle
.transition(transition)
.attr("r", radius)
.attr("cx", d => width / 2 + Math.sin(toRadians(d)) * radiusValue)
.attr("cy", function(d, i) {
if (i < circleCount / 2) {
return height / 2 - radius + Math.cos(toRadians(d)) * radius;
} else {
return height / 2 + radius - Math.cos(toRadians(d)) * radius;
}
});
};
}