Skip to main content
100%

Let's make a face with D3.js!

✓ Published1🌍 Public
OOrangTang
Last edited Nov 8, 2020
Created on Nov 8, 2020

This example demonstrates fundamental DOM manipulation with D3.js by building an animated smiley face. The visualization shows a yellow circle with eyes, eyebrows, and a mouth, where the eyebrows perform a continuous up-and-down movement. The code uses D3’s `select` and `append` to construct SVG elements, and `transition().duration()` to animate the eyebrow group’s `transform` attribute over 2000-millisecond intervals. The mouth is drawn with a `d3.arc` path generator, while hardcoded constants control facial feature positioning and spacing. The rendering is entirely SVG-based, with static input values defining the geometry.

AI-generated description

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

MIT Licensed

Similar vizzes