Skip to main content
100%

Let's make a face with D3.js!

✓ Published0🌍 Public
RRyan Fleming
Last edited Nov 7, 2018
Created on Aug 30, 2018

This example creates a smiley face in an SVG canvas using D3.js, with animated eyes that repeatedly expand and contract their pupils. It demonstrates fundamental DOM manipulation through D3 selections, appending circles, paths, and groups, while leveraging the arc generator to shape the eyes, eyebrows, and mouth. The code specifically uses d3.select and d3.arc from D3 v5, and the pupil animation is driven by chained transition calls that alternate the circles’ radii. The face is centered via a translated group, and positioning relies on hard-coded constants for eye spacing and offsets.

AI-generated description

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

MIT Licensed

Similar vizzes