clear; close all
figure('units','pixels','position',[0 0 1920 1080],'ToolBar','none');
vid = VideoWriter('EulerCircle.mp4','MPEG-4');
vid.FrameRate = 30;    % Default 30
vid.Quality = 100;    % Default 75
open(vid);
set(0,'defaultfigurecolor',[1 1 1]);
myBlue = [0.5 0.55 0.88];
myBlue2 = [0.61 0.67 0.92];

str1 = 'theta = '; 
str2 = 'exp(-i\theta) = ';
str7 = ' i';
for ii = 0:360 % Full circle 
    hold off
    theta = 0:pi/180:ii*pi/180; 
    rho = cos(theta)+1;
    polarplot(theta,rho,'b','LineWidth', 2.0)
    hold off 
    ax = -[theta(end) theta(end)];
    polarplot(ax,[0 1],'r','LineWidth', 2.0);
    hold on
    ax2 = -[theta(end)-pi/180 theta(end)+pi/180 theta(end) theta(end)-pi/180];
    polarplot(ax2,[1-0.05 1-0.05 1 1-0.05],'r','LineWidth', 2.0);
    rlim([0 1.0])
    set(gca,'fontsize',23);
    set(gca,'linewidth',2);
    set(gca,'box','off')
    str4 = num2str(theta(end),'%-4.3f');
    str5 = num2str(cos(theta(end)),'%-4.3f');
    str6 = num2str(-sin(theta(end)),'%+ 4.3f');
    
    hText = text(0, 1.25, [str2,str5,str6,str7], 'FontSize',23);
    thetaticks(0:45:315);
    thetaticklabels({'1',' ','i',' ','-1',' ','-i',' '});
    rticks(0:1:1);
    rticklabels({' ',' '});
    frame = getframe(gcf);
    writeVideo(vid,frame);
end
% Output the movie as an mp4 file and close it
close(vid);