Skip to main content
100%

Let's make a face with D3.js!

✓ Published0🌍 Public
Mmoorephamily
Last edited Sep 27, 2018
Created on Sep 26, 2018

This example demonstrates fundamental DOM manipulation with D3.js by constructing a cartoon smiley face from SVG primitives and animating one of its eyebrows. The code builds a yellow circular face, a mouth using the d3.arc() path generator, and two eyes with rectangular eyebrows. It uses D3's selection and transition APIs, including .transition().attr() to animate the left eyebrow's vertical position over two seconds, while the right eyebrow remains static. The underlying data is purely geometric, derived from hardcoded constants like eyeSpacing, eyeRadius, and svgHeight.

AI-generated description

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

MIT Licensed

Similar vizzes