MathGroup Archive 2004

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

Search the Archive

Re: Animate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50356] Re: [mg50342] Animate
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sun, 29 Aug 2004 03:54:04 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Steve,

Needs["Graphics`Animation`"]
Needs["Graphics`Colors`"]

First define one frame of the animation. We will show a circle of radius 1
in Gray and an ellipse with semiaxes of k and 1 in black.

frame[k_] :=
  Show[Graphics[
      {Gray,
        Circle[{0, 0}, 1],
        Black,
        Circle[{0, 0}, {k, 1}]}],
    AspectRatio -> Automatic,
    PlotRange -> {{-3.1, 3.1}, {-1.1, 1.1}},
    Background -> Linen,
    ImageSize -> 450]

It is almost always necesssary to explicitly specify the PlotRange in
animations to force all frames to be the same. Otherwise you can get jumping
between frames as different plot ranges are used. We can test a particular
frame with, for example...

frame[3];

When developing an animation I usually put that in the same cell with the
frame definition so I can make changes and evaluate results with one
evaluation. Then when I'm happy I remove it.

To make the animation...

Animate[frame[k], {k, 1, 3, 0.1}]
SelectionMove[EvaluationNotebook[], All, GeneratedCell]
FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5];
FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime -> 0.1,
      AnimationDirection -> ForwardBackward]}]

The last three statements will select the graphics cells, close them up, and
then start the animation. If you have DrawGraphics you can click them in
from the DrawGraphics palette.

In viewing the animations it will often be useful to use keyboard keys to
stop or control the animation.
1) The up and down arrow keys will advance in the backward and forward
directions by one frame at a time.
2) The left and right arrow keys will restart the animation in the backward
or forward directions.
3) The number keys will control the speed of the animation.
4) 'p' will pause or restart the animation.
5) 'c' will cause the animation to reverse at the endpoints.

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



From: Steve Gray [mailto:stevebg at adelphia.net]
To: mathgroup at smc.vnet.net

	Could someone show me how to use animate? As an example, suppose I want to
animate (which I
assume means to create a changing display in place, not scrolling), of an
ellipse going from a
circle to a highly eccentric one.
	It must be pretty easy, but I don't quite get it from reading the Help.
Thanks for any info.

Steve Gray





  • Prev by Date: Re: Opposite of ReadList[ ... ,Byte]?
  • Next by Date: Re: Re: Re: Publicon problems converting sample document to LaTeX
  • Previous by thread: Re: Animate
  • Next by thread: Timing anomaly