clear
clc
global phi %defines phi value to be used by different fuctions (the fractal func)



% Defines the starting points of the function:  I played around with these
% to see which ones would make the most interesting plot
Pt1 = [0; 1];
Pt2 = [1; 0];
Pt3 = [3; 1];

% Changes the angle of the function while level is kept at a constant:
level = 10;
f=1;

for i = 1:200
    clf
    ii = i;
    if (i>100)
       ii = (200-i);
    end
    phi = (9/2+((1/2)*ii))*(pi/180);

    % Calls on the fractal function:
    fractal(level, Pt1, Pt2, Pt3);

    % Plots and saves images to be used for the gif:
    hold off
    title(['Dragon Fractal level ',num2str(level),' Phi = ', sprintf('%3.1f',phi*180/pi),' degrees'],'fontsize',20)
    axis([-0.1 1.0 -0.3 0.9]) % I played with different values until plot fit appropriately
    axis('equal','off');
    saveas(gcf, ['dcangle', sprintf('%03d',f), '.png']);
    f=f+1;
end