Re: Smooth animation
Re: Smooth animation
- Subject: Re: Smooth animation
- From: Simon Stapleton <email@hidden>
- Date: Thu, 12 Dec 2002 13:36:55 +0100
Subject: Re: Smooth animation
Cc: email@hidden
To: email@hidden
From: arekkusu <email@hidden>
On Tuesday, December 10, 2002, at 11:03 AM, <email@hidden>
wrote:
I am working on a quite simple screen saver which print a text on the
screen and translate it in the limits os the screen. The process used
to move it is very simple: every 1/50 of a second, I redraw the text
one pixel on the left of its previous position. The problem is that
this kind of animation is choppy. What could I do to make it smoother?
Well, drawing text in Cocoa is relatively slow, for reasons that stem
from the way Quartz renders paths. This part, at least, has been
discussed ad nauseum on the list, and I'd rather not open that can of
worms again... Needless to say, you could trawl the list archives to
find out why.
However, compositing images is way fast.
So, what I'd suggest is drawing the text into an NSImage and keeping
that cached, then compositing that into your screensaver view. Should
speed things up no end.
If you need the text to change (say, for example, you're displaying a
clock and need it to change text every second), simply recreate the
image at the point the text needs to change.
Hope that helps
Simon
--
PGP Key Id : 0x50D0698D
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.