Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!portal!sv!daven From: daven@svc.portal.com Newsgroups: comp.sys.mac.programmer Subject: Re: Advice on icon animation wanted Message-ID: <1990Dec18.205338.6800@svc.portal.com> Date: 18 Dec 90 20:53:38 GMT References: <1116@babcock.cerc.wvu.wvnet.edu> Organization: Software Ventures Lines: 46 In article <1116@babcock.cerc.wvu.wvnet.edu> un020070@vaxa.wvnet.edu writes: > I am writing a program in which I am animating a lot of icons > at one time. I want to keep the animation smooth and clean, and > I also want to keep everything going at a constant rate regardless > of the processor speed, which means that I will somehow have to involve > the tick counter. I can think of two strategies for doing this: > > #1: Have the main program be constantly thinking about the animation > of the icons, but handle the actual animation during the video > horizontal retrace, when the processor is interrupted and when no > drawing is taking place on the screen. I could have a queue of > icons to be plotted, and plot just one during each retrace cycle. > (I have never written a routine for the horizontal retrace interrupt, > however, so this would mean doing some figuring.) Using a VBL task would probably produce the smoothest animation. However, there is an issue here I've always wondered about. With the non-color Mac's the VBL task was tied to the vertical blanking of the B&W monitor. With the color Mac's there is no gaurantee that this is so. I believe the Apple 13" color monitor refreshes it's screen at a faster rate than the 60Hz rate of the VBL task queue. So, could animation by means of a VBL task could cause some flicker on a color monitor? > #2: Handle the animation wholly in the main program, looking at > the tick counter to calculate the position of an icon at any > given time. Probably a simplier scheme to implement. You'd be free of the restrictions governing what a VBL task can and can't do. > If anyone has done anything like this, I would appreciate your guidance. > > Second question: How do you draw an icon in XOR? Is this possible > with the easy-to-use PlotIcon, or do I have to mess with some kind > of bit transfer? PlotIcon calls CopyBits with SrcCopy mode, so no it can't do SrcXor. You will have to call do the work of PlotIcon yourself, calling CopyBits with SrcXor mode. -- ------------------------------------------------------------------------------- Dave Newman | daven@svc.portal.com | AppleLink: D0025 Sofware Ventures Corp. | AOL: MicroPhone | CIS: 76004,2161 Berkeley, CA 94705 | WELL: tinman@well.sf.ca.us | (415) 644-3232