Shapes and Colors with SVG and CSS
✓ Published1🌍 Public
This example demonstrates a dynamic fruit bowl visualization where apples and lemons are drawn as SVG shapes and animated using D3 v5 transitions. The fruitBowl function renders a gray bowl as a rectangle, with each fruit positioned horizontally and colored via a d3.scaleOrdinal color scale with red for apples and yellow for lemons. User interaction includes mouseover and mouseout events that highlight the selected fruit with a green stroke. The animation sequence uses d3.transition to smoothly move, resize, and remove fruits over time, showcasing the merge, enter, and exit lifecycle methods for SVG groups.
AI-generated descriptionAn example including some commonly used features of SVG.
MIT Licensed