Skip to main content
100%

Random Squares

✓ Published1🌍 Public
NNita
Last edited Jan 3, 2024
Created on Jan 3, 2024
Forked from tesT 1

Random Squares demonstrates SVG shape generation by populating a 1000×1000 canvas with 500 randomly positioned, sized, and colored rectangles. Each `<rect>` element receives a random RGB fill, a random x/y coordinate within the viewport, and a random width and height up to 50 pixels. The code uses vanilla JavaScript with `Math.random()` to compute values and `document.querySelector('svg').innerHTML` to append shapes directly to the SVG DOM. The result is a dense, chaotic mosaic of overlapping squares with no underlying data or interaction, showcasing basic SVG rendering through a simple procedural loop.

AI-generated description

Demonstration of SVG shapes.

MIT Licensed

Similar vizzes