Skip to main content
100%

Flag of Sweden

✓ Published0🌍 Public
BBrandonStroud
Last edited Mar 22, 2016
Created on Mar 22, 2016

The example draws the Swedish flag as a static SVG rectangle, using D3 to append a single `rect` element and animate its fill color. It shows the flag’s proportions (5:2:9 horizontal, 4:2:4 vertical) but only transitions between two solid colors—starting as a red-brown and easing into the correct blue—without drawing the yellow cross. The code uses `d3.select`, `svg.append`, and `transition().duration(3000).ease("bounce")` to change the fill. The visible rendering relies on D3’s SVG manipulation, with no external data source; the flag’s design is hardcoded via the rectangle’s dimensions and color values.

AI-generated description

Draw the national flag of Sweden using javascript’s D3 library. The flag has only two colors: #005b99 and #fcd116. The dimensions of the Swedish flag are 5:2:9 horizontally and 4:2:4 vertically.

This is worth 20 points

forked from <a href='http://bl.ocks.org/scresawn/'>scresawn</a>'s block: <a href='http://bl.ocks.org/scresawn/6c785c7a03a258e4d5ff'>Flag of Sweden</a>

Similar vizzes