Skip to main content
100%

Let's make a face with D3.js!

✓ Published0🌍 Public
SShuai Shao
Last edited Mar 20, 2020
Created on Mar 20, 2020

This example shows a yellow smiley face built with SVG shapes, including a face circle, two eyes, and animated eyebrows that move continuously. It demonstrates fundamental D3.js DOM manipulation using method chaining with `d3.select` and `svg.append`, setting attributes like `r`, `cx`, `cy`, `fill`, and `stroke` on circle elements. The code uses D3 v5 from the `d3` module, importing `select` and `arc` (though `arc` is not used in the visible code). The face is rendered in a fixed 960x500 SVG canvas, with eye positions calculated from the width and height.

AI-generated description

Demonstrates fundamental DOM manipulation using D3.js by making a smiley face whose eyebrows move.

MIT Licensed

Similar vizzes