xxxxxxxxxx
40
function setup() {
createCanvas(400, 400);
frameRate(1);
angleMode(DEGREES);
}
function draw() {
background(220);
let d = 2;
//wonky(200, 200, 7, 100);
for (let x=width/d/2; x<width; x+=(width/d)) {
for (let y=(height/d)/2; y<height; y+=(height/d)) {
wonky(x, y, 9, width/d/3);
}
}
}
function wonky(x, y, pts, r, ) {
let ang = 360 / pts;
let offsets = [];
for (let i=0; i<pts; i++) {
let xoff = round(random(r * -0.3, r * 0.3));
let yoff = round(random(r * -0.3, r * 0.3))
offsets.push([xoff, yoff]);
}
push();
translate(x, y);
beginShape();
//curveVertex(r, 0)
for (let i=0; i<pts * 2; i++) {
curveTightness(20)
curveVertex(cos(i * ang) * r + offsets[i % offsets.length][0], sin(i * ang) * r + offsets[i % offsets.length][1]);
}
endShape();
pop();
}