import processing.core.*; import processing.xml.*; import java.applet.*; import java.awt.Dimension; import java.awt.Frame; import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; import java.awt.event.FocusEvent; import java.awt.Image; import java.io.*; import java.net.*; import java.text.*; import java.util.*; import java.util.zip.*; import java.util.regex.*; public class plainsquares extends PApplet { /* attempting to make interactive using mouseClicked to redraw fragments */ // store number of images int IMGNUMBER= 16 ; // a PImage array (store the PImage [] imgArray = new PImage [IMGNUMBER]; int srcX = 900-150; int srcY = 600-150; public void setup() { size(750, 450) ; //set random framerate to maximum of 0.2 fps (max time frame is on screen is 5 secs) // frameRate(.1); // a for loop to populate the imgArray array // this routine generates unique Strings that are used for loadImage // we load a series of images into the imgArray[] for (int i = 0 ; i < IMGNUMBER ; i++) { // generate a series of unique string names using the i variable String imageName = i + ".JPG" ; println(imageName) ; // load the images into the array via loadImage imgArray[i] = loadImage(imageName) ; } // for (int j = 0 ; j < TRINUMBER ; j++) { // // generate a series of unique string names using the i variable // String triName = 100+j + ".jpg" ; // println(triName) ; // // load the images into the array via loadImage // triArray[j] = loadImage(triName) ; // } } public void draw() { int a = PApplet.parseInt(random(IMGNUMBER)) ; copy(imgArray [a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 0, 0, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 0, 150, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 0, 300, 150, 150) ; copy(imgArray[a],PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 0, 450, 150, 150) ; copy(imgArray [a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 150, 0, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 150, 150, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 150, 300, 150, 150) ; copy(imgArray[a],PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 150, 450, 150, 150) ; copy(imgArray [a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 300, 0, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 300, 150, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 300, 300, 150, 150) ; copy(imgArray[a],PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 300, 450, 150, 150) ; copy(imgArray [a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 450, 0, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 450, 150, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 450, 300, 150, 150) ; copy(imgArray[a],PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 450, 450, 150, 150) ; copy(imgArray [a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 600, 0, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 600, 150, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 600, 300, 150, 150) ; copy(imgArray[a],PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 600, 450, 150, 150) ; copy(imgArray [a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 750, 0, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 750, 150, 150, 150) ; copy(imgArray[a], PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 750, 300, 150, 150) ; copy(imgArray[a],PApplet.parseInt(random(srcX)), PApplet.parseInt(random(srcY)), 150, 150, 750, 450, 150, 150) ; // saveFrame(); noLoop (); } //void mousePressed(){ //println("Processingexample:mouse press detected"); //rotate (radians(4)); public void mousePressed() { loop(); // open ( // "/Volumes/Alice Desmond/DMM4/Project/review/site/applets/border1.jar"); } //void mouseReleased() { // noLoop(); // //} public void mouseMoved() { loop(); } static public void main(String args[]) { PApplet.main(new String[] { "--bgcolor=#c0c0c0", "plainsquares" }); } }