xxxxxxxxxx
45
function setup() {
createCanvas(600, 600);
}
function draw() {
background(220);
let count = 10;
let scale = 50;
translate(0, height / 2);
layoutSphere(20, 50);
translate(200, 0);
layoutSphere(50, 80);
translate(200, 0);
layoutSphere(80, 110);
translate(200, 0);
layoutSphere(110, 140);
}
//draws an ellipse ... times at a given scale
function layoutSphere(count, scale) {
//drawing our sphere
for (let i = 0; i < count; i++) {
let inc = map(i, 0, count, 0, TWO_PI);
let x = sin(inc) * scale;
let y = cos(inc) * scale;
ellipse(x, y, 25, 25);
}
function layoutSphere1(count,scale){
layoutSphere(20, 50);
translate(200, 0);
layoutSphere(50, 80);
translate(200, 0);
layoutSphere(80, 110);
translate(200, 0);
layoutSphere(110, 140);
}
}