• fullscreen
  • clase_agente.pde
  • perlin_paitingmachine_2.pde
  • class agente {
    
      float x;
      float y;
      float z;
      float avanzax;
      float avanzay;
      float angulo;
      float mass;
      float velocidad = 1;
     
     
     color col = col ();
      agente(float posicion_randomx, float posicion_randomy){
        x = posicion_randomx/2;
        y = posicion_randomy/2;
     
    
    }
    
      void dibuja(){
    
    
        angulo = valores_perlin [int(avanzax/ (width/22) )] [ int(avanzay / (height/22))];    
            float velo = random(1);
         avanzax = avanzax + velo  * cos(angulo) ;
        avanzay = avanzay + velo  * sin(angulo) ;
             if (avanzax <=0|| avanzax >= width ||avanzay <=12  || avanzay>=height ){       
               avanzax = (width/2);
          avanzay = (height/2); 
    
             }
             
       if (keyPressed ){
       if (key == 'r' || key == 'R'){
      avanzax = 0;
      avanzay = 0;
      fill (255);
        rect (0,0,width, height);
    }}  
      }
      void amigo (){
    
    
                
        angulo = valores_perlin [int(avanzax / (width/22))] [ int(avanzay / (height/22))];
        float velo = random(1);
    
        avanzax = avanzax + velo  * cos(angulo)*2;
        avanzay = avanzay + velo  * sin(angulo)*2 ;
      
            pushMatrix();
    
        translate(avanzax, avanzay);
       smooth ();
        rotate(angulo/3);
    noStroke ();
    fill  (col);
    ellipse (0,0,4,4);
       popMatrix(); 
     
      }
    
    }
    
    
    color col (){ 
    
      return rojo2 [int (random (rojo2.length))]; 
    } 
    
    
    
    
    
    void NOISE(float elruido) {
    ruido = (elruido);
    
      controlP5.controller("NOISE").setValue(elruido);
    }
    
    
    
    
    
    
    
    import controlP5.*;
    ControlP5 controlP5;
    PFont fontA;
    float ruido = 0.01;
    float rotacion;
    float aumenta;
    color [] rojo2 = {#B9B6B6,#0A0000,#711919,#3B0404,#815816,#550808,#464545,#121212,#050505,#030000,#B21002,
    #9D9C9C,#0A0505,#121111,#1C1111,#050505,#714701, #A06505,#760E12,#980B0F,#A50006,#AA1313,#2C2C2C,#B4351B,#C91100,
    #BC0218,#9D0214,#B40418,#5A131B,#8E0717,#81101F,#811221,#393939,#A71629,#580B15,#A50A1F,#AF051C,#761E0C,
    #48010A,#7E0414,#D88518,#8B5611,#CE821D,#A5691B,#9B1B02,#151414,#B7751E,#DE8E26,#A7A200,#211D1D,#4D4C4C,#120B0B};
    
    float angulo,angulo2;
    float offset_ruido = 1.0;
    float[][] valores_perlin  = new float[33][33];
    agente[] bichos = new agente[122];
    
    void setup(){
      
      size(950,600);
      background (255);  
     //noCursor ();
      fontA = loadFont("Tahoma-12.vlw");
      textFont(fontA, 11);
      for  (int i= 0 ; i < 122; i++  ) {
        bichos[i] = new agente( random(-3,3), random(-3,3));
      }
      
    
     controlP5 = new ControlP5(this);
      
      controlP5.addSlider("NOISE",.001,.09,.01,0,0,120,12);
    
    }
    
    void draw(){
     fill (0);
     rect (0,0,width,12);
     
      fill(255);
      text("R = RESTART", width-80, 10);
       text("S = SAVE PICTURE", width-200, 10);
      for (int i= 0 ; i < 33 ; i++  ) {
        for (int j = 0 ; j < 33 ; j ++) {
          valores_perlin[i] [j] =  noise((i /22 )+offset_ruido ,( (j/22)+offset_ruido) +  offset_ruido)* ((rotacion)*2)+noise (-1.3,1.3);
        
      if (  second()<=30){
        
        rotacion = PI;
      }
      if (  second()>=31){
        rotacion =(TWO_PI);
      }
      
    
    }
      }
      
    
    
      offset_ruido = offset_ruido+ruido; 
    
      for  (int i= 0 ; i < 12 ; i++  ) {
        bichos[i].dibuja();
        bichos [i].amigo();
      }
    
        if (keyPressed ){
       if (key == 's' || key == 'S'){
          saveFrame ();
    }}
    
    
      
    
    }
    
    
    

    code

    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.

    license

    advertisement

    namtes

    klepter

    Add to Faves Me Likey@! 3
    You must login/register to add this sketch to your favorites.

    perlin noise

    You need to login/register to comment.