Skip to main content
100%

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

✓ Published0🌍 Public
PPeter Williams
Last edited Oct 22, 2021
Created on Oct 22, 2021

This example shows a simple smiley face built entirely with SVG primitives rendered through React. A yellow circle forms the head, two black circles are the eyes, and an arc-shaped `d` path defines the mouth. The code uses the `arc` helper from the `d3-shape` package to generate the mouth’s path geometry, with the arc’s inner and outer radii and start/end angles set via method chaining. SVG group elements and template literals position the face at the center of a 960×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