{
const element = this || scrollSVG(html`<svg width=${width} height=${svgHeight}></svg>`)
const svg = d3.select(element).select('svg')
const t = svg.transition().duration(1000)
svg.selectAll("g")
.data(filteredFlowers, d => d.title)
.join(
enter => {
const g = enter.append("g")
.attr("opacity", 0)
.attr("transform", d => `translate(${d.translate})`)
g.selectAll("path")
.data(d => _.times(d.numPetals, i => ({ ...d, rotate: i * (360 / d.numPetals) })))
.join("path")
.attr("d", d => d.path)
.attr("fill", d => d.color)
.attr("fill-opacity", 0.5)
.attr("stroke", d => d.color)
.attr("stroke-width", 2)
.transition(t)
.attr("transform", d => `rotate(${d.rotate})scale(${d.scale})`)
g.append("text")
.attr("text-anchor", "middle")
.attr("font-style", "italic")
.attr("font-size", ".7em")
.attr("dy", ".35em")
.text(d => _.truncate(d.title, { length: 20 }))
return g
},
update => update,
exit => {
exit.transition(t)
.attr("opacity", 0)
.remove()
}
).transition(t)
.attr("opacity", 1)
.attr("transform", d => `translate(${d.translate})`)
return element
}