float vitesseX[] = new float[0];
float vitesseY[] = new float[0];
float directionX[] = new float[0];
float directionY[] = new float[0];
void setup(){
vitesseX = expand(vitesseX, donnees.length);
vitesseY = expand(vitesseY, donnees.length);
directionX = expand(directionX, donnees.length);
directionY = expand(directionY, donnees.length);
for (int i=0; i<donnees.length; i++) {
x[i] = random(width);
vitesseX[i] = random(-2, 2);
vitesseY[i] = random(-2, 2);
directionX = 1;
directionY = 1;
}
}
text(donnees[i].label, x[i], y[i]);
if(x[i] < 0 || x[i] > width){ directionX[i] *= -1; } if(y[i] < 0 || y[i] > height){ directionY[i] *= -1; } x[i] += vitesseX[i] * directionX[i]; y[i] += vitesseY[i] * directionY[i];
}