Skip to main content
100%

Let's make a face with D3.js!

✓ Published1🌍 Public
Mmjoaquim12
Last edited Oct 29, 2019
Created on Oct 29, 2019

This example uses D3.js to build a smiley face in an SVG container, with eyebrows that animate up and down via chained transitions. The code selects the SVG, appends a centered group, and draws the yellow circle head, eyes, rectangular eyebrows, and a mouth path created with the `d3.arc` generator. Eyebrow motion is achieved through two sequential `transition().duration(2000)` calls that shift the eyebrow group’s transform attribute. The rendering relies on SVG elements and D3’s `select` and `arc` methods, with fixed numeric constants for spacing and sizing.

AI-generated description

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

MIT Licensed

Similar vizzes