Skip to main content
100%

Let's make a face with D3.js!

✓ Published3🌍 Public
RRiccardo Pressiani
Last edited Oct 1, 2019
Created on Sep 30, 2019

A smiley face built with D3.js shows its eyebrows bobbing up and down in a continuous two-second animation loop. The code constructs the face from SVG shapes—a yellow circle, two eye circles, rectangular eyebrows, and an arc-based mouth—using d3-selection to append elements and d3-transition to animate the eyebrow group’s transform attribute. Eyebrows move via chained transitions with an `on("end")` callback that restarts the animation indefinitely. D3 v5 is loaded from a CDN, and all geometry is positioned relative to the SVG’s center.

AI-generated description

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

MIT Licensed

Similar vizzes