Skip to main content
100%

Smiling face with D3.js!

✓ Published0🌍 Public
KKamalabot
Last edited Jul 8, 2022
Created on Jul 8, 2022

This example animates a cheerful smiley face drawn entirely with SVG shapes, with its eyebrows moving up and down in a looping motion. The face itself is constructed using basic D3.js selections to append a yellow circle, two eye circles, rectangular eyebrows, and an arc-based mouth. The animation is driven by chained `transition().duration()` calls that alter the eyebrow group’s transform attribute, moving it vertically. The code imports `select` and `arc` from D3 v5, and positions all elements relative to the SVG’s center by applying a translate transform to a container group.

AI-generated description

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

MIT Licensed

Similar vizzes