Skip to main content
100%

Fork of Create a face with d3.js!

✓ Published0🌍 Public
LLavinaThorat
Last edited Oct 5, 2023
Created on Oct 5, 2023

This example draws a yellow smiley face in SVG using D3 v7, centered within a 960×500 canvas. It constructs the face from primitive shapes: a circle for the head, two circles for eyes, rectangles for eyebrows, and an arc path for the mouth, all positioned using transforms and hardcoded coordinates. The code employs D3’s `select` and `arc` helpers, and animates the eyebrows by chaining two `transition().duration(2000)` calls that shift the eyebrow group vertically over four seconds. The rendering is purely SVG, with no external data source.

AI-generated description

An example showing the capabilities of VizHub:

  • Loads D3 via UNPKG.
  • Demonstrates use of import from "d3".
  • Demonstrates use of import from local ES6 modules.
MIT Licensed

Similar vizzes