Skip to main content
100%

Let's make a face with D3.js!

✓ Published0🌍 Public
BBaxinho
Last edited Feb 12, 2019
Created on Feb 12, 2019

This example uses D3.js v5 to build a simple cartoon face entirely with SVG shapes. It shows a yellow circle for the head, two black-outlined circles for eyes, and a curved mouth path, all centered within a 960×500 SVG canvas. The code exercises core D3 selections and the `arc` generator, computing eye spacing and mouth angles programmatically. Raw SVG attributes like `r`, `cx`, and `stroke-width` are set directly, while a group element translates all features to the canvas midpoint. The mouth’s path is produced by the `d3.arc` generator with specified inner and outer radii.

AI-generated description

An example including some commonly used features of SVG.

MIT Licensed

Similar vizzes