Skip to main content
100%

Let's make a face with D3.js

✓ Published2🌍 Public
MMichał Szumnarski
Last edited Jul 12, 2019
Created on Jul 10, 2019

This example uses D3.js v5 to construct a smiling face from basic SVG shapes. A yellow circle forms the head, while two smaller circles become the eyes. The code animates the eyebrows using chained `transition().duration()` calls, moving them up and then back down over two seconds. A mouth is drawn using the `arc()` generator from D3’s shape utilities, creating a curved path. All elements are positioned relative to the SVG center using a `g` transform, and the entire composition is rendered as static SVG with animated attributes.

AI-generated description

An example including some commonly used features of SVG.

MIT Licensed

Similar vizzes