Skip to main content
100%

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

✓ Published0🌍 Public
Cclimate-chris
Last edited Sep 25, 2021
Created on Sep 25, 2021

A React component renders a yellow smiley face as an SVG graphic, with two black eyes and a curved mouth. The face is drawn using D3’s `arc` helper from the d3-shape API to generate the mouth path, while SVG `circle` and `path` elements are positioned inside a group with a `transform` translation. The example demonstrates combining React’s declarative rendering with D3’s geometry utilities, using ES6 template literals for dynamic attribute values and fixed pixel dimensions for the 960-by-500 viewport.

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