Skip to main content
100%

Let's make a face with D3.js!

✓ Published4🌍 Public
PPotikorn
Last edited Feb 14, 2020
Created on Feb 14, 2020

A yellow smiley face with moving eyebrows demonstrates basic D3.js DOM manipulation. The code uses D3 v5’s `select` and `arc` to draw SVG circles, rectangles, and a mouth path on a fixed 960×500 canvas. Eyebrow rectangles transition upward and back down over two seconds via chained `transition().duration(2000)` calls. The face is centered using an SVG `g` group with transformations, while eye and eyebrow positions are calculated from fixed numeric offsets. No external data is loaded; all shapes are generated programmatically.

AI-generated description

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

MIT Licensed

Similar vizzes