/** A Skyline generator by guru */ void setup() { size( 600, 300); noLoop(); } void draw() { for (int h = 0; h < height; h++) { stroke(0,0,map(h,0,height,255,0)); line( 0, height - h, width, height -h); } for ( int i = 0; i < 15; i++) { fill(0); stroke(0); // float x = random(width); float x = i * width / 15; float w= int(random( 4 )) * 10 + 24; float h = int(random( 15 )) * 10 + 50; rect(x, height - h, w, h ); noStroke(); fill(255,255,0); for( int wx = 0; wx +1 < w/10 ; wx++) { for( int wy = 0; wy < h/10; wy++) { if ( random( 100 ) > 70 ) { rect( x + 5 + wx*10 , height - h + 5 + wy* 10, 5, 5 ); } } } } } void keyPressed() { redraw(); }