Re: Core Animation: How to swicth off all implicit animations?
Re: Core Animation: How to swicth off all implicit animations?
- Subject: Re: Core Animation: How to swicth off all implicit animations?
- From: Matt Long <email@hidden>
- Date: Sat, 22 Nov 2008 22:46:12 -0700
Ok. This is interesting. I wrote a little code to see what might be
going on.
Whatever was true when the AppKit release notes were published has
either changed or the term "supported" has a loose definition. Thanks
for pointing that out, Mike, but I don't think it's accurate or I've
misunderstood what you've quoted. I have tried to use QCViews in layer-
backed mode before and it doesn't seem to work there. However, I've
added layers of several different types (CALayer, CATextLayer,
QTMovieLayer) as sublayers to the WebView's root layer and they all
seem to work as expected. Here are things I've observed:
- When I add a layer, that layer's contents always displays in front
of the web view content no matter the zPosition
- When I mouse over the links in the web view, the cursor changes to a
hand cursor and I can still click them and go to a new page no matter
whether they are obscured by the fronting layer or not.
- I added a QTMovieLayer and played back the movie it contains having
set the layer's opacity to 0.25 and I can surf using the web view
while the movie plays at 25% opacity in real time. It's kind of weird
(but cool at the same time ;-).
The issue that Wolf is having, though, has to do with the fact that
there is a default action associated with the layer contents. Here are
some additional observations:
- The page content doesn't display until it is loaded at which point
it fades in.
- When scrolling the page, you can see the fade effect when the
content view changes--suggesting that it is the contents field of the
layer that is doing the rendering
- It isn't obvious which layer the web content is in. I have tried to
call
[[webView] layer] setDelegate:self]
and then implement - (id<CAAction>)actionForLayer:(CALayer *)layer
forKey :(NSString *)key;
I get the following output using NSLog(@"%@: %@", layer, key); in
actionForLayer :
2008-11-22 22:15:19.557 LayerBackedWebView[14958:10b]
_NSViewBackingLayer(0x154cf90) p={0, 0} b=(0,0,648,534)
superlayer=0x0: actions
2008-11-22 22:15:20.267 LayerBackedWebView[14958:10b]
_NSViewBackingLayer(0x154cf90) p={0, 0} b=(0,0,648,534)
superlayer=0x0: position
2008-11-22 22:15:20.277 LayerBackedWebView[14958:10b]
_NSViewBackingLayer(0x154cf90) p={324, 267} b=(0,0,648,534)
superlayer=0x0: onOrderIn
I've tried to override the action for the three items that show up
there--actions, position, and onOrderIn, however, there is still a
fade. Here is the code I used to try to override:
[[webView layer] addSublayer:layer];
[[webView layer] setDelegate:self];
NSMutableDictionary *actions = [NSMutableDictionary
dictionaryWithDictionary:[[webView layer] actions]];
[actions setObject:[NSNull null] forKey:@"actions"];
[actions setObject:[NSNull null] forKey:@"position"];
[actions setObject:[NSNull null] forKey:@"onOrderIn"];
[[webView layer] setActions:actions];
Still no dice.
Finally, the WebView implements the NSAnimatablePropertyContainer
protocol which means you should be able to set the animations with a
dictionary on the web view itself like this:
[webView setAnimations:actions];
This also does not work. Ok. This message is getting too long. Sorry
about that. It's very interesting problem, but I'm still uncertain
what the answer may be. Mike's other suggestions sound like good ideas
worth trying.
-Matt
On Nov 22, 2008, at 7:11 PM, Michael Ash wrote:
I don't believe your approach is viable. WebViews aren't supported in
layer-backed mode. This is poorly documented, and the only place I
could find it mentioned was in the AppKit release notes:
http://developer.apple.com/releasenotes/Cocoa/AppKit.html
It states: "Most of the standard views and controls that AppKit and
Mac OS X's other Cocoa frameworks provide are able to function in
layer-backed mode in Leopard, with the exception of certain
specialized views such as WebKit WebViews and Quartz Composer QCViews,
whose use in layer-backed mode is not presently supported."
So you're out of luck there...
_______________________________________________
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