Skip to main content
100%

Let's make a face with D3.js!

✓ Published0🌍 Public
Ttim-adam
Last edited Jun 22, 2020
Created on Jun 22, 2020

This example builds a smiling face out of SVG shapes—a yellow circle, two eyes, eyebrows, and an arc mouth—anchored at the center of a 960-by-500 viewport. Using d3.select and append, it constructs a group hierarchy for the eyes and eyebrows, then applies a repeating transition to the eyebrow group, shifting its transform up and down over two-second intervals with d3’s transition().duration. The mouth is drawn via d3.arc with inner and outer radii, while the face’s static elements remain fixed.

AI-generated description

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

MIT Licensed

Similar vizzes