RE: Re: Real Time Animation

*To*: mathgroup at smc.vnet.net*Subject*: [mg36838] RE: [mg36816] Re: [mg36796] Real Time Animation*From*: "DrBob" <drbob at bigfoot.com>*Date*: Sat, 28 Sep 2002 04:34:42 -0400 (EDT)*Reply-to*: <drbob at bigfoot.com>*Sender*: owner-wri-mathgroup at wolfram.com

That's nice because it avoids watching the frames being slowly created, and the group doesn't always collapse as it should, the way I've been doing it. However, a couple of small changes give a smoother animation with 64 frames rather than 151, while GENERATING only 33 frames. Block[{$DisplayFunction = Identity, half, graphs, step = Pi/32}, half = Table[GraphicCell[Plot[Sin[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}, ImageSize -> 400]], {t, -Pi/2, Pi/2 - step, step}]; graphs = Rest@Join[half, Rest@Reverse@half]; NotebookWrite[EvaluationNotebook[], Cell[CellGroupData[graphs, Closed]]]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEndToken[EvaluationNotebook[], "SelectionAnimate"]}]] Bobby -----Original Message----- From: Omega Consulting [mailto:omega_consulting at yahoo.com] To: mathgroup at smc.vnet.net Subject: [mg36838] [mg36816] Re: [mg36796] Real Time Animation At 03:56 AM 9/26/2002, Goyder Dr HGD wrote: >In a presentation I wish to use Plot to generate a sequence of frames and >then animate them. The problem is that the audience sees the animation >twice. Once when the frames are being generated and then again after I have >closed the group and double clicked on the top graphic. However, the first >showing during generation is enough (but uncontrolled). > >Hugh Goyder This creates a graphics cell from a graphics expression. GraphicCell[graphics_] := Cell[GraphicsData["PostScript", DisplayString[graphics]],"Graphics"] This writes a closed cellgroup of graphics cells and then animates the cellgroup. Block[{$DisplayFunction=Identity, graphs}, graphs = Table[GraphicCell[ Plot[Sin[t]*Sin[x], {x, 0, Pi}, PlotRange -> {{0, Pi}, {-1, 1}}, ImageSize -> 400]], {t,0,15,.1}]; NotebookWrite[EvaluationNotebook[],Cell[CellGroupData[graphs,Closed]]]; SelectionMove[EvaluationNotebook[], All, GeneratedCell]; FrontEndExecute[{FrontEndToken[EvaluationNotebook[], "SelectionAnimate"]}] ] -------------------------------------------------------------- Omega Consulting "The final answer to your Mathematica needs" Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html