Re: Re: Re: making an animated picture from many pictures
- To: mathgroup at smc.vnet.net
- Subject: [mg57619] Re: [mg57566] Re: [mg57528] Re: [mg57502] making an animated picture from many pictures
- From: "David Park" <djmp at earthlink.net>
- Date: Thu, 2 Jun 2005 05:16:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Pratik, First, you can control animations with keyboard keys. 1) The up/down arrow keys advance the animation one frame at a time in the backward and forward directions. 2) The right/left arrow keys start the animation in the forward or backward directions. 3) The number keys, on the keyboard or the numberpad, control the speed of the animation. 4) The 'p' key will pause and restart the animation. 5) The 'c' key will run the animation in the ForwardBackward mode. Using the keys to control the animation is a good way to view animations. There is an AnimationDisplayTime for cells, but I don't know how to easily get it into the graphics display cell. Maybe somebody can show that. An animation that simply starts, runs to the end and instantly repeats is jarring to the viewer. It is far better to have a pause at the beginning and/or end. Sometimes when an animation has a series of actions that can be considered as separate it is good to have pauses between each action. An animation that pauses at the begining and end can simply be done by clipping the animation parameter. (With 5.1.1 one could use Clip.) Here is my previous example modified to do that. Needs["Graphics`Animation`"] frame[phase_] := Module[{plotphase = Min[2Pi, Max[0, phase]]}, Plot[Sin[t + plotphase], {t, 0, 2Pi}, Frame -> True]]; Animate[frame[phase], {phase, -Pi/8, 2Pi + Pi/8, Pi/16}] SelectionMove[EvaluationNotebook[], All, GeneratedCell] FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5]; FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime -> 0.1, AnimationDirection -> Forward]}] For a series of actions I usually have an internal parameter that uses UnitStep to cause pauses between the actions. Essentially I use a ramp function with flat portions. For animations of complex functions I suggest you take a look at the Cardano3 package at my web site below. It uses the DrawGraphics package and is essentially a major extension to DrawGraphics for plotting complex functions. The Help has examples for all the various plot types and there are also extended examples with many animations. I don't really understand the function you are attempting to animate. If you could give me a more complete description I could try a plot for you. In any case, one of the Cardano3 plot types is a CodedDensity plot, which uses a color function to encode phase and magnitude. (This is sometimes referred to as 'domain coloring'.) Another type of plot available is a ComplexVector plot. In this plot you can select an arbitrary 'grid' of points and then plot vectors at each point that represent the value of the complex function at that point. It is possible to put a ComplexVector plot on top of a CodedDensity plot. I often just use a few ComplexVector points, but move them around in an animation on top of a CodedDensity background. This often gives a nice picture of how the complex function behaves. There are also surface plots, fancy complex map plots and plots to the Riemann sphere. The package also has routines such as ComplexLine, ComplexPoint, ComplexCurve that allow you to deal directly with complex values instead of {x,y} pairs. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Pratik Desai [mailto:pdesai1 at umbc.edu] To: mathgroup at smc.vnet.net David Park wrote: >Guy, > >Here is an example. > >Needs["Graphics`Animation`"] > >frame[phase_] := > Plot[Sin[t + phase], {t, 0, 2Pi}, > Frame -> True] > >Animate[frame[phase], {phase, 0, 2Pi - 2Pi/40, 2Pi/40}] >SelectionMove[EvaluationNotebook[], All, GeneratedCell] >FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5]; >FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime -> 0.1, > AnimationDirection -> Forward]}] > >You could have used Table instead of Animate, but it is worthwhile getting >to know the Animation package. > >Although it wasn't necessary in this example, generally when making >animations you will need to include a PlotRange option to make certain that >all frames use the same plot range. > >The statements after the Animate statement select all the generated graphics >cells, close them up, and start the animation. You do see the cells as they >are first being generated but I don't find that objectional. In fact I like >to see them because if the cells are complex and take some time, I want to >know that the graphics are working as I intended and I can abort the >animation if they aren't. > >If you use DrawGraphics package from my web site, the statements are on the >DrawGraphics palette and can simply be clicked in. > >David Park >djmp at earthlink.net >http://home.earthlink.net/~djmp/ > >From: Guy Israeli [mailto:guyi1 at netvision.net.il] To: mathgroup at smc.vnet.net > > >Hi, > >How do I create one image that is animated from many other images without >displays all of them and double clicking on one of them? > >Thanks, > >Guy > > > > > > > A related question How do you automatically pause the animation after one cycle t =0 to 2*pi Also if you have complex functions is it possible to plot the magnitude and phase together and animate lamda={-0.3331650057325463 - 3.1662410948948874*I, -0.3331650057325463 + 3.1662410948948874*I, -0.4590555619739296 - 6.232750821142238*I, -0.4590555619739296 + 6.232750821142238*I, -0.04711742781559086 + 9.418500468421371*I, -0.04711742781559087 - 9.418500468421371*I} func[lamda_]:=Sinh[lamda*x] Thanks -- Pratik Desai Graduate Student UMBC Department of Mechanical Engineering Phone: 410 455 8134