/*Drew Cogbill Image 3.1 [computation08*/ //Load an image and use get() to create a collage by overlaying //different sections of the same image. PImage topanga; PImage[] tops = new PImage[16]; int counter = 0; int x = 0; int y = 0; void setup() { frameRate(30); size(400, 400); topanga = loadImage("topanga.jpg"); background(0); for (int i = 0; i < 4; i++) { tops[i] = topanga.get(x, y, 50, 50); x += 50; } y += 50; x = 0; for (int i = 4; i < 8; i++) { tops[i] = topanga.get(x, y, 50, 50); x += 50; } y += 50; x = 0; for (int i = 8; i < 12; i++) { tops[i] = topanga.get(x, y, 50, 50); x += 50; } y += 50; x = 0; for (int i = 12; i < 16; i++) { tops[i] = topanga.get(x, y, 50, 50); x += 50; } } void draw() { if (mousePressed == true) { if (counter == 15) { counter = 0; } int opacity = int(map(counter, 0, 16, 25, 255)); tint(opacity, opacity/4, opacity*2, opacity); image(tops[counter], pmouseX, pmouseY); counter++; println(counter); } }