SkyLine One Line

A skyline set to Chopin, accompanied with ambient city sounds.
code:

//skyline one line 
//cc Charlotte Stiles 2014

float lineLength = 400.0;
int [] x = new int[400];
float [] y = new float[400];
float lineX,lineY;
float times = .9;
float grab=200;

void setup() {
  background(255);
  size(500, 500);
}
void draw() {
  fill(255,10);
  noStroke();
  rect(0, 0, width, height);

  beginShape();
  for (int i = 50; i < lineLength; i++) {
    
    x[i] = i; //draws line from left to right
    
    lineX= x[i];
    lineY= y[i];
    println(x[i]);

    if (dist (lineX, lineY, mouseX, mouseY) > 400)   {
      lineX = mouseX; //this makes it have more curved lines
      for(float g = 0 ; g < 10; g++){
        if(x[i] <= grab + 200 && x[i] >= grab - 200){ //grab is the center point of the curve
        y [i] = mouseY * (g*.15);//g is made to increase little by little
        lineY = y[i];
       }
      }
    }
    
    strokeWeight(random(.1,1));
    stroke(random(0,100));
    curveVertex(lineX, lineY);//behold, one line
  }
  endShape(); 
}

Comments are closed.