Skip to main content
100%

Let's make a face using D3.js!

✓ Published1🌍 Public
ZZihan (Lexie) Zhou
Last edited Mar 6, 2023
Created on Mar 6, 2023

This example composes a simple cartoon face from basic D3.js shapes: a yellow circle for the head, two circles for eyes, rectangles for eyebrows, and an arc path for the mouth. The code uses D3 v7's `select` and `append` to build the SVG structure, with a `transition().duration(200)` animation that momentarily raises both eyebrows. The face is centered in a 960×500 SVG canvas, with all facial features positioned relative to the center using translation transforms and fixed pixel offsets.

AI-generated description
MIT Licensed

Similar vizzes