Skip to main content
100%

Let's make a face with D3.js!

✓ Published1🌍 Public
SShantanu Tripathi
Last edited Jun 30, 2020
Created on Jun 30, 2020

A smiley face drawn with D3.js animates its eyebrows in a looping motion. The example demonstrates fundamental DOM manipulation by building the face from SVG shapes—circles for the eyes, rectangles for the eyebrows, and a path generated with the `d3.arc` function for the mouth. Eyebrow movement is achieved through chained `transition` calls that alternate between two vertical positions over two-second intervals. The code uses `d3.select` to access the SVG and applies attributes via `.attr`, with static geometry defined by 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