Skip to main content
Public

Share visualization

Loading preview…

Let's make a face with 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 with D3.js

1
AAkash
Last edited Mar 21, 2022
Created on Mar 21, 2022

This example builds a simple cartoon face using D3.js v7 and SVG primitives. A yellow circle forms the head, with smaller circles for eyes, rectangles for eyebrows, and a semicircular arc for the mouth, all positioned relative to the center of the SVG canvas. The code uses `d3.select` to target the SVG, `append` with `attr` to create shapes, and `transition().duration()` to animate the eyebrow group’s vertical position in a two-step bounce. The layout is handled manually with computed offsets rather than a data-driven scale or simulation.

AI-generated description

An example including some commonly used features of SVG.

Comments

Sign in to join the discussion.

MIT Licensed