xxxxxxxxxx
55
function setup() {
createCanvas(400, 400);
//frameRate(1);
angleMode(DEGREES);
}
function draw() {
background(220);
let d = 5;
//wonky(200, 200, 7, 100);
//noFill();
translate(200, 200)
rotate((noise(frameCount / 200) - 0.5) * 60)
wonky(0, 0, 3, 150);
rotate(30)
wonky(-50, -75, 5, 25);
wonky(50, -75, 5, 25);
wonky(0, 50, 2, 40)
/*
// Test pattern to fill screen
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, 4, width/d/3, true);
}
}
*/
}
function wonky(x, y, pts, r, scribble) {
let n = 0;
let ang = 360 / (pts);
//if (scribble) ang = 360 / (pts + 1);
let offsets = [];
for (let i=0; i<pts * 4; i++) {
//let xoff = round(random(r * -0.3, r * 0.3));
//let yoff = round(random(r * -0.3, r * 0.3));
let xoff = (noise(frameCount/100 + (i*10) + x / 100) - 0.5) * r;
let yoff = (noise(frameCount/100 + (i*10) + y / 100) - 0.5) * r;
offsets.push([xoff, yoff]);
}
push();
translate(x, y);
beginShape();
curveVertex(r, 0)
curveTightness((noise(frameCount / 100) - 0.5) * 5)
for (let i=0; i<pts * 4; i++) {
curveVertex(cos(i * ang) * r + offsets[i % offsets.length][0], sin(i * ang) * r + offsets[i % offsets.length][1]);
}
endShape();
pop();
}