Viewing a saved revision (read-only)
43a8d8a8653f490ab893e4a48c6122e8
Let's make a face with D3.js!
This example demonstrates how to build a smiley face whose eyebrows move using fundamental D3.js DOM manipulation. The code selects SVG elements and binds data to them with `d3.select` and `data()`, then applies updates via `enter` and `merge` selections. It uses `d3.interval` to drive the animation, adjusting eyebrow positions through `attr` calls on the `cx` and `cy` properties. Rendering occurs in an SVG container created in the HTML, with styles defined in an external stylesheet. The face itself is composed of circles and ellipse shapes, while the script runs a continuous loop to shift the eyebrows in and out.
AI-generated descriptionDemonstrates fundamental DOM manipulation using D3.js by making a smiley face whose eyebrows move.