xxxxxxxxxx
let w = 5;
let h = 5;
let g = 75;
function setup() {
createCanvas(874, 620);
background(255);
rectMode(CENTER);
}
function draw() {
background(255);
//g = map (mouseX, 0, width, 25, 200);
translate(50, 50);
for (let y = 0; y < 8; y++) { // 8 rows
for (let x = 0; x < 11; x++) { // 11 columns
push();
let a = map(x, 0, 11, 0, PI); // calculate angle
let dist = sqrt(pow(abs((x/11)*width - mouseX),2) + pow(abs((y/8)*height - mouseY),2));
let s= map(dist, 0, 1100, 15, 1);
translate(x * g, y * g); // translate by xy position plus gridsize g
//rotate(a);
noFill();
stroke(0);
arc(0, 0, s*w, s*h, 0, HALF_PI, PIE)
rotate(PI)
arc(0, 0, s*w, s*h, 0, HALF_PI, PIE)
//rect(0, 0, s*w, s*h); // set rect with width height
pop();
}
}
/*
rect(125, height/2, w, h);
rect(200, height/2, w, h);
rect(275, height/2, w, h);
rect(350, height/2, w, h);
rect(425, height/2, w, h);
rect(500, height/2, w, h);
rect(575, height/2, w, h);
rect(650, height/2, w, h);
rect(725, height/2, w, h);
rect(800, height/2, w, h);
*/
}