MathGroup Archive 1997

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

Search the Archive

Re: automatic animations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8376] Re: automatic animations
  • From: "Theodore W. Gray" <theodore>
  • Date: Tue, 26 Aug 1997 20:41:11 -0400
  • Organization: Wolfram Research, Inc.
  • Sender: owner-wri-mathgroup at wolfram.com

The following function will select all the output from an evaluation,
close the group it is in (so only the first graphic is visible),
and then start animating it.

StartAnimation[t___] := (
SelectionMove[EvaluationNotebook[], All, GeneratedCell];
FrontEndExecute[{FrontEndToken[EvaluationNotebook[],
    "SelectionCloseAllGroups"]}];
SelectionAnimate[EvaluationNotebook[], t];
)

The optional parameter t specifies for how many seconds the animation
should be run.  If it's not there, then the animation runs forever
(until the user clicks somewhere).

StartAnimation[] needs to be included in the same cell as the command
that produced the graphics output, otherwise it won't work.  For
example, put these two lines in the same cell and you'll get an
animating graphic:

Plot[Sin[n x], {x, 0, 2Pi}], {n, 1, 2, 0.2}];
StartAnimation[]

You can read about all these sorts of functions in my new book,
The Beginner's Guide to Mathematica V3, available at:

    http://www.mathware.com/BeginnersGuide

Theodore W. Gray


  • Prev by Date: "PlotField2D'? (In between PlotField and PlotField3D?)
  • Next by Date: calculate not in the decimalsystem
  • Previous by thread: automatic animations
  • Next by thread: AW: method used in NonlinearFit