Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Controlling display of frames in a movie

  • To: mathgroup at
  • Subject: [mg73406] Re: Controlling display of frames in a movie
  • From: "dimitris" <dimmechan at>
  • Date: Thu, 15 Feb 2007 05:08:11 -0500 (EST)
  • References: <equnlk$ih5$>

Below it is a very instructive message by David Park which appeared in
private communication with him
a long time ago.
Since it well-written and informative I don't make any modifications.
I think you will find it very useful for your needs.

(*My original query was about delta sequences and animation of them*)

(*reply od David Park*)

Here is your animation.


delta[n_][x_] := n/(Sqrt[Pi]/E^((-n^2)*x^2))

frame[n_] :=
    Plot[delta[n][x], {x, -2, 2},
      PlotRange -> {-0.1, 6.1},
      Frame -> True,
      PlotLabel ->
        SequenceForm[delta["n"][x], ", n =",
          NumberForm[n, {4, 2}, NumberPadding -> {" ", "0"}]],
      ImageSize -> {800, 500}];

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

I usually like to keep the 'parameters' separate from the 'variable'
definition of delta, although in this case it wouldn't matter. (The
brackets are called 'subvalues'.)

In making animations I like to define a frame function that plots one
of the animation and then use the Animate statement (from
Graphics`Animation`) to actually carry out the animation. Then I can
individual frames and make changes before doing the entire animation.

In making an animation such as this, it is ALWAYS necessary to
specific PlotRange. You can't use All. This is because you must have
same PlotRange for all frames and Mathematica usually tries to pick
'most interesting part', and All will not be the same for all frames.

When putting n on the plot, it is usually necessary to use NumberForm
with a
NumberPadding specification so the number will always fit into the
space. Otherwise you will get a jumping effect for different frames.

In the Animate statement I have added commands that select the
frames, close them up and start the animation. For those who have
DrawGraphics these commands can be pasted in from the DrawGraphics

In viewing an animation like this it is useful to know that you can
keyboard to step through the animation. This is often the best way to
an animation.

1) The up/down arrow keys will allow you to advance one frame at a
2) The right/left arrow keys will put in animation into the forward or
backward direction.
3) The number keys will control the speed of the animation.
4) 'p' will pause and restart the animation.
5) 'c' will restart the animation in the forward-backward mode.

(*end of David Park's message*)

Best Regards

=CF/=C7 Alain Cochard =DD=E3=F1=E1=F8=E5:
> Hello.  I'm trying to generate a kind of animation for which I control
> the display of the next frame.  In other words I'm trying to find the
> Mathematica equivalent to the following script:
>    x=[1 2 3] ;
>    for n=1:4
>      f = x.^n ;
>      plot(x,f)
>      pause
>    end
> 'x' is the vector {1,2,3}; 'f' is another vector of same length (here
> obtained from x).  'plot(x,f)' simply plots f as a function of x, and
> then the 'pause' statement causes the loop to stop and wait for the
> user to strike any key before continuing, hence before plotting the
> next curve.
> The natural way would seem to be using ShowAnimation, but I didn't
> find a way to control the occurrence of the next frame.
> Unless I'm missing something, using the basic (List)Plot command does
> not seem to be appropriate in view of the time it takes for the window
> to pop up --at least in the text based environment-- especially for
> use on a remote computer.
> Besides, I still wouldn't know how to close a window and initiate the
> next.
> Any hint?
> Thanks in advance,
> Alain

  • Prev by Date: Re: RandomArray from user defined distribution?
  • Next by Date: Dotted Lines at Discontinuities 2
  • Previous by thread: Re: Controlling display of frames in a movie
  • Next by thread: Removing constant multiples from polynomials