xxxxxxxxxx
var blobs = []
var couleurs = ['red','orange','yellow','green','blue','violet','indigo'];
var decalage = 0;
var rayon;
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
rayon = height * 0.35;
if (height > width) {
rayon = width * 0.35;
}
for(i=0;i<7;i=i+1){
blob = new Algoblob(width/2+cos(i*360/7)*rayon,height/2+sin(i*360/7)*rayon,0,0,40);
blob.couleur = couleurs[i];
blobs.push(blob);
}
}
function draw() {
background(0);
fill(0);
stroke(255);
strokeWeight(2);
circle(width/2,height/2,2*rayon);
i = 0;
blobs.forEach((bob) => {
bob.x = width/2+cos(i*360/7+frameCount/2%360)*rayon
bob.y = height/2+sin(i*360/7+frameCount/2%360)*rayon
bob.dessine();
i +=1;
});
}
function mouseClicked() {
decalage += 1;
decalage %= 7;
for(i=0;i<7;i=i+1){
blobs[i].couleur = couleurs[(i+decalage)%7];
}
}