% GUIanimglobe
% Function for the MODIS GUI
% Copyright by Jasmine S Nahorniak, Oregon State University. 
% mar 20 2000

function [M]=GUIanimglobe;

    GUIdefaults;

    setm(findobj(gcbf,'Tag','Mapaxes'),'MapProjection', 'globe');
    xlabel('');
    ylabel('');  

    % make sure is global
    setm(gca,'flatlimit',[-90 90],'maplatlimit',[-90 90], ...
         'flonlimit',[-180 180],'maplonlimit',[-180 180]);
    view(0,0) 
    set(gca,'CameraViewAngleMode','manual');

    % set up movie variables
    step=guianimstep;
    M=moviein(360/step);
    j=0;
    outframes=guisaveframes; % output movie frames?
   
    for v=0:step:360-step,
       j=j+1;
       view(v,0);       
       drawnow;
       pause(0.2);
       dd=getframe(gcf);       
       M(1:length(dd),j)=dd;
       if outframes=='y' | outframes=='Y',
          set(gcf,'InvertHardcopy','off')
          set(gcf,'PaperPosition',[0.25 2.5 4 3])
          if j<10,
             eval(['print -r200 -dtiffnocompression ' guioutpath 'globe00' num2str(j) '.tif'])
          elseif j<100,
             eval(['print -r200 -dtiffnocompression ' guioutpath 'globe0' num2str(j) '.tif'])
          else
             eval(['print -r200 -dtiffnocompression ' guioutpath 'globe' num2str(j) '.tif'])
          end
       end
    end
   % run movie
   %movie(M,3,5)
