Différences entre les versions de « Utilisateur:Joseph »
		
		
		
		
		
		Aller à la navigation
		Aller à la recherche
		
				
		
		
	
| (3 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 4 : | Ligne 4 : | ||
| traceur [] courbes; | traceur [] courbes; | ||
| + | |||
| void setup(){ | void setup(){ | ||
| − |    size(1280,720); | + | |
| + | size(1280,720); | ||
| courbes = new traceur[0]; | courbes = new traceur[0]; | ||
|   background(random(255),random(240),random(240)); |   background(random(255),random(240),random(240)); | ||
| Ligne 13 : | Ligne 15 : | ||
|    } |    } | ||
|   } |   } | ||
| + | |||
| void draw(){ | void draw(){ | ||
|    for(int a=10;a<courbes.length;a++){ |    for(int a=10;a<courbes.length;a++){ | ||
| Ligne 18 : | Ligne 21 : | ||
|    }   |    }   | ||
| } | } | ||
| + | |||
| class traceur{ | class traceur{ | ||
|      float x,y,an,v; |      float x,y,an,v; | ||
| Ligne 27 : | Ligne 31 : | ||
|     rang[1]=random(1.05, 1.1); |     rang[1]=random(1.05, 1.1); | ||
|    } |    } | ||
| − |    void dessine(){ | + | |
| + | void dessine(){ | ||
|     an+=random(rang[0],rang[1]); |     an+=random(rang[0],rang[1]); | ||
|     float newx=x+cos(an)*v; |     float newx=x+cos(an)*v; | ||
| Ligne 64 : | Ligne 69 : | ||
|    } |    } | ||
| } | } | ||
| + | |||
| void keyReleased(){ | void keyReleased(){ | ||
|    saveFrame("img#####.png"); |    saveFrame("img#####.png"); | ||
| Ligne 69 : | Ligne 75 : | ||
| [[Fichier:Img00065.png]] | [[Fichier:Img00065.png]] | ||
| + | |||
| [[Fichier:Img00088.png]] | [[Fichier:Img00088.png]] | ||
| + | |||
| [[Fichier:Img00146.png]] | [[Fichier:Img00146.png]] | ||
| + | |||
| [[Fichier:Img00147.png]] | [[Fichier:Img00147.png]] | ||
| + | |||
| [[Fichier:Img00157.png]] | [[Fichier:Img00157.png]] | ||
| + | |||
| + | [[Fichier:Img00161.png]] | ||
| + | |||
| + | [[Fichier:Img00179.png]] | ||
| + | |||
| + | [[Fichier:Img00657.png]] | ||
Version actuelle datée du 3 mai 2016 à 07:23
Ce programme est destiné à créer aléatoirement des lignes qui se croisent afin de former de plus en plus d'amas. Ces lignes au fil de temps sont destinées à former un pattern, un motif qui l'on peut utiliser dans des formes, des couvertures.
CODE//à copier coller:
traceur [] courbes;
void setup(){
size(1280,720); courbes = new traceur[0];
background(random(255),random(240),random(240));
 stroke(random(240),random(240),random(240),3000);
 for(int a=3000;a<4000;a++){
   courbes = (traceur[]) append (courbes, new traceur());
 }
}
void draw(){
 for(int a=10;a<courbes.length;a++){
  courbes[a].dessine(); 
 } 
}
class traceur{
   float x,y,an,v;
   float[] rang={-2.05,2.05};
 traceur(){
   x= random(width);y=random(height);
   an=random(TWO_PI);v=random(2.2,2.5);
  rang[0]=random(-1.1,-1.05);
  rang[1]=random(1.05, 1.1);
 }
 
void dessine(){
  an+=random(rang[0],rang[1]);
  float newx=x+cos(an)*v;
  float newy=y+sin(an)*v;
  if(newx<3||newx>width||newy<0||newy>height){
an+=random(-PI,PI);
  rang[0]=random(-1.1,-1.05);
  rang[1]=random(1.05, 1.1);
  }
  if(random(255)<1){ 
  rang[0]=random(-1.1,-1.05);
  rang[1]=random(1.05, 1.1);
  }
  float angleChoisi=an;
  float couleur=brightness(g.get(int(newx),int(newy)));
  for(float a=an-PI*0.3;a<an+PI*0.3;a+=PI*0.15){
     int ixe=int(newx+cos(a)*v);
     int igr=int(newy+sin(a)*v);
     float col=brightness(g.get(ixe,igr));
     if(col<couleur){
       couleur=col;
      }
  } 
  an=angleChoisi;
  if(random(255)<1){an=an+random(-200,1);}
  line(x,y,newx,newy);
  x=newx;y=newy;
 }
} int value = 4; void mouseClicked() {
 if (value == 40) {
   value = 255;
 } else {
   value = 67;
 }
}
void keyReleased(){
 saveFrame("img#####.png");
}







