Let's make a face with D3.js
✓ Published3🌍 Public
This example shows a simple yellow smiley face built entirely with SVG shapes, with eyebrows that animate up and down to give the face a surprised expression. The code uses D3.js v4 selection methods to create circles for the face, eyes, and pupils, rectangles for the eyebrows, and a D3 arc generator to draw the mouth path. Transitions animate the eyebrow group’s transform attribute over two seconds, creating a repeated up-and-down motion. The face is centered using an SVG group translation based on the viewport dimensions.
AI-generated descriptionAn example including some commonly used features of SVG.
MIT Licensed