xxxxxxxxxx
// By Roni Kaufman
let kMax;
let step;
let n = 15; // number of blobs
let radius = 0.4; // diameter of the circle
let inter = 1.9; // difference between the sizes of two blobs
let maxNoise = 50;
let colorOff = 123;
let noiseProg = (x) => (x);
function setup() {
createCanvas(windowWidth, windowHeight);
//colorMode(HSB, 1);
angleMode(DEGREES);
noFill();
//noLoop();
kMax = 1;
step = 4;
noStroke();
}
function draw() {
blendMode(BLEND);
background(255);
blendMode(DIFFERENCE);
let t = frameCount/1;
for (let i = n; i > 0; i--) {
let size = radius + i * inter;
let k, noisiness;
k = kMax * sqrt(i/n);
noisiness = maxNoise * noiseProg(i/n);
fill(255, 0, 0)
blob(size, width/2, height/2, k, t - i * step, noisiness);
fill(0, 255, 0)
blob(size, width/2, height/2, k, t - i * step + colorOff, noisiness);
fill(0, 0, 255)
blob(size, width/2, height/2, k, t - i * step + 3*colorOff, noisiness);
}
}
function blob(size, xCenter, yCenter, k, t, noisiness) {
beginShape();
let angleStep = 360 / 14;
for (let theta = 0; theta <= 360 + 2 * angleStep; theta += angleStep) {
//let r1 = cos(theta)+1;
//let r2 = sin(theta)+1;
let alpha = 7;
let r = (size + ((sin((theta + t)*alpha) + 1)/4 + (cos((theta + t)*alpha) + 1)/3) * noisiness) * 5;
let x = xCenter + r * cos(theta);
let y = yCenter + r * sin(theta);
curveVertex(x, y);
}
endShape();
}