Skip to main content
100%

Bowl of Fruit - Animated Transitions

✓ Published1🌍 Public
YYoram
Last edited Oct 16, 2020
Created on Oct 16, 2020

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.

AI-generated description

TEST

MIT Licensed

Similar vizzes