function Tlast=manimate(h,P,Tcurr,Tset,ord)

for j=1:size(Tset,3)
    
    if (ord==1)
        T = Tcurr*Tset(:,:,j);
    else
        T = Tset(:,:,j)*Tcurr;
    end
    
    Q=T*P;
     set(h, 'XData', Q(1,:), 'Ydata',Q(2,:),'Zdata',Q(3,:));
    pause(0.01)
        
end
Tlast=T;

end