• fullscreen
  • estel.pde
  • nadal2010.pde
  • nit.pde
  • class estel
    {
    float xIni,yIni,xNext,yNext,centerX,centerY,rad,cl;
    int iniT;
    float[] ctrlX = new float[10];
    float[] ctrlY = new float[10];
    
    estel(float X, float Y, float R, float CL )
    {
      iniT=frameCount;
      centerX=X;
      centerY=Y;
      rad=R;
      cl=CL; // cicles
       float aux;
      for(int i=0; i<10; i=i+2)
      {
       aux=rad+random(0,rad/2); 
       ctrlX[i]=centerX+aux*(cos((PI/8)+i*PI/5));
       ctrlY[i]=centerY+aux*(sin((PI/8)+i*PI/5));
      // ellipse(ctrlX[i],ctrlY[i],10,10);
      }
      
      
      for(int i=1; i<10; i=i+2)
      {
       aux=rad+random(-3*rad/4,-rad/4); 
       ctrlX[i]=centerX+aux*(cos((PI/8)+i*PI/5));
       ctrlY[i]=centerY+aux*(sin((PI/8)+i*PI/5));
    //   ellipse(ctrlX[i],ctrlY[i],10,10);
      }
      
      xIni=ctrlX[0];
      yIni=ctrlY[0];
    
    }
    
    
    void updatEstel()
    {
     float k, shrink;
     int T;
     T=frameCount-iniT;
     k=round(T/10);
     shrink=1-k/cl;
     
     if(shrink>0)
     {
      xNext=centerX+shrink*(ctrlX[T%10]-centerX);
      yNext=centerY+shrink*(ctrlY[T%10]-centerY);
      line(xIni,yIni,xNext,yNext);
      
      xIni=xNext;
      yIni=yNext;
     }
    
    }
    
    
    }
    
     estel E;
     nit n;
    
    void setup()   
    {              
      size(400, 400); 
      background(0);
      stroke(255,255,0);
      frameRate(12);
    
      fill(0,0,255);
      loadPixels();
      n = new nit();
      n.initDisplay();
     
    }
    
    
    void draw()  
    {
      n.display();
     
      if(frameCount==1)
      {
       E = new estel(width/2, height/2, 150,20.0);
      }
    
      E.updatEstel();     
    }
     
     
       
    
    
    class nit
    {
      int N;
      color C;
    
     
     void initDisplay()
     {
       for(int i=0; i<height; i++)
       {
         for(int j=0; j<width; j++)
         {
               
          // pixels[i*width+j]=color(0,0,random(0,255-255*abs(i-height/2)*(2/height)));
          pixels[i*width+j]=color(0,0,random(0,255-100*(2.0/height)*abs(i-height/2.0)-100*(2.0/width)*abs(j-width/2.0)));
           }
       }
       updatePixels();
     }
     
     void display()
     {
       color banda=color(0);
       int auxB=0;
       float auxBB=0;
       float auxRR=0;
       
       loadPixels();
       
       for(int i=0; i<height; i++)
       {
         for(int j=0; j<width; j++)
         {
           auxRR=red(pixels[i*width+j]);
           if(auxRR<100)
           {
            auxBB=blue(pixels[i*width+j]);
            // auxB=(round(auxBB)+2)%200;
            auxB=(round(auxBB)+2)%round(255-100*(2.0/height)*abs(i-height/2.0)-100*(2.0/width)*abs(j-width/2.0));
            
            pixels[i*width+j]=color(0,0,auxB);
           } 
        
      //  if(i%50==0 ||i%50==1 ){banda=color(0);}
      //  if(i%50==2){banda=color(0,0,random(0,255));}
      //  pixels[i*width+j]=banda;
         }
       }
       updatePixels();
       
     }
     
    }
    

    code

    tweaks (0)

    about this sketch

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

    license

    advertisement

    Dionis Boixader

    Xmass Star

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

    Parametric star

    You need to login/register to comment.