🌍 Public
Viewing a saved revision (read-only)
53957bd8a791480ea696f041c20ce999
D3-8: Enter, Exit, Update (transitions)
This example demonstrates enter, exit, and update transitions in D3 by animating fruit objects represented as SVG circles. Initially, five apples appear; after four seconds, the rightmost apple exits by shrinking and disappearing, while another apple is replaced by a lemon (update). A subsequent removal filters out the second apple, triggering an exit transition. The code uses `d3.select`, `d3.scaleOrdinal`, and D3's transition API with `.transition().duration()`, `merge()`, and `.exit()` to handle the changes smoothly over six seconds.
AI-generated description