Skip to main content
100%

Let's make a face with D3.js

✓ Published0🌍 Public
WWillkommen
Last edited Jul 14, 2019
Created on Jul 14, 2019

This example builds a simple smiling face using D3.js SVG primitives, starting with a yellow circle for the head, two circles for eyes, and an arc path for the mouth. A group of rectangular eyebrows transitions upward and back down over two seconds using chained `transition().duration(2000)` calls, creating a subtle animation. The face is centered by translating a parent `<g>` element to the SVG’s midpoint, with all positioning handled via explicit `attr` values for coordinates and dimensions. The implementation relies on D3’s `select`, `arc` generator, and transition API, rendering entirely in SVG.

AI-generated description

An example including some commonly used features of SVG.

MIT Licensed

Similar vizzes