Skip to main content
100%

Let's make a face with D3.js!

✓ Published1🌍 Public
MMartin Lord
Last edited Apr 15, 2020
Created on Apr 15, 2020

This example demonstrates how D3.js can build an animated smiley face entirely from SVG primitives, with eyebrows that repeatedly rise and fall. The code constructs the face by appending circles for the eyes and a path generated with `d3.arc` for the mouth onto a centered `<g>` group. It uses D3 selections and the `transition.attrTween`-like chained `.transition().duration()` calls to animate the eyebrow group’s vertical position over two seconds, creating a looping expression change. The implementation relies on D3 v5’s select, arc, and transition APIs.

AI-generated description

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

MIT Licensed

Similar vizzes