Skip to main content
100%

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

✓ Published0🌍 Public
Jjanenoxid
Last edited Sep 19, 2021
Created on Sep 19, 2021

This example renders a yellow smiley face as an SVG using React and D3. It draws the face, eyes, and a mouth using SVG circle elements and a D3 arc path helper from the d3-shape package. The mouth is positioned using a transform on a group element, with coordinates centered in a 960 by 500 viewport. The code defines geometric constants for radii, offsets, and stroke widths, and demonstrates D3’s arc constructor with method chaining for the mouth’s inner and outer radii and angle range.

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!!

MIT Licensed

Similar vizzes