Skip to main content
100%

Let's make a face with D3.js

✓ Published0🌍 Public
Sssdark
Last edited Nov 7, 2019
Created on Nov 6, 2019

A yellow circular face with black-outlined eyes and animated eyebrows is rendered in SVG using D3.js. The face is built from D3 selections and shape generators, including `d3.arc` for the mouth path. Eyebrows transition vertically using `transition.attr` with a 2000-millisecond duration, creating a repeated raising motion. The example demonstrates basic D3 data binding, SVG shape construction, and animation chaining on a static, hardcoded dataset.

AI-generated description

import { select } from 'd3';

const svg = select('svg');

const circle = +svg.append('circle');

const width = +svg.attr('width');

const height = +svg.attr('height');

console.log(width);

circle.attr('r', height / 2);

circle.attr('cx', width / 2);

circle.attr('cy', height / 2);

MIT Licensed

Similar vizzes