Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Let's make a face with D3.js!

Public visualization

Viewing a saved revision (read-only)

27d1345aea1943b28244e82370996c6e

Let's make a face with D3.js!

0 stars0🌍 Public
Ttim-adam
Last edited Jun 22, 2020
Created on Jun 22, 2020

This example builds a smiling face out of SVG shapes—a yellow circle, two eyes, eyebrows, and an arc mouth—anchored at the center of a 960-by-500 viewport. Using d3.select and append, it constructs a group hierarchy for the eyes and eyebrows, then applies a repeating transition to the eyebrow group, shifting its transform up and down over two-second intervals with d3’s transition().duration. The mouth is drawn via d3.arc with inner and outer radii, while the face’s static elements remain fixed.

AI-generated description

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