Skip to main content
100%

Let's make a face with D3.js!

✓ Published1🌍 Public
Jjufrank
Last edited Apr 11, 2020
Created on Apr 11, 2020

This example shows a yellow smiley face built with SVG elements in D3.js, whose eyebrows animate upward and downward in a looping transition. The code constructs the face using simple shapes: `circle` for the head and eyes, `rect` for the eyebrows, and a `path` generated with the `d3.arc` function for the mouth. D3 selections and the `transition().duration()` method drive the eyebrow movement, while the SVG is centered within a fixed 960×500 viewport using a translated `<g>` container.

AI-generated description

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

MIT Licensed

Similar vizzes