Thursday, January 31, 2013

Glitch brush


Hello!


/* Glitch brush
 http://creativec0d1ng.blogspot.com.br/ by Italo Travenzoli

press "s" to save image
press "e" to erase
press "g" to glitch
 */
  int N=0;



void setup(){

size (851,315);

frameRate(60);

smooth();

colorMode(HSB);

background(255);

}



void draw(){

  

  if(keyPressed){

    if (key== 's'||key=='S'){

      save("image.jpg");

    }

    if (key== 'e'||key=='E'){

      background (255);

    }
   if (key== 'g'||key=='G'){
 
      Set();
 
    }     

  }


  if(mousePressed){

    float strokeSize = random(5,25);

    noStroke();

    rectMode(CENTER);

    fill(random(360),300,300);

     if(frameCount%2==0){
    rect (mouseX,mouseY,strokeSize,strokeSize);
 }
    if(frameCount%2!=0){
    ellipse (mouseX,mouseY,strokeSize,strokeSize);
 }

  }



}



int r(int a){

  return int(random(a));

}

/* 

void mouseReleased (){

  N++;

  save("glitchCover"+ (N)+".tif");

}

 */

void Set() {

  for (int i=0; i<10; i++) {

    int x = r(width);

    int y = r(height);

    set((x+r(50)-1)*int(random(-10,10)),y+r(3)-1,get(x,y,r(99),r(30)));

  }

}





No comments:

Post a Comment