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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
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++; } |