RE: How to animate?
- To: mathgroup at smc.vnet.net
- Subject: [mg38518] RE: [mg38509] How to animate?
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 20 Dec 2002 23:40:27 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Christopher, I like this question because now I have learned how to do something new. The following function is in the DrawGraphics package at my web site. I copy it out here for anyone to use. DoShow[args1___, DisplayFunction -> _, args2___] := Show[args1, DisplayFunction -> $DisplayFunction, args2]; DoShow[args___] := Show[args, DisplayFunction -> $DisplayFunction] Now we make the frames for your animation without display. I increased the number of plot points. It takes a little time. frames1 = Table[ Plot3D[ BesselJ[0, Sqrt[x^2 + y^2] + t], {x, -10, 10}, {y, -10, 10}, Axes -> False, PlotPoints -> 30, PlotRange -> {-0.5, 1.0}, DisplayFunction -> Identity ], {t, 0, 8} ]; Now we use the following commands to quickly display all the frames, close them up and run the animation. All the frames are shown for about 1 second versus about 13 seconds to produce the set in the first place. So it is not perfect but maybe it will be good enough - or maybe somebody will suggest a better method. DoShow /@ frames1; SelectionMove[EvaluationNotebook[], All, GeneratedCell] FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.01]; FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime -> 0.1, AnimationDirection -> Forward]}] The Pause command was included to guarantee that the cell group is closed before the animation starts. However I find that there is a bug in Pause in that it always pauses for 1 second even though it should handle smaller time intervals. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Christopher R. Carlen [mailto:crcarle at sandia.gov] To: mathgroup at smc.vnet.net Hi: I'm using 4.1.0 on Linux I have been reading in section 1.9.12 about animating graphics. I don't seem to be able to get the example to work. If I input: Table[ Plot3D[ BesselJ[0, Sqrt[x^2 + y^2] + t], {x, -10, 10}, {y, -10, 10}, Axes -> False, PlotRange -> {-0.5, 1.0}, DisplayFunction -> Identity ], {t, 0, 8} ] // Short Then I input: ShowAnimation[%] Mathematica just outputs: ShowAnimation[{\[SkeletonIndicator]SurfaceGraphics\[SkeletonIndicator], \ \[SkeletonIndicator]SurfaceGraphics\[SkeletonIndicator], \ \[SkeletonIndicator]SurfaceGraphics\[SkeletonIndicator], \ \[SkeletonIndicator]SurfaceGraphics\[SkeletonIndicator], \ \[SkeletonIndicator]SurfaceGraphics\[SkeletonIndicator], \ \[SkeletonIndicator]SurfaceGraphics\[SkeletonIndicator], \ \[SkeletonIndicator]SurfaceGraphics\[SkeletonIndicator], \ \[SkeletonIndicator]SurfaceGraphics\[SkeletonIndicator], \ \[SkeletonIndicator]SurfaceGraphics\[SkeletonIndicator]}] (how do I get it to copy/paste what I see in the notebook, instead of all the internal cell expression stuff?) If I change the example to: Table[ Plot3D[ BesselJ[0, Sqrt[x^2 + y^2] + t], {x, -10, 10}, {y, -10, 10}, Axes -> False, PlotRange -> {-0.5, 1.0} ], {t, 0, 8} ] // Short Then I get 17 graphics rendered. I can click the cell containing them, then use Cell|Animate Selected Graphics, which then produces the animation. I want to have a command that I can execute interactively or associated with a button, to animate the graphics. I don't want the graphics displayed when I execute the command that generates the graphics. What is the right way to do this? Thanks. -- ____________________________________ Christopher R. Carlen Principal Laser/Optical Technologist Sandia National Laboratories CA USA crcarle at sandia.gov