Clinton Montague

Developer, learner of things, functional programming enthusiast, hacker, and all round inquisitor.

Generative art experiment 1: Rainbow with a headache

January 12, 2012

Not exceptionally exciting or groundbreaking, but it was my first real experiment with processing. I got it to save out a png capture of each frame, then turned them into a video. I present to you Rainbow with a headache.

[vimeo clip_id=34862441 width=616 height=231]

 

int frame = 0;
void setup () {
  size (800, 300);
  background(0);
  smooth ();
}

void draw () {
  int step = 10;
  float lastx = -999;
  float lasty = -999;
  float ynoise = random(10);
  float y;
  float xsteps = width;
  float ysteps = 100;

  
  colorMode(HSB, ysteps);
  for (int i = 0; i < ysteps; i++) {
    for (int x = 0; x < xsteps; x++)
    {
      y = (height / ysteps) * i + (noise(ynoise) ) * 80 - 40;
      if (lastx > -999) {
        stroke (i, 100, 100);
        line (x, y, lastx, lasty);
      }
      lastx = x;
      lasty = y;
      ynoise += 0.1;
    }
  }
  if (frame > 20 && frame < 500)
  {
    // you can use quicktime to convert the image sequence to a movie. 
    saveFrame ("frame-####.png");
  }
  frame++;
}