Re: Transition animation shows previous contents
Christiaan Hofman <[email protected]>
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sep 19, 2009, at 19:59, Christiaan Hofman wrote: > > On Sep 19, 2009, at 18:56, Matt Neuburg wrote: > >> On Fri, 11 Sep 2009 22:55:58 +0200, Christiaan Hofman <[email protected] >> > >> said: >>> I am having problems showing a transitions using CoreAnimation. >>> Basically, I am doing the following: >>> >>> 1. get a window containing a layer-hosting view (this is reused) >>> 2. set the animation action for "contents" of the relevant layer >>> to nil >>> 3. set the contents of the layer to an initial CGImage >>> 4. show the window >>> 5. set the animation action for "contents" to a prepared >>> CATransition >>> 6. set the "contents" of the layer to a final CGImage >>> >>> The problem is that the transition animation I get starts from the >>> final image was from the /previous/ animation (or an empty image the >>> first time), rather than starting with the initial image I set in >>> step >>> 3. >>> >>> I have tried various NSView and CALayer setNeedsDisplay and display >>> methods in various places, but so far without any success. >>> >>> Could anyone please tell me what I forget? >> >> I don't know what you are forgetting, because I can't see your >> code. But >> what you describe is *exactly* what I am doing in my app, as I >> described >> here: >> >> http://www.cocoabuilder.com/archive/message/cocoa/2009/9/15/245084 >> >> It's working fine (in 10.6 only; in 10.5 it crashes, as I have >> described >> elsewhere). m. >> > > What you describe is indeed exactly what I was doing, with the > difference that I only add the overlay when it is needed and > afterwards remove it. > > I have now got it to work by sending an extra setNeedsDisplay: to > the view. I don't know why that did not work earlier. And I also > don't understand why that would be necessary, I'd say that setting > the contents of the layer should be sufficient to notice that change > (even when it would not directly display it). > > Can you tell me or give a link as to what goes wrong on 10.5? > > Christiaan I actually don't get crashes on 10.5. However, even though I have it now working on 10.6, it does not work properly on 10.5. For some transitions (i.p. PageCurl) only half of the animation is shown. Sometimes it's the first half, sometimes the last. What could cause this, or is this perhaps a known bug on 10.5? Perhaps it's relevant that I'm animating a full screen window? Thanks, Christiaan