(* :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]
	]


