
function supermanimate(h,P,Tcurr,Tset,ord,N)


% vidObj=VideoWriter('45349.avi');
% vidObj.FrameRate=30;
% vidObj.Quality=100;
% open(vidObj);

P2=[P';ones(1,size(P,1))];

for j=1:size(Tset,4);
   
    for b=1:size(Tset,3);
    
        for c=1:size(Tset,5);
            
            if (ord(c,j)==1)
        
                T = Tcurr(:,:,c)*Tset(:,:,b,j,c);
            else
                T = Tset(:,:,b,j,c)*Tcurr(:,:,c);
            end
            
            Q=T*P2;
            if (b==size(Tset,3))
           Tcurr(:,:,c)=T;
            end
            set(h(c),'vertices',Q(1:3,:)');
%            currFrame=getframe;
%            writeVideo(vidObj,currFrame);

            pause(0.008)
        
        end
       
    end

end
