xxxxxxxxxx
36
// https://p5js.org/examples/simulate-soft-body.html
//
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
// noFill();
fill(33);
stroke(33);
beginShape();
let points = 24;
let rad = width/4;
let wb = rad*0.2;
let sp = 0.025;
let f = frameCount*sp;
for (let i=0; i<points; i++){
randomSeed(i);
let rnd1 = random(0,i);
randomSeed(i);
let rnd2 = random(0,(f*sp));
let fq1 = (i)*(PI*2)/points;
let fq2 = (i*rnd1+f)*(PI*2);
let sz = rad/2;
// WIDTH
let cx = width/2;
let x = cx+(sin(fq1)+sin(fq2)/sz)*rad;
// HEIGHT
let cy = height/2;
let y = cy+(cos(fq1)+cos(fq2)/sz)*rad;
curveVertex(x,y);
}
endShape(CLOSE);
}