Skip to main content
100%

Let's make a face with D3.js!

✓ Published0🌍 Public
Ttianyilt
Last edited Nov 10, 2020
Created on Nov 10, 2020

This example demonstrates fundamental D3.js DOM manipulation by building a smiling face from SVG primitives—a yellow circle, two eyes, rectangular eyebrows, and an arc-shaped mouth—centered within an SVG. The code constructs the face using `select` and `append`, then animates the eyebrows upward and back down with chained `transition().duration(2000)` calls. It imports the `arc` helper from D3 v5 to generate the mouth path, and uses static attributes for sizing and positioning. The animation runs once on page load, showing a face whose eyebrows move without user interaction.

AI-generated description

Demonstrates fundamental DOM manipulation using D3.js by making a smiley face whose eyebrows move.

MIT Licensed

Similar vizzes