xxxxxxxxxx
39
function setup() {
createCanvas(windowWidth, windowHeight);
noFill();
}
function draw() {
background(255);
stroke(0);
let offset = (frameCount/50)%1;
for (let i = 1+offset; i <= 100+offset; i++) {
if (floor(i) == 1) {
stroke(225-offset*225);
} else if (floor(i) == 5) {
stroke(offset*225);
} else {
stroke(0);
}
let size = 5*i;
let noisiness =20*sqrt(i);
let k = sqrt(i)/20;
let t = frameCount/300 - i/10;
blob(size, width/2, height/2, k, t, noisiness);
}
}
function blob(size, xCenter, yCenter, k, t, noisiness) {
beginShape();
let angleStep = TWO_PI / 16;
for (let a = 0; a <= TWO_PI + 3 * angleStep; a += angleStep) {
let r1 = cos(a)+3;
let r2 = sin(a)+3;
let r = size + noise(k * r1, k * r2, t) * noisiness;
let x = xCenter + r * cos(a);
let y = yCenter + r * sin(a);
curveVertex(x, y);
}
endShape();
}