This HTML document is based on Mathematica Graphics: An Intensive Tutorial by Tom Wickham-Jones. It was adapted by Martin Kraus for non-commercial use.
Mathematica and MathLink are registered trademarks, and MathReader, MathSource and 3-Script are trademarks of Wolfram Research, Inc.
All other product names mentioned are trademarks of their producers.
Copyright 1992 by Wolfram Research, Inc.
All rights reserved. No part of this document may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of the copyright holder.
Animation of a sequence of graphical images gives an extra dimension to the data which is represented. Since this extra dimension is easily associated with time one way to use an animation is to demonstrate and investigate dynamical effects.
In Mathematica there is a number of ways to carry out animations. The simplest is provided by the Notebook front end to Mathematica. One generates a sequence of graphics, groups them and issues the appropriate command to start the animation. The other way, also available on front ends which do not support Notebooks, is to use the package Graphics`Animation`. This package defines useful commands which work on Notebook and non-Notebook front ends. Here I demonstrate using the animation package since it is more general.
<<Graphics`Animation` | load the animation package (it may be loaded) |
Animate[plot, {t, tmin, tmax}] | execute the graphics command plot for a sequence of values of t, and animate the resulting sequence of frames. |
ShowAnimation[{g1, g2, ... }] | produce an animation from a sequence of graphics objects |
This loads the package. | In[51]:= <<Graphics`Animation` |
This will generate a list of plots. DisplayFunction -> Identity is used to suppress the output of ParametricPlot3D. | In[52]:= Table[ParametricPlot3D[{{Sin[t], Cos[t],
Sin[a] Cos[t]}, {2 Sin[t], 2 Cos[t], Sin[a] Sin[2 t]},
{3 Sin[t], 3 Cos[t], -Sin[a] Sin[3 t]}}, {t, 0, 2 Pi},
DisplayFunction -> Identity, Axes -> False,
PlotRange -> {{-3, 3}, {-3, 3}, {-1, 1}}], {a, -Pi/2, Pi/2, 0.4}] Out[52]= {- Graphics3D -, - Graphics3D -, - Graphics3D -, - Graphics3D -, - Graphics3D -, - Graphics3D -, - Graphics3D -, - Graphics3D -} |
This shows the list of graphics in an animation. (In this HTML document you have to move the mouse into the picture to start the animation.) | In[53]:= ShowAnimation[%] |
To make full use of animation commands one needs more understanding of programming ideas and of the use of graphics options than have been covered so far. For this reason we leave the subject and cover it in more detail in a later chapter.
next page: 3 Graphics Output | back to table of contents |