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)

6425af749e014b519d98771cf2683897

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

0 stars0🌍 Public
Aaniosindustries
Last edited Nov 1, 2021
Created on Nov 1, 2021

This example shows a yellow smiley face with black-outlined circular eyes and a curved mouth, composed using SVG elements. The face is drawn inside a group that is translated to the center of a 960 by 500 canvas. The mouth uses D3’s `arc()` helper from `d3-shape` to generate a path, while the eyes and face are plain SVG circles. The code runs in React, rendering the SVG via ReactDOM, and sets stroke, fill, and radius properties directly in JSX.

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