xxxxxxxxxx
33
let elements = [];
let iter = 12;
let diameterSize = 200;
let bg = 'black';
function setup() {
createCanvas(windowWidth, windowHeight);
for(let i = 0; i < iter; i++){
let button = createElement('button', 'click me')
button.style('color', '#D3004E');
button.position(
cos(map(i + 10, 0, iter, 0, TWO_PI)) * diameterSize + windowWidth/2,
sin(map(i + 10, 0, iter, 0, TWO_PI)) * diameterSize + windowHeight/2
);
button.mousePressed(
function(){
bg = color(random(255), random(255), random(255));
}
);
elements.push(button);
}
}
function draw(){
background(bg);
for(let i = 0; i < elements.length; i++){
elements[i].html(i + 1);
}
}