Skip to main content
Public

Share visualization

Loading preview…

Let's make a face using D3.js!

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Let's make a face using D3.js!

1
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

Comments

Sign in to join the discussion.

MIT Licensed