Skip to main content
100%

Make a Face with D3.js

✓ Published1🌍 Public
VVipul Basapati
Last edited Dec 31, 2018
Created on Dec 31, 2018

This example shows a simple smiling face constructed from three circles: a large yellow head and two black eyes positioned symmetrically within an SVG canvas. Using D3.js version 5, the code selects the SVG element, reads its dimensions, and appends circles with radii and coordinates calculated from the canvas height and width. The head is centered, while the eyes are offset by quarter-dimensions to create facial symmetry, with the `attr` method setting fill colors and stroke properties.

AI-generated description
MIT Licensed

Similar vizzes