Skip to main content
100%

Blank Canvas

✓ Published1🌍 Public
Aalfredo-f
Last edited Oct 25, 2019
Created on Oct 25, 2019

This example demonstrates a blank, resizable canvas that fills the browser window, rendered as a rounded rectangle using SVG. It shows fundamental DOM manipulation with D3.js by selecting the empty `svg` element, setting its width and height to the viewport dimensions, and appending a `rect` with rounded corners. The code uses `d3.select` and `d3.append` from d3.v5, with the SVG size dynamically bound to `document.body.clientWidth` and `clientHeight`. The accompanying stylesheet fixes the body to prevent scrolling, ensuring the visualization always fits the screen.

AI-generated description

Demonstrates fundamental DOM manipulation using D3.js by making a smiley face whose eyebrows move.

MIT Licensed

Similar vizzes