xxxxxxxxxx
49
let noiseMax = 30; //determines the wigglyness
let xoff = 0;
let yoff = 0;
let zoff = 0;
let minRad = 100
let maxRad = 200;
let tileCountX = 4;
let tileCountY = 4;
let tileWidth;
let tileHeight;
let phase = 0;
function setup() {
createCanvas(600, 600);
tileWidth = width / tileCountX;
tileHeight = height / tileCountY;
}
function draw() {
background(0);
translate(width / 2, height / 2);
stroke(255, 50);
noFill();
for (var gridY = 0; gridY <= height; gridY += tileHeight) { //loop through grid
for (var gridX = 0; gridX <= width; gridX += tileWidth) {
push();
//translate(gridX, gridY);
beginShape();
for (a = 0; a < TWO_PI; a += 0.05) {
xoff = map(cos(a + phase), -1, 1, 0, noiseMax);
yoff = map(sin(a), -1, 1, 0, noiseMax);
let r = map(noise(xoff, yoff, zoff), 0, 1, minRad, maxRad); //radius
let x = r * cos(a);
let y = r * sin(a);
vertex(x, y);
}
endShape(CLOSE);
pop();
phase = map(gridX + gridY, 0, width + height, 0, TWO_PI)
}
}
zoff += 0.03;
}