Re: Spinshow Output to Animated GIF
- To: mathgroup at smc.vnet.net
- Subject: [mg30427] Re: Spinshow Output to Animated GIF
- From: Mark Fisher <mark at markfisher.net>
- Date: Fri, 17 Aug 2001 03:10:03 -0400 (EDT)
- References: <9ld1tq$2h0$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I wrote a function called SpinGraphics to deal with this problem: (* :Title: SpinGraphics *) (* :Author: Mark Fisher *) (* :Version: 1.0 August 2001 *) (* :Discussion: SpinGraphics is an enhanced version of SpinShow (from the standard package Graphics`Animation`.) SpinShow is useful for spinning SurfaceGraphcs and Graphics3D objects. Unfortunately, since SpinShow does not return the list of graphics objects it produces, it cannot be used as a front end to create, for example, animated GIFs, since the necessary input to Display or Export is absent. In addition, SpinShow does not behave properly with the option DisplayFunction -> Identity. The problem is to create a function that has all of the functionality of SpinShow, but that also (1) returns the list of graphics objects it created and (2) responds to the option DisplayFunction the way other graphics functions do. In principle, the behavior of SpinShow could be controlled through the options to ShowAnimation: RasterFunction and AnimationFunction. In fact the usage statements for these two options say they are used by SpinShow (among other functions). Notwithstanding this claim, they have no effect, since SpinShow does not pass them on to Animate. The defaults for these options are $RasterFunction and $AnimationFunction. The solution is to call SpinShow within a Block where $RasterFunction and $AnimationFunction have been given the appropriate values. *) Needs["Graphics`Animation`"] SpinGraphics::usage = "SpinGraphics works exactly like SpinShow with two exceptions. (1) SpinGraphics returns the list of graphics objects created. (SpinShow does not). (2) The option DisplayFunction -> Identity will suppress the display of the graphics. (SpinShow ignores the option DisplayFunction.) For usage information, refer to SpinShow." Options[SpinGraphics] = Append[Options[SpinShow], DisplayFunction :> $DisplayFunction] SpinGraphics[theGraphic_, opts___?OptionQ] := Block[{$AnimationFunction = Identity, $RasterFunction = DisplayFunction /. {opts} /. Options[SpinGraphics]}, SpinShow[theGraphic, opts] ] (It can be downloaded from http://www.markfisher.net/~mefisher/mma/mathematica.html if it doesn't reproduce well here.) --Mark Omega Consulting wrote: > > At 02:40 AM 8/11/2001, Patrick Spicer wrote: > >Has anyone ever directed a SpinShow output to an animated GIF? I can > >generate a SpinShow array and create an animated GIF, but the wedding > >of the two is beyond me. Thanks in advance for any tips. > > > >Best Regards, > > > >Pat > > To create an animated GIF you need a list of Graphics expressions, but the > default output of SpinShow is not a list of Graphics. I'm not sure what the > purpose of this is, except perhaps to save memory. (All output is stored in > memory so that it can be referenced with %n.) To make the output a list of > graphics, do > > SetOptions[ShowAnimation, RasterFunction :> $AnimationDisplayFunction] > > This works because SpinShow calls ShowAnimation.