Skip to main content
100%

Let's make a face with D3.js

✓ Published3🌍 Public
Rrandy554
Last edited Nov 7, 2020
Created on Nov 4, 2020

This example builds a smiling face out of basic SVG shapes using D3.js. The code creates circles for the face and eyes, rectangles for eyebrows, and an arc-generated path for the mouth, all positioned within a centered group. It uses D3’s `select`, `attr`, `append`, and `transition` with `duration` to animate the eyebrows moving up and down. The rendering relies on an SVG element defined in HTML, and the fixed dimensions (960 by 500) are read via `parseFloat(svg.attr(...))`. The face is composed entirely from hardcoded values, with no external data.

AI-generated description

A bare minimum HTML page.

See also React Starter.

MIT Licensed

Similar vizzes