xxxxxxxxxx
34
function setup() {
createCanvas(400, 400);
// Grid variables
around = 72;
outward = 20;
rad = 150;
centre = new p5.Vector(width / 2, height / 2)
}
function draw() {
background(220);
// Loop around the circle
for (let i = 0; i < around; i++) {
// Get the angle
a = map(i,0,around,0,2*PI);
// Loop outward
for (let j = 0; j < outward; j++) {
// Get out distance
out = j * rad / outward;
// Calculate position
pos = new p5.Vector(out,0).rotate(a)
// Draw circle
noFill();
circle(pos.x + centre.x, pos.y + centre.y, 2)
}
}
}