Skip to main content
100%

Let's make some random bricks and practice basic looping

✓ Published0🌍 Public
MModalMBS
Last edited Sep 24, 2020
Created on Sep 24, 2020

A random field of 1,000 overlapping rectangles forms a dense, colorful brick-like pattern. The example demonstrates basic looping and random attribute assignment using D3 v6 within a React framework. Each iteration appends an SVG `rect` element, varying its width, height, and fill color through `Math.random()` and a conditional color chooser that selects red, green, or blue. The `select` API targets the SVG container, while `attr` with a dynamic `transform` rule staggers rectangles horizontally, creating a layered, chaotic composition.

AI-generated description

A bare minimum HTML page.

See also React Starter.

MIT Licensed

Similar vizzes