xxxxxxxxxx
41
let w = 400;
let h = 400;
let nbLines = 5;
let padding = 20;
let lineSpacing = (h - (padding * 2) ) / nbLines;
function setup() {
createCanvas(w, h);
}
function draw() {
background(220);
let y = padding;
for(let i = 0; i < nbLines; i++){
let m = 2 ** i ; // number of elements per line
for(let n = 0; n < m ; n++){
console.log(n)
let x = width / (m + 1) * (n + 1)
let p = createVector(x,y)
circle(p.x,p.y,5);
line(p.x, p.y, p.x, p.y + 10);
}
y += lineSpacing;
}
noLoop();
}