xxxxxxxxxx
32
const slices = 7, size = 200;
let randomWeights = [];
function setup() {
createCanvas(600, 600);
for(var i = 0; i < slices*2 ; i++){
randomWeights[i] = random(700, 1000);
}
}
function draw() {
background("#343A40");
fill("#B0B4B9");
translate(width/2, height/2);
rotate(millis() / 1000);
scale(map(sin(millis()/800), 0, 1, 0.85, 1));
beginShape();
for(var i = 0, j = 0; i < TWO_PI; i += TWO_PI/slices, j++){
curveVertex(sin(i) * size + map(cos(millis()/randomWeights[j]), 0, 1, -30, 30),
cos(i) * size + map(sin(millis()/randomWeights[j+ slices]), 0, 1, -20, 20));
}
//Needed to make the blob correctly shaped.
curveVertex(sin(0) * size + map(cos(millis()/randomWeights[0]), 0, 1, -30, 30),
cos(0) * size + map(sin(millis()/randomWeights[0+ slices]), 0, 1, -20, 20));
curveVertex(sin(TWO_PI/slices) * size + map(cos(millis()/randomWeights[1]), 0, 1, -30, 30),
cos(TWO_PI/slices) * size + map(sin(millis()/randomWeights[1+ slices]), 0, 1, -20, 20));
curveVertex(sin(2*TWO_PI/slices) * size + map(cos(millis()/randomWeights[2]), 0, 1, -30, 30),
cos(2*TWO_PI/slices) * size + map(sin(millis()/randomWeights[2+ slices]), 0, 1, -20, 20));
endShape();
}