AAD

(Algoritmicly Aided Desing)

Monday, June 02, 2014

#FLcreativecoding Draw your name: part 1

//_##___##____#____####__
//_#_#_#_#___#_#___#___#_
//_#__#__#__#___#__#__#__
//_#___ _###_____###___#_

int timer=0;
int timeOut=500;
int ceiling=500; 
int posX=100;
int posY=400;
int step=20;
int speed=2;
void setup() {
  size(timeOut, ceiling);
  background(255);
  rectMode(RADIUS);
}
void drunkLine(int x,int y){
  for(int i=0;i<=step;i++){
    posX+=(random(speed)-(speed/2))+speed*x;
    posY+=(random(speed)-(speed/2))+speed*y;
    rect(posX, posY, random(6), random(6));
  }
}
void draw() {
  posX=40+int(random(10));
  posY=370+int(random(10));

  fill(0, 50);
  rect(timeOut/2, ceiling/2, timeOut, ceiling);
  int r=int(random(150));
  int g=int(random(150))+100;
  int b=int(random(150));
  stroke(r,g,b);
  int darker=50;
  fill(r-darker,g-darker,b-darker, 150);
  drunkLine(1,0); //pass in
 
  drunkLine(0,-1); //M North
  drunkLine(0,-1);
  drunkLine(0,-1);
  drunkLine(0,-1);
 
  drunkLine(1,1); //M SE
  drunkLine(1,1);
  drunkLine(1,1);
 
  drunkLine(1,-1); //M NE
  drunkLine(1,-1);
 
  drunkLine(0,2); //M S
  drunkLine(0,2);
  drunkLine(0,2);
  drunkLine(0,1);

  drunkLine(1,0); //pass to A
 
  drunkLine(1,-2); //A NE
  drunkLine(1,-2);
 
  drunkLine(1,2); //A SE
  drunkLine(1,2);
  drunkLine(1,2);
 
  drunkLine(1,0); //pass to R
 
  drunkLine(0,-1); //R North
  drunkLine(0,-1);
  drunkLine(0,-1);
  drunkLine(0,-1);
 
  drunkLine(1,0); //R E
  drunkLine(1,0);
 
  drunkLine(1,1);
  drunkLine(0,1);
  drunkLine(-1,1);
 
  drunkLine(1,1);
  drunkLine(1,1);
  drunkLine(1,1);
 
  drunkLine(1,0); //pass out
  noLoop();
}
void keyPressed(){
if (key=='s') {
    saveFrame("yourName.jpg");
  }
}
void mousePressed() {
  loop();
}

3 Comments:

Blogger Unknown said...

Hey, thanks for sharing your code! I like the gradual fade out you have created :)

11:44 PM  
Blogger Unknown said...

Hi, thanks for sharing your code! I like the gradual fade out effect you're creating as it is layered :)

11:52 PM  
Blogger M said...

Thanx Jason

12:17 AM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home