Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Smiley Face Part-3 (React and d3)

Public visualization

Viewing a saved revision (read-only)

33e0013de06e4a7a9379ed2d2b610bee

Fork of Smiley Face Part-3 (React and d3)

0 stars0🌍 Public
CChrisGaul
Last edited Sep 29, 2021
Created on Sep 29, 2021

A React and D3 example renders a simple smiley face as an SVG graphic, with a yellow circle head, two black eyes, and a curved mouth. The face is drawn using SVG circle and path elements within a group that uses a translate transform to center it. D3’s `arc` helper from the `d3-shape` package generates the mouth path by defining inner and outer radii and start and end angles. React 16.13.1 manages the component structure, while D3 v6.7.0 provides the arc geometry. No external data is used; all dimensions are hardcoded constants.

AI-generated description

Part-3) D3 intro

  • Getting started with the D3 library

  • Using arc from the d3-shape package arc is a helper function used for drawing an arc shape for the mouth.

  • SVG path elements

  • SVG group elements and the transform attribute

  • Using ES6 Template Literals

  • Adding the mouth to our face

Assignment: Tweak the Face!!