Skip to main content
100%

Let's make a face with D3.js!

✓ Published0🌍 Public
Mmerha-g-selassie
Last edited Dec 6, 2019
Created on Dec 6, 2019

This example demonstrates fundamental DOM manipulation with D3.js by building a smiley face in an SVG canvas. The code selects the `<svg>` element, retrieves its width and height attributes, and positions a circle at the center using those dimensions. It uses D3’s `select` method and chained attribute setters like `attr(‘r’)`, `attr(‘cx’)`, and `attr(‘cy’)` to control the face’s radius and coordinates. The rendering relies on D3 v5 with SVG output, and the accompanying video highlights interactive eyebrow movement.

AI-generated description

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

MIT Licensed

Similar vizzes