// au hasard entre 10 et 290 int x=int(random(10,290)); int y=int(random(10,290)); // au hasard entre 5 et 10 ou entre -5 et -10 int vitx = int(random(5))+5*((round(random(1))*2)-1); int vity = int(random(5))+5*((round(random(1))*2)-1); // Initialise le sketch void setup(){ size (300,300); noStroke(); framerate(30); fill(random(255),random(255),random(255),random(64,192)); background(51); smooth(); } //procˇdure d'affichage void draw(){ ellipse(x, y,20,20); x += vitx; if(x >= width) { vitx = -vitx; vity = int(random(5))+5*((round(random(1))*2)-1); fill(random(255),random(255),random(255),random(64,192)); }else if(x <= 0){ vitx = -vitx; vity = int(random(5))+5*((round(random(1))*2)-1); fill(random(255),random(255),random(255),random(64,192)); } y += vity; if(y >= height) { vity = -vity; vitx = int(random(5))+5*((round(random(1))*2)-1); fill(random(255),random(255),random(255),random(64,192)); }else if(y <= 0){ vity = -vity; vitx = int(random(5))+5*((round(random(1))*2)-1); fill(random(255),random(255),random(255),random(64,192)); } }