Example 1: Bars from Numbers
Code
const values = [12, 35, 24, 48, 18, 30, 44, 28];
function setup() {
createCanvas(400, 400);
}
function draw() {
background(252);
const w = width / values.length;
for (let i = 0; i < values.length; i++) {
const h = map(values[i], 0, 50, 0, 280);
fill(255, 45, 140);
rect(i * w + 10, height - h - 30, w - 20, h, 6);
}
}Try this: Replace hardcoded data with random generation each reset.