PImage myImage; // variable to hold the image int shiftX=150, shiftY=100; // these will hold our panning anounts void setup() { size (300, 200); myImage = loadImage("flowers.jpg"); // load image from data folder imageMode(CENTER); // we want to specify the center of the image, not top left } void draw() { // icrement our shift variables if we are close to the edges if (mouseX> width-10)shiftX--; if (mouseX< 10)shiftX++; if (mouseY> height-10)shiftY--; if (mouseY< 10)shiftY++; pushMatrix(); // setting pushMatrix() so that we can revert to the normal matrix later background(255); translate(shiftX, shiftY); // translate the coordinate system by our shift amount image (myImage, 0, 0); // use image to draw on screen popMatrix(); // reverting to the normal matrix in order to draw another image not shifted image (myImage, width/2, height/2, 120, 80); }