Skip to main content
100%

Let's make a face with D3.js!

✓ Published0🌍 Public
MMartin Lauf
Last edited Jul 23, 2019
Created on Jul 23, 2019

A yellow smiley face with moving eyebrows is assembled on an SVG canvas using D3.js v5. The code builds the face from primitive shapes—circles for the eyes, rectangles for the brows, and a path from the `d3.arc()` generator for the mouth. The eyebrows are animated via chained `transition().duration()` calls that shift their container group up and down over four seconds. All dimensions are derived from the SVG's width and height attributes, and the face is centered with a translated `<g>` element.

AI-generated description

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

MIT Licensed

Similar vizzes