Skip to main content
100%

Let's make a face with D3.js!

✓ Published0🌍 Public
Lliunaiming
Last edited Jul 19, 2019
Created on Jul 19, 2019

This example shows a simple animated smiley face drawn in an SVG canvas using D3.js. The face consists of a yellow circle, two eyes, eyebrows, and a mouth shape. It demonstrates core DOM manipulation with `d3.select` and `svg.append`, applying attributes like `attr('r')`, `attr('cx')`, and path building via `d3.arc`. The eyebrows animate through chained `transition().duration(2000)` calls, moving them down and back up over four seconds. The code uses D3 v6 and explicitly sets the SVG background to red via `svg.style`.

AI-generated description

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

MIT Licensed

Similar vizzes