import processing.opengl.*; int num = 1000; Particule[] dots = new Particule[num]; Bloc temp; Vector blocs; int dim = 300; float GRAV=0.1; float FRICTION=0.999; float CHOC=1.6; color[] goodcolor = {#4b6576, #809ca4, #708b9c};// #79746e, #755d35, #937343, #9c6b4b, #ab8259, #aa8a61, #578375, #f0f6f2, #d0e0e5, #d7e5ec, #d3dfea, #c2d7e7, #a5c6e3, #a6cbe6, #adcbe5, #77839d, #d9d9b9, #a9a978, #727b5b, #6b7c4b, #546d3e, #47472e, #727b52, #898a6a, #919272, #AC623b, #cb6a33, #9d5c30, #843f2b, #652c2a, #7e372b, #403229, #47392b, #3d2626, #362c26, #57392c, #998a72, #864d36, #544732 }; color somecolor() { // pick some random good color return goodcolor[int(random(goodcolor.length))]; } void setup() { size(dim, dim,OPENGL); //frameRate(40); noStroke(); smooth(); background(255); for(int i=0; idim) rebirth(); if(posx>dim) rebirth(); if(posx<0) rebirth(); for (int i=0;i=0)&&(ua<=1)&&(ub>=0)&&(ub<=1)) { //intersection float dot = temp.normx*(speedx) + temp.normy*(speedy); speedx -= CHOC*dot*temp.normx; speedy -= CHOC*dot*temp.normy; speedx+=random(2)-1; speedy+=random(2)-1; float x = lastposx + ua*0.8*(posx-lastposx); float y = lastposy + ua*0.8*(posy-lastposy); posx=x; posy=y; } } } } void draw() { stroke(mic,100); line(lastposx, lastposy, posx, posy); //fill(mic); //ellipse(posx,posy,1,1); } }