// class Particule { float x = width/2; float y = height/2; float vx = random (-5, 5); float vy = random (-5, 5); color c = color (255, 0, 255); float r = 5; // Constructeur Particule ( color c ) { this.c = c; } Particule ( float x, float y, float vx, float vy, color c, float r ) { this.x = x; this.y = y; this.vx = vx; this.vy = vy; this.c = c; this.r = 1; } // Affichage void afficher() { fill ( c ); noStroke(); ellipseMode ( CENTER ); ellipse ( this.x, this.y, 2*r, 2*r ); } // Animation void animer() { x += vx; if ( ( (x<0) && (vx<0) ) || ( (x >= width) && (vx>0) ) ) { vx = -vx + random( - 1, 10 ); } y += vy; if ( ( (y<0) && (vy<0) ) || ( (y >= height) && (vy>0) ) ) { vy = -vy + random( - 1, 10 ); } } }