xxxxxxxxxx
let mots = [];
let nbmots;
let count;
let bord, nbLignes, intermots, interLigne, hautMax, hautMin, hautplus, largMax, largMin, largPlus;
let t;
function setup(){
createCanvas(802, 802);
background(255);
frameRate(24);
nbmots = 12
bord = 80;
nbmots = 12
nbLignes = 12;
intermots = 80;
interLigne = height/nbLignes;
hautMax = 60;
hautMin = 6;
hautplus = 4;
largMax = 60;
largMin = 6;
largPlus = 8;
count = 0;
t = 0;
for (var i=0 ; i < nbmots; i++) {
mots[i] = new Mot();
mots[i].ptx = bord;
mots[i].numMot = 1;
mots[i].numLigne = 1;
mots[i].larg = 8;
mots[i].haut = 8;//random(6, 18);
mots[i].hautOld = mots[i].haut;
mots[i].pty = interLigne;
mots[i].corn = 30;
mots[i].fond = 255;
mots[i].fondPlus = 5;
}
}
function draw(){
rectMode(CORNER); strokeWeight(6); stroke(0); noFill(); /*fill(255, 30);*/ rect(0, 0, 802, 802);
t++;
//if (t > 90){
for (let i = 0; i < nbmots; i++){
mots[i].ecrit();
}
//}
}
class Mot {
constructor (ptx, pty, oldptx, oldpty, numMot, nbmots, nbLignes, larg, haut, corn, fond, fondPlus){
}
ecrit(){
count++;
if (count % 12 == 0){
if (this.numLigne < nbLignes){
if (this.ptx <= width - bord){
this.fond += this.fondPlus;
if (this.fond >= 255 || this.fond <= 153){
this.fondPlus *= -1;
}
this.pty = this.numLigne * interLigne;
ellipseMode(CENTER); strokeWeight(2); stroke(0, 90); /*noFill();*/ fill(this.fond, 90); ellipse(this.ptx, this.pty, this.larg, this.haut);
this.ptx += intermots;
this.haut -= hautplus;
if (this.haut >= hautMax || this.haut <= hautMin){
hautplus *= -1;
}
/*
this.larg += largPlus;
if (this.larg >= largMax || this.larg <= largMin){
largPlus *= -1;
}*/
} else if (this.ptx > width - bord){
this.numLigne++;
this.ptx = bord;
}
} else if (this.numLigne >= nbLignes){
this.numLigne = 1;
this.larg += largPlus;
if (this.larg >= largMax || this.larg <= largMin){
largPlus *= -1;
}
}
}
}
}