MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: RE: Animate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67046] RE: [mg66997] RE: [mg66956] Animate
  • From: "David Park" <djmp at earthlink.net>
  • Date: Thu, 8 Jun 2006 04:53:05 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Peter,

Here is some material from the Examples section of the DrawGraphics Help on
exporting animations as .gif files. You don't actually need DrawGraphics to
do this.

Needs["Graphics`Animation`"]

There is a difficulty in exporting animations made by SpinShow and other
routines in the Animation package because these routines fail to return the
graphics cells needed for the export. This can be remedied by the following
routine patterned after postings by Mark Fisher and Peter Pein on MathGroup.

AnimationGraphics::usage =
    "AnimationGraphics[animatecommand] generates the regular animations
produced by the various commands in the Animation packages and also returns
the list of graphics objects produced.";
Attributes[AnimationGraphics] = {HoldFirst};
AnimationGraphics[animatecommand_] :=
  Block[{$AnimationFunction = Identity, $RasterFunction = $DisplayFunction},
    animatecommand]

Here is a 3D plot.

plot1 = Plot3D[x Cos[y], {x, -1, 1}, {y, -\[Pi], \[Pi]},
      Axes -> False,
      Boxed -> False];

This produces the animation and saves the graphics cells.

animationframes =
  AnimationGraphics[SpinShow[plot1]]
SelectionMove[EvaluationNotebook[], All, GeneratedCell]
FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5];
FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime -> 0.1,
      AnimationDirection -> Forward]}]

We will export the animation as a .gif image. The following command can be
used to select a folder for storing the animation. Maneuver to a folder and
then use a file name such as myanimation.gif.

filename = Experimental`FileBrowse[]

Export[filename, animationframes, "GIF",
  ConversionOptions -> {"Loop" -> True, "AnimationDisplayTime" -> 0.2}]

If the animation is produced by a Table command, the output graphics cells
are automatically returned and there is no need to use the AnimationGraphics
command.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


From: King, Peter R [mailto:peter.king at imperial.ac.uk]
To: mathgroup at smc.vnet.net


This great - it has just help me create an animation of a dispersing
pulse. Is htere any way to export the resulting animation to an avi file
(or any similar movie file)?

Thanks,

Peter

> -----Original Message-----
> From: David Park [mailto:djmp at earthlink.net]
To: mathgroup at smc.vnet.net
> Subject: [mg67046] [mg66997] RE: [mg66956] Animate
>
>
> You  have to select the group of 6 graphics cells, close them
> up, and then
> double click on the image to start the animation. Or just
> double click on
> any image without closing them up.
>
> Alternatively, you could attach the following lines of code,
> which will
> automatically do this for you.
>
> Needs["Graphics`Animation`"]
>
> Module[{n}, Animate[Plot[Sin[n x], {x, 0, 2 Pi}], {n, 1, 6, 1}]]
> SelectionMove[EvaluationNotebook[], All, GeneratedCell]
> FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5];
> FrontEndExecute[{FrontEnd`SelectionAnimate[200,
> AnimationDisplayTime -> 0.1,
> AnimationDirection -> Forward]}]
>
> The 'A' button from the DrawGraphics palette that comes with the
> DrawGraphics package, for those who have it, will paste in
> those lines of
> code.
>
> Also, don't forget that you can control the animation with
> keyboard keys.
> 1) up/down arrows will advance one frame at a time.
> 2) left/right arrows will start animation in forward or
> reverse direction.
> 3) 'p' will pause or restart the animation.
> 4) 'c' will put the animation in the ForwardBackward mode.
> 5) The number keys will control the speed of the animation.
>
> David Park
> djmp at earthlink.net
> http://home.earthlink.net/~djmp/
>
>
>
>
> From: MR [mailto:marcinrak at gmail.com]
To: mathgroup at smc.vnet.net
>
> Hey everyone
>
> Module[{n}, Animate[Plot[Sin[n x], {x, 0, 2 Pi}], {n, 1, 6, 1}]];
>
> running the above command doesn't yield an animation in one plot, but
> much rather six different still plots which appear one beneath the
> other.
>
> Any ideas?
>
>
>


  • Prev by Date: Or in a Select question
  • Next by Date: Re: Two questions (1) Sollve and (2) Precision
  • Previous by thread: RE: RE: Animate
  • Next by thread: How to generate sections, subsections, etc. automatically?