[comp.sys.mac.programmer] picts that animate by themselves!

volaski@acsu.buffalo.edu (12/08/89)

For those of you not familiar, there is a public domain desk accessory 
called Go-Go. This DA features an animated display of a Go-Go dancer. 
I figured that the animation was done with offscreen bitmaps.

When I checked its resource file, I made an incredible discovery. It 
contains a PICT resource that animates by itself! There I was in ResEdit 
with the PICT window opened, and the PICT was animating with no help from 
the DA.

My question is how was this done?

Maurice Volaski
University at Buffalo
Dept. of Physiology

chrisj@ut-emx.UUCP (Chris Johnson) (12/08/89)

In article <14357@eerie.acsu.Buffalo.EDU> volaski@acsu.buffalo.edu () writes:
>For those of you not familiar, there is a public domain desk accessory 
>called Go-Go. This DA features an animated display of a Go-Go dancer. 
>I figured that the animation was done with offscreen bitmaps.
>
>When I checked its resource file, I made an incredible discovery. It 
>contains a PICT resource that animates by itself! There I was in ResEdit 
>with the PICT window opened, and the PICT was animating with no help from 
>the DA.
>
>My question is how was this done?
>
>Maurice Volaski
>University at Buffalo
>Dept. of Physiology

My guess would be that the different frames of the picture were simply drawn
one after another, each one on top of and obliterating the one prior to it.
All these drawing operations were recorded in a single PICT resource and 
when the PICT is drawn the original cycle of "draw the first image, then the
second one on top of that, and so on" is merely repeated as QuickDraw plays 
back the same sequence of events it originally recorded.

This technique would result in (a) large PICT resources, and (b) timing 
dependent animation in so far as the animation's speed would vary directly
in accordance with the speed of the QuickDraw/video card combination in any
given Macintosh.

Such animations could be easily created by using something like SuperPaint
to create a series of frames (probably in the form of bitmaps), which would
then be converted into individual opaque objects, and stacked one on top of
the other, from first to last.  This pile of objects could then be selected,
copied, and later pasted into any resource file for use in dialogs, etc.

The animation would not, however, start over at the beginning when it reached
the final frame.  It would be up to the programmer to call DrawPicture (either
directly or indirectly) to restart the cycle.  If the cycle automatically
restarted itself in the PICT you saw, then I'm at a loss to suggest how it
was acheived.

'Hope this helps,
----Chris
----chrisj@emx.utexas.edu