(*   This is the file MakeFramesPower.m, written by

     Douglas N. Arnold  <dna@math.psu.edu>
     Department of Mathematics
     Penn State
     University Park, PA  16802
     
     January 1997
*)
      
Needs["homotopyframes`"]
Needs["Graphics`Colors`"]

(* Make some animations of the homotopy from the identity to z^1 to z^4.
	   Store the frames. *)

ll=0;
ur=(1+I)/Sqrt[2];
llplot=-1+I;
urplot=-llplot;
width=400;            (* frame width in pixels *)
height=400;           (* frame height in pixels *)
prefix="frame";       (* filename prefix *)
frames=11;            (* number of frames *)

writetofile[width_,height_,prefix_,i_] := StringJoin["!rasterps -w ",
  ToString[width]," -h ",ToString[height]," -format ppm > ",
  prefix,ToString[PaddedForm[i,3,NumberPadding->{"0",""}]],".ppm"]

curvelist = Join[
   vlinearray[ll,ur,6,
      PlotStyle->{{Thickness[.005],Yellow}},
      Background->Black,
      DefaultColor->White,
      AspectRatio->Automatic],
    hlinearray[ll,ur,6,
      PlotStyle->{{Thickness[.005],Yellow}},
      Background->Black,
      DefaultColor->White,
      AspectRatio->Automatic],
   {line[Re[ur],ll,
      PlotStyle->{{Thickness[.005],Green}},
      Background->Black,
      DefaultColor->White,
      AspectRatio->Automatic],
    line[ll,I Im[ur],
      PlotStyle->{{Thickness[.005],Green}},
      Background->Black,
      DefaultColor->White,
      AspectRatio->Automatic]
   }
];

(* image of a Cartesian grid in the first quadrant *)
Table[
  Display[
    writetofile[width,height,prefix,i],
    showcurve[image[(#^(1+2.9(i-1)/(frames-1)))&,curvelist],
    PlotRange->{{Re[llplot],Re[urplot]},{Im[llplot],Im[urplot]}},
    DisplayFunction->Identity]],
  {i,1,frames}]

Print["-- wrote frames --"]

