[net.micro.mac] Animation

gross@watdcsu.UUCP (Evan Gross [Sys Des]) (07/12/85)

Howdy,
I am trying to do some simple animation of an object around a window. Doing
this the obvious way (erase old, plot new) leads to a fairly ugly and flashy
display. If anyone has any insight on the real way to do flicker-free
animation using quickdraw, please let me know. Installing the motion routine
into the vertical blanking queue is a solution, but not one that I want to
use.
Thanks,
Evan Gross    watmath!watdcsu!gross

kdmoen@watcgl.UUCP (Doug Moen) (07/12/85)

>I am trying to do some simple animation of an object around a window. Doing
>this the obvious way (erase old, plot new) leads to a fairly ugly and flashy
>display. If anyone has any insight on the real way to do flicker-free
>animation using quickdraw, please let me know. Installing the motion routine
>into the vertical blanking queue is a solution, but not one that I want to
>use.

Currently my technique looks like this:
	/*
	 * Leave the image undisturbed for one full frame time, and
	 * wait for the beginning of the next vertical retrace:
	 */
	ticks = TickCount() + 2;
	while (ticks != TickCount())
		continue;
	/* erase object and redraw it in new position */

This cuts down flicker, but doesn't entirely eliminate it, since I
generally don't manage to finish erasing and redrawing before the
next video frame begins to be displayed.

Sometime in the future, I'm planning to try a new technique:
Allocate a window-sized bitmap, and each time the window changes,
	draw the new scene into the offscreen bitmap
	copy the bitmap into the window

Obviously this can be optimized for the case of a single moving object
by only redrawing the smallest rectangle enclosing the old and new
positions.
-- 
Doug Moen (watmath!watcgl!kdmoen)
University of Waterloo Computer Graphics Lab