PImage[] imgs = new PImage[4]; // loaded images PImage img; // current image int curImg = 0; // current image float maxR; // how far away can the mouse be from a pixel void setup() { size(300,450); smooth(); noStroke(); for(int i = 0; i < imgs.length; i ++) imgs[i] = loadImage("img-"+(i+1)+".jpg"); img = imgs[curImg]; maxR = sqrt(width*width+height+height); // sketch diagonal } void draw() { background(0); // move from outside in, geometrically for (float r=maxR; r>0.01; r*=0.9) { // move around circle for (float a=0; a<360; a+=5) { // convert to (x,y), and plot ellipse if in-bounds float x = mouseX + r*cos(radians(a)); float y = mouseY + r*sin(radians(a)); if (x > 0 && x < width && y > 0 && y < height) { fill(img.get(round(x),round(y))); ellipse(x,y,r/5,r/5); } } } } void keyPressed() { if(key == ' ') { curImg = (curImg+1)%imgs.length; img = imgs[curImg]; } } // START NO NOTES // code used to capture screenshots void keyReleased() { if(key == '`' && !online) save("sketch.png"); }