I guess this problem is really about performance, but I’m trying to get a rough sanity check as well.
I display a map view (although whether it’s a map view or something else could change, and I hope is immaterial), and on top of the map view I have a transparent view subclass. In this view’s drawRect: method I draw on the view using core graphics calls; circles, gradients, etc. What I’m drawing isn’t super complicated, but it’s not trivial. Then, I have an NSTimer that fires every X seconds, calling [myview setNeedsDisplay] each time, and what it draws changes at every time step (circles get bigger, colors and gradients change, etc).
Is this the right way to go for doing this type of vector-based animation? I’m getting very low performance X seems to be effectively no better than about 0.25. I’d like 0.05 or smaller. Is there some other way to do things? I have the feeling that I’m either strategically way off, or this is futile. I can do things with CoreAnimation – for example grow and shrink pictures and such, and it’s very fast (why?), but it doesn’t give me the control I want…
MORE INFO: reducing drawing complexity (fewer circles, gradients, so forth) does speed up drawing significantly, but I have to draw almost nothing to get smooth animation. Is this NSTimer strategy even the right way to go? Is there some other way to do animate vector drawing?
Is it possible that you could leverage some Core Animation to perform some/all of the animations? For example, rather than redrawing a circle that’s changing in size, just render it as one size and animate a scale transform on it? If you only have a couple of objects animating, you could try adding each as a sublayer of your view, and then batching together some Core Animation animations rather than attempting to redraw everything manually. If you look at the blue circles in Apple’s Maps app, when they radiate outwards (while getting a fix), you can see that they start out sharp and get a bit blurry as then grow. It works fine for the purpose, and I suspect they are just scaling a small circular image. Would that sort of thing work for your app?
It’s hard to say what may improve performance without a better idea of what animations you’re performing. Is that something you could elaborate upon?
(I would have posted this as a comment, but I am just shy of the required reputation for that)