// Synthetic Gears // // Scott "Jerry" Lawrence // 2003-10-14 // // Based on the research of Paul Haeberli, as shown in his/SGI's "Grafica Obscura" // Uses images from the Synthetic Lighting demonsttration found here: // http://www.sgi.com/grafica/synth BImage gears[]; void setup() { gears = new BImage[3]; gears[0] = loadImage( "gearA.gif" ); gears[1] = loadImage( "gearB.gif" ); gears[2] = loadImage( "gearC.gif" ); size( gears[0].width, gears[0].height ); } int c = 0; int mil; int a1, a2, a3; void loop() { if( millis() > mil+500 ) { // update the image selector a1 = (int)random( 3 ); //*(c+0)%3 a2 = (int)random( 3 ); a3 = (int)random( 3 ); // update the counter c = (c+1) % 3; // and the trigger mil = millis(); } if( mousePressed ) { // show the original image image( gears[c], 0, 0 ); } else { // show a mixture for( int p = 0 ; p < gears[0].width * gears[0].height ; p++ ) { color pc = color( red( gears[a1].pixels[p] ), green( gears[a2].pixels[p] ), blue( gears[a3].pixels[p] )); pixels[ p ] = pc; } } //if( keyPressed && ( key == 'G')) // saveFrame(); }