Skip to main content
100%

Let's make a face with D3.js!

✓ Published1🌍 Public
Ssourcebox-bug
Last edited Apr 10, 2019
Created on Apr 10, 2019

A D3.js animation draws a yellow smiley face with circular eyes, rectangular eyebrows, and an arc-shaped mouth. The code builds the face using SVG primitives like `circle`, `rect`, and `path`, selected and appended via `d3.select`. An animated eyebrow movement uses chained `transition().attr()` calls over two two-second intervals, shifting the eyebrow group vertically. The `d3.arc` generator defines the mouth’s curved path, and the layout centers the face within a 960×500 SVG using an offset group and width/height attributes.

AI-generated description

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

MIT Licensed

Similar vizzes