public void run(){
    while(anime!=null){
        //淡入
        for(int i=0;i<256;i+=32){
            ImageFilter f=new FadeInFilter(i);
            ImageProducer producer=new FilteredImageSource(img1.getSource(),f);
   fg_img=createImage(producer);
   //等待到新图象准备好
   MediaTracker mt=new MediaTracker(this);
   mt.addImage(fg_img,1);
   try{
       mt.waitForID(1);
   }catch(InterruptedException e){};
   repaint();
   try{
       Thread.sleep(500);
   }catch(InterruptedException e){};
   fg_img.flush();
        }
        //淡出
        for(int i=256;i>0;i-=32){
           ImageFilter f=new FadeInFilter(i);
  ImageProducer producer=new FilteredImageSource(img1.getSource(),f);
           fg_img=createImage(producer);
  //等待到新图象准备好
  MediaTracker mt=new MediaTracker(this);
  mt.addImage(fg_img,1);
  try{
      mt.waitForID(1);
           }catch(InterruptedException e){};
  repaint();
  try{
     Thread.sleep(500);
  }catch(InterruptedException e){};
      fg_img.flush();
  }
    }
}