{
const svg = d3.select(DOM.svg(width, height))
const sel = svg.append('g').attr('transform', `translate(${width/2}, ${height/2})`)
let t = 0
const reps = amount
const colorRainbow = d3.scaleSequential()
.domain([0, reps])
.interpolator(d3.interpolateRainbow)
function update(_t) {
sel.append('circle')
.attr('cx', x(_t))
.attr('cy', y(_t))
.attr('r', d3.randomUniform(2, 7)())
.attr('fill', colorRainbow(_t))
}
function x(n) {
return Math.sin(n / 10) * 100 + Math.sin(n / 15) * 100
}
function y(n) {
return Math.cos(n / 10) * 100
}
while (t < reps) {
t++
update(t)
yield svg.node()
}
}