Skip to main content
100%

Let's make a face with D3.js!

✓ Published1🌍 Public
Aaristidesnakos
Last edited Jul 19, 2019
Created on Jul 16, 2019

This example uses D3.js to construct a static smiley face entirely through SVG DOM manipulation. The code selects an SVG canvas and appends a yellow circle for the head, two black circles for the eyes, and a mouth path built with the `d3.arc` function. Key attributes like `cx`, `cy`, and `r` are set programmatically based on the SVG’s width and height, showcasing fundamental chaining and attribute methods in D3 v5. No animation or interactivity is present; the face renders once on page load.

AI-generated description

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

MIT Licensed

Similar vizzes