PImage img;
int x = width/2;
int y = height/2;
int sx = 0;
int sy = 0;
int ex = 0;
int ey = 0;
void setup(){
img = loadImage("snj.jpg");
size(559,800);
image(img,0,0);
}
void draw(){
copy(0,0,width/2,height,width,0,-width/2,height);
}
void mousePressed(){
sx = mouseX;
sy = mouseY;
}
void mouseReleased(){
ex = mouseX - sx;
ey = mouseY - sy;
x = mouseX;
y = mouseY;
for(int i = 0 ; i < 20 ; i++ ){
x += int(random(-10.10));
y += int(random(-10,10));
copy(sx,sy,ex,ey,x,y,ex,ey);
}
}