Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: "single-shot" autorun in Manipulate[] object

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101298] Re: [mg101276] "single-shot" autorun in Manipulate[] object
  • From: "David Park" <djmpark at comcast.net>
  • Date: Tue, 30 Jun 2009 06:35:29 -0400 (EDT)
  • References: <24121010.1246246648487.JavaMail.root@n11>

Leo,

The AutorunSequencing option in Manipulate seems ill designed to me.

One method to implement custom sequencing is to use a single time variable
and a Piecewise function to control the actual variables. Here is an
Animation that shows just the A and B values:

Module[
 {amin = 0, amax = 1, bmin = 0, bmax = 1,
  abfunc},
 abfunc[t_] :=
  Piecewise[
   {{{amin, bmin}, t <= 5},
    {{amin + (amax - amin) (t - 5)/20, bmin}, 5 < t <= 25},
    {{amax, bmin}, 25 < t <= 30},
    {{amax, bmin + (bmax - bmin) (t - 30)/20}, 30 < t <= 50},
    {{amax, bmax}, 50 < t <= 55},
    {{amax - (amax - amin) (t - 55)/20, bmax}, 55 < t <= 75},
    {{amin, bmax}, 75 < t <= 80}}];
 Animate[NumberForm[abfunc[t], {3, 2}], {t, 0, 80}, 
  AnimationRate -> 80/10, AnimationRunning -> False, 
  AppearanceElements -> None]
 ]

The following uses an Animator to simply start and stop the animation.

Module[
 {amin = 0, amax = 1, bmin = 0, bmax = 1,
  abfunc, t},
 abfunc[t_] :=
  Piecewise[
   {{{amin, bmin}, t <= 5},
    {{amin + (amax - amin) (t - 5)/20, bmin}, 5 < t <= 25},
    {{amax, bmin}, 25 < t <= 30},
    {{amax, bmin + (bmax - bmin) (t - 30)/20}, 30 < t <= 50},
    {{amax, bmax}, 50 < t <= 55},
    {{amax - (amax - amin) (t - 55)/20, bmax}, 55 < t <= 75},
    {{amin, bmax}, 75 < t <= 80}}];
 Column[
  {Animator[Dynamic[t], {0, 80, .1},
    AnimationRate -> 80/10,
    AnimationRunning -> False,
    AppearanceElements -> {"PlayPauseButton"}],
   Dynamic@NumberForm[abfunc[t], {3, 2}]}]
 ]

I usually put a 'pause time' between each 'action' in such animations. It
makes it much easier for the viewer to distinguish the steps.

As is often the case, it is easier to work outside Manipulate and set up
custom dynamic displays.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  




From: dnquark [mailto:dnquark at gmail.com] 

I am trying to create an animation by exporting a Manipulate[]
object.  I have two controls, A and B.  I need to have A go from Amin
to Amax, then (with A=Amax) B go from Bmin to Bmax, then (optionally)
A go from Amax to Amin.

Using AutorunSequencing option I can only make A cycle from Amin to
Amax back to Amin, and then with A=Amin B cycles from Bmin to Bmax and
back.  Is there a way to control it in a finer manner such as desribed
above?  Or do I have to use ListAnimate[]?

Thanks,
--Leo




  • Prev by Date: Re: The Principle "Everything is an expression"
  • Next by Date: Re: Re: Wolfram | Alpha: Acres per square mile? (oddities)
  • Previous by thread: "single-shot" autorun in Manipulate[] object
  • Next by thread: Is Orange translucent?