Skip to main content
100%

Let's make a face with D3.js!

✓ Published1🌍 Public
SShaun Kee
Last edited Aug 5, 2019
Created on Aug 5, 2019

This example demonstrates fundamental DOM manipulation with D3.js by constructing a smiley face from SVG shapes. The code uses `d3.select` and `d3.append` to create concentric circles for the face and eyes, alongside SVG `rect` elements for the eyebrows. The eyebrows animate using chained `transition().duration()` calls, moving them up and down over two-second intervals. A mouth is drawn as a path using the `d3.arc` generator with specified inner and outer radii and angular range. The visualization runs as a self-contained HTML page with an embedded YouTube video for reference.

AI-generated description

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

MIT Licensed

Similar vizzes