Something Like Vines

Some new processing work. click the mouse to change the colors and start new shoots growing. This has a really cool texture if you render it at the high resolution. Here is the source code if anyone is interested.

Here are a few screen grabs from versions that looked cool along the way:


int isBig=1;       // 0 is 500x500 big is 5000x5000
//int dimx = 6000 ;   // width
//int dimy = 6000 ;   // height
//int num = 2000;    // number of hairs
//int startDist = 10;   // minimum distance out
//int endDist =1500;    // maxumum distance out
//int colorChange=300; 

int dimx = 400 ;   // width
int dimy = 400 ;   // height
int num = 500;    // number of hairs
int startDist = 1;   // minimum distance out
int endDist = 75;    // maxumum distance out
int colorChange=60; 

int brushWidth = endDist-startDist;   // differehce between them is the drawing zone.
int startx;
int starty;
float startAngle = random(num)/num * TWO_PI;
float vblueratio=2;
float vgreenratio=2;
int vredBase=0;
int frames=0;
int totFrames=0;
int black=0;

circ[] strands;
color[] colorArray = new color[7];
int currentColor=0;
int colorVariation=30;

void setup() {
// grow lots of stuff if th is is for a big printable output
//FFC600 FF9A00  FF6800 B82900 8C0100 fbc465
  colorArray[0]=#FFC600;
  colorArray[1]=#FF9A00;
  colorArray[2]=#FF6800;
  colorArray[3]=#B82900;
  colorArray[4]=#8C0100;
  colorArray[5]=#fbc465;
  colorArray[6]=#3f0051;
  colorMode(RGB,255);
  //strokeCap(ROUND);

  strands = new circ[num];
  size(dimx,dimy,JAVA2D);
  background(#ffffff);
    // Draw each particle some distance from the origin on a circular path
  int sx,sy;
    startx=dimx/2;
    starty=dimy/2;
  for (int i=0;i<num;i++) {
    //startAngle =sin(PI/360 * i *20);;
    startAngle = random(1)*TWO_PI;
    //startAngle = 0;
    //int rlength = int(random(brushWidth));
    int rlength=int(random(brushWidth));
    startx = 200;
    //print(startx);
    starty =  i;
    //startx = int(dimx/2 + cos(startAngle) * (rlength+startDist));
    //starty = int(dimy/2 + sin(startAngle) * (rlength+startDist));
    strands[i]=new circ (startx,starty,rlength,startAngle,i);
    //strands[i]=new circ (dimx/2,dimy/2,rlength,startAngle,i);
   //print("created: "+i+" length"+rlength);
   //strands[i]=new circ (40,50,60,PI);
  }
}

void draw() {
  for (int i=0;i<num;i++) {
    strands[i].move();
  }
  if (frames==int(colorChange)){
    String fname= String.valueOf(month())+"-"+String.valueOf(day()+"-"+String.valueOf(hour())+"-"+String.valueOf(minute())+"-"+String.valueOf(second()));
        //saveFrame(fname+".png");
  }
  if (frames==colorChange){
    //print ("changing Colors");
    //saveFrame("output##.png");
    //Taking the color array's colors
    //if we are at the end, we go back to the start
    //We add random[colorVariation] to make it interesting.
    currentColor++;
    if (currentColor==colorArray.length-1){
      currentColor=0;
    }
    //print("changed Color to:"+colorArray[currentColor]);
    vredBase=int(random(155)+25);
    vblueratio=random(10);
    //vblueratio=1;
          if(vblueratio==0){
            vblueratio=1;
          }
    vgreenratio=random(7);
    //vgreenratio=1;
    if(vblueratio==0){
            vgreenratio=1;
          }
    //vgreenratio=random(50)+20;
    frames=0;
  }
//  if (totFrames==300){
//    exit();
//  }
//  else{
//    print (totFrames+"\n");
//  }
  frames++;
  totFrames++;
}

void mousePressed() {
  frames=colorChange-1;
  for (int i=0;i<num;i++) {
    strands[i].age=colorChange-1;
  }
  //print (frames);
}

void keyPressed() {
  // pressing a key will take a picture
  //saveFrame("output##.png");
}
Posted: November 13th, 2009 | Author: Rob | Filed under: Animation, Processing, Programming | No Comments »

Leave a Reply