Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: Advice on icon animation wanted Message-ID: <47444@apple.Apple.COM> Date: 17 Dec 90 22:23:54 GMT References: <1116@babcock.cerc.wvu.wvnet.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 38 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.) You also can't draw from an interrupt routine because the heap may not be consistent, and QuickDraw uses the Memory Manager for regions. >#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. This is probably the safer route. Your animation won't run any faster than at the tick rate you set, but it could run slower since you can't control how long GetNextEvent() will take, especially when running under MultiFinder. >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? Well, you should just be able to set the transfer mode to XOR and do the plot. steve -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Steve Christensen | Apple Computer, Inc. | Disclaimer: | 20525 Mariani Ave, MS-81CS | the above may be stevec@apple.com | Cupertino, CA 95014 | a lie...or not.