DrawHalen - draw some random VanHalen artwork

For all processing and VanHalen fans out there, draw yourself some VH art:

/**
 * DrawHalen
 * Author: Michael Job
 * Version: 1.0
 * Draw some randomized VanHalen Art
 * stop and start again with key "s"
 * clear with "c"
 **/
 
float xWidth, yHeight;
boolean stopped = false;
 
void setup() {
  frameRate(7);
  size(1080, 720);
  background(188, 24, 31);
  xWidth = width+50;
  yHeight = height+50;
}
 
void draw() {
   if(!stopped){
     drawRandomLine();
   }
}
 
void drawRandomLine() {
   float colorRand = random(1);
   if (colorRand>0.5) {
     stroke(0);
   }else{
     stroke(255);
   }
   strokeWeight(random(width/200, width/50));
   int dirRand = int(random(6));
   switch(dirRand) {
      case 0: 
        //horizontal lines
        line(-50,random(yHeight),xWidth,random(yHeight));
        break;
      case 1: 
      //vertical lines
        line(random(xWidth),-50,random(xWidth),yHeight);
        break;
      case 2:
      //bottom - left lines
        line(random(xWidth),yHeight,-50,random(yHeight));
        break;
      case 3:
      //left - top lines
        line(-50,random(yHeight),random(xWidth),-50);
        break;
     case 4:
       //bottom - right lines
        line(random(xWidth),yHeight,xWidth,random(yHeight));
        break;
     case 5:
       //right - top lines
        line(xWidth,random(yHeight),random(xWidth),-50);
        break;
  }
}
 
//key controls
void keyReleased()
{
     switch(key){
        case 'c':
            background(188, 24, 31);
            break;
        case 's':
            stopped = !stopped;
            break;
       case ESC:
            exit();
            break;
     }
}
1 Like