(* This is the file MakeFramesSin.m, written by Douglas N. Arnold Department of Mathematics Penn State University Park, PA 16802 January 1997 *) Needs["homotopyframes`"] Needs["Graphics`Colors`"] (* This file makes an animation of a linear homotopy by showing the evolution of the image of a rainbow shaded rectangle. *) (* STEP 1: DESCRIBE THE DESIRED ANIMATION *) animfile="sin.anim"; (* filename for the output animation *) f0[z_]:=z (* initial and final functions *) f1[z_]:=Sin[z] (* of the homotopy *) ll=-.975 Pi-2 I; (* lower left and upper right corners of *) ur=-ll; (* the rectangle to be plotted *) llplot=-4.5-4.5 I; (* lower left and upper right corners of *) urplot=-llplot; (* plotting region *) nframes=11; (* number of frames in the animation *) vlines=800; (* number of vertical lines (these have varying hue) *) starthue=0; (* starting and ending hues for the vertical lines *) endhue=.9; (* (both should be in [0,1] ) *) vthickness=.01; (* thickness of the vertical lines *) hlines=7; (* number of horizontal grid lines to superimpose *) hgridcolor=Gray; (* color of the horizontal grid lines *) hthickness=.006 (* thickness of the horizontal grid lines *) vglines=13; (* number of vertical grid lines to superimpose *) vgridcolor=Gray; (* color of the vertical grid lines *) vgthickness=.006 (* thickness of the vertical grid lines *) bdrycolor=White; (* color of the boundary *) bdrythickness=.006 (* thickness of the boundary lines *) width=400 (* frame width in pixels *) height=400 (* frame height in pixels *) options = (* general plot options *) {Background->Black, DefaultColor->White, AspectRatio->Automatic}; (* STEP 2: MAKE THE ANIMATION *) homotopyframes[ (* initial function *) f0, (* final function *) f1, (* curvelist *) Join[ (* colored vertical lines *) Table[ line@@Join[{Re[ll]+j(Re[ur]-Re[ll])/(vlines-1)+I Im[ll], Re[ll]+j(Re[ur]-Re[ll])/(vlines-1)+I Im[ur], PlotStyle->{{Thickness[vthickness], Hue[starthue + (endhue-starthue)j/(vlines-1)]}}}, options], {j,0,vlines-1}], (* horizontal grid lines *) hlinearray@@Join[{ll,ur,hlines, PlotStyle->{{Thickness[hthickness],hgridcolor}}}, options], (* vertical grid lines *) vlinearray@@Join[{ll,ur,vglines, PlotStyle->{{Thickness[vgthickness],vgridcolor}}}, options], (* boundary *) {rectangle@@Join[{ll,ur, PlotStyle->{{Thickness[bdrythickness],bdrycolor}}}, options]} ], (* number of frames *) nframes, (* width and height *) width, height, (* filename prefix *) "frame", (* options for each frame *) PlotRange->{{Re[llplot],Re[urplot]},{Im[llplot],Im[urplot]}} ]; Print[StringJoin["-- wrote frames --"]]