Bowl of Fruit - Animated Transitions
A bowl of fruit demonstrates animated transitions in D3.js v5, showing how SVG circles representing apples and lemons enter, update, and exit smoothly over a one-second duration. Users can click a fruit to select it, which adds a black outline stroke. The code defines a custom `fruitBowl` module using `d3.scaleOrdinal` for color and radius scales, applies `selection.merge()` to coordinate enter and update, and triggers transitions via `transition().duration(1000)` on position, radius, and exit removal. The example also uses `setTimeout` to sequentially eat and replace fruit, updating bound data arrays.