Skip to main content
100%

Let's make a smiley face with D3.js

✓ Published0🌍 Public
DDifan Gu
Last edited Jul 8, 2020
Created on Jul 8, 2020

This example creates a smiley face from basic SVG shapes using D3.js, drawn on a 960×500 canvas. The face consists of a yellow circle with a black stroke, two eyes, rectangular eyebrows, and a mouth created with D3’s `arc` function. The eyebrows animate by chaining two `transition().duration(2000)` calls, moving them down and then back up over four seconds. The code uses D3 v5 selections (`select`, `append`) and attribute setters to position elements via transforms.

AI-generated description

An example including some commonly used features of SVG.

MIT Licensed

Similar vizzes