xxxxxxxxxx
33
function setup() {
createCanvas(400, 400);
}
var cn = [100,50,30,24];
function draw() {
background(255);
fill(0);
// modes
deltaTheta = 0.01
beginShape();
for (theta = 0; theta < 2*PI; theta+=deltaTheta) {
r = 0;
for (var i = 0; i < cn.length; i++) {
//print(r);
r += cn[i]*cos(i*theta);
curveVertex(50+r*cos(theta),50+r*sin(theta));
}
}
endShape();
// now the time evolution
for (var i = 0; i < cn.length; i++) {
//print("Here");
cn[i]= cn[i] - 0.01*cn[i]*i*i;
}
}