Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site watcgl.UUCP
Path: utzoo!watmath!water!watcgl!kdmoen
From: kdmoen@watcgl.UUCP (Doug Moen)
Newsgroups: net.micro.mac
Subject: Re: Animation
Message-ID: <2189@watcgl.UUCP>
Date: Fri, 12-Jul-85 01:43:49 EDT
Article-I.D.: watcgl.2189
Posted: Fri Jul 12 01:43:49 1985
Date-Received: Sat, 13-Jul-85 09:13:50 EDT
References: <1529@watdcsu.UUCP>
Reply-To: kdmoen@watcgl.UUCP (Doug Moen)
Distribution: net
Organization: U of Waterloo, Ontario
Lines: 32
Summary: 

>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