PImage img;

void setup(){
  size(400,300);
  img = loadImage("tvland.png");  


}

float s = 1.5;
//float f = 0.0;
void draw(){
background(0);
  drawZoom(s);
  s += map( mouseY,0,height,.1,-.1 );
  if(s < 1.0) {
    s = 1.666666;
  }
  if(s > 1.66666666) {
    s = 1.0;
  }


}



void drawZoom(float origscale){
  float scale = origscale;
  float w=width*scale;
 float h=height*scale;
 float left = 0; //- (w*scale)/5.0;
 float  top = 0; // - (h*(scale))/5.0; 


  scale = origscale;
   w=width*scale;
   h=height*scale;
  while(w > 1.0){
   w = width * scale;
   h = height * scale;
    left += (w) / 5.0;
    top += (h) / 5.0;
   scale *= .6;
 }
left = 0 - (left-200);
top = 0 - (top-150);

  scale = origscale;
   w=width*scale;
   h=height*scale;
  while(w > 1.0){
   w = width * scale;
   h = height * scale;
   drawAt(w,h,left,top);
    left += (w) / 5.0;
    top += (h) / 5.0;
   scale *= .6;
 }
  
}


void drawAt(float w, float h, float left, float top){
   image(img,left,top,w,h); 
  
}