Skip to main content
100%

Let's make a face with D3.js!

✓ Published0🌍 Public
PPhilRG
Last edited May 13, 2020
Created on May 11, 2020

This example builds a smiley face with D3.js, including a yellow circle head, eyes, and a mouth, while animated eyebrows move up and down and shift side to side in a looping transition. The code demonstrates basic DOM manipulation and SVG rendering using D3 v5 selection and attribute methods, alongside the `arc` generator to create the mouth path. A timed `transition` chain, with 2000-millisecond durations, animates the eyebrow group’s transform, changing its vertical and horizontal position, while colored rectangles serve as the eyebrows. The face is centered in an SVG with a green background.

AI-generated description

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

MIT Licensed

Similar vizzes