Joy Division

Based on a sketch from the first Fun Coding Session about noise, I developed the code further. While I was playing around with the code, it reminded me of the artwork for “Unknown pleasures” by Joy Division.

Below is the code and image of the sketch from the Fun Coding Session which was my basis.

void setup() {
  size(500, 500);
  background(0);
  noStroke();
  for (int x=0; x<width; x=x+20) { // space between rect is 20
    float noiseForce = noise(x/100.)*200; // adds noise
    rect(x, height/2-noiseForce, 10, 10); // variation of y pos, random value up to 100
  }
}
PFont f; // Variable for the font
float noiseFactor = 0; 

void setup() {
  size(600, 800);
  f = createFont("IBMPlexSans-Bold", 16, true); // Create font
}

void draw() {
  background(0);

  for (float y=0; y<height; y=y+10) {// loop for height, y<height is true, increases by 10
    for (float x=0; x<width; x=x+1) { // loop for height
      stroke(255); 
      point(x, y + map(noise(x/100, y/150, noiseFactor), 0, 1, -50, 100));
      // map(value, start1, stop1, start2, stop2)
      // First: the incoming value to be converted
      // Second: lower bound of the value's current range
      // Third: upper bound of the value's current range
      // Forth: lower bound of the value's target range
      // Fifth: upper bound of the value's target range
    }
  }

  noiseFactor = noiseFactor + 0.05;

  // black outline
  fill(0);
  noStroke();
  rect(0, 0, 600, 100);
  rect(0, 700, 600, 100);
  rect(0, 0, 100, 800);
  rect(500, 0, 100, 800);

  // text
  textFont(f, 60);
  fill(255);                         
  text("JOY DIVISION", 95, 80);
  textFont(f, 35);
  text("UNKNOWN PLEASURES", 105, 745);
}

Recap

Of course, the font could be improved to replicate the original artwork. I was just sticking to one I already had. But this is just a detail. I used black rectangles to make a border. The moving artwork could also be coded and “restricted” more elegantly so that I wouldn’t need the black rectangles. And then the hilly area should only be hilly in the center of the artwork and not to the edges but I think I did fine so far and this would be a mission for future Nora.