Core Animation and Live Resize Problems
Core Animation and Live Resize Problems
- Subject: Core Animation and Live Resize Problems
- From: Milen Dzhumerov <email@hidden>
- Date: Wed, 18 Jun 2008 16:20:42 +0100
Hi all,
I've hit a very nasty problem when using Core Animation and doing a
live resize. Even though I've disabled animations, Core Animation
messes up the layer when resized for a couple of frames. So, here's
what I think happens:
- I resize several sublayers and reposition them
- Since the sublayers contain text and have not been redrawn yet, CA
immediatelly "scales" the previous contents and the layers look awful
- Probable a hundred miliseconds or less after that, CA catches up and
redraws the layers and all the layers look good again.
But the user-experience is totally ruined. I've a screen-capped the
problem:
- Doing layout of the sublayers during live-resize: http://www.doc.ic.ac.uk/~md207/ca/PixelatedResize.mov
-- note how CA scales the content to the new frame which looks very
ugly
- Doing layout only at the end of live-resize: http://www.doc.ic.ac.uk/~md207/ca/DelayedResize.mov
-- in this case, no ill-effects can be noticed
I've also recorded how scrolling is instantaneous and results in no
visual artifacts (I guess this is due to the fact that the layers are
not redrawn but only moved).
The basic algorithm for doing the layout which I use is:
- Start a new CATransaction
- Disable all actions
- Resize all layers to the required size
- Call setNeedsRedraw on the visible ones and schedule the same for
the others a little bit later (I've tried it both ways - redrawing all
and only visible and there is no difference to the live resize behavior)
- Commit the transaction
Any help / hints are greatly appreciated,
M
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden