Skip to main content
100%

Let's make a face with D3.js!

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

This example demonstrates fundamental DOM manipulation with D3.js by constructing a smiley face from SVG primitives. It shows how to append and position circles, rectangles, and an arc-generated mouth path using selections and attribute setters. The code imports `select` and `arc` from d3 and uses template literals for transform translations, creating static facial features with fixed dimensions. The face includes yellow head circle, spaced eyes, rectangular eyebrows, and a curved mouth via d3's arc generator, all rendered in SVG on a 960×500 canvas.

AI-generated description

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

MIT Licensed

Similar vizzes