2008 05 30Threaded Core Animation, Part Deux
(Just for curiosity)
Thanks to its threading, Core Animation graphically updates itself when calling [CATransaction commit]
, even if we're in the middle of heavy work on the main thread. But how do you update standard NS* controls ?
With … [CATransaction commit]
, of course :) We'll work here with NSProgressIndicator
. First, setup CA for that control. : [progress setWantsLayer:YES];
. Then, in the middle of your heavy work :
[CATransaction begin];
[progress setDoubleValue:newValue];
// No refresh happens unless we change something, so dummy change opacity
[[progress layer] setOpacity:1];
[CATransaction commit];
And you'll see your control update. It's pretty useless because the progress animates itself in the main thread's idle time and we're eating all of it, so there's no animation ! Just the progress … progressing.
And it doesn't seem to work on WebView.
Core Animation
- CocoaNav a Cocoa Class Browser using Core Animation
- Core Animation Starfield Core Animation sample using 3D layers
CoreAnimationStarfield.zip - Core Animation culling problems Don't setup a projection transform on the root layer !
- Threaded Core Animation while on the main thread, update your display with
[CATransaction commit]
CoreAnimationUpdateOnMainThread.zip - Core Animation Bindings binding Cocoa objects to
CALayer
s
Core Animation Bindings.zip - Core Animation Phantom Fade seeing ghosting ? Use two transaction to create and animate your objects
CoreAnimationPhantomFade.zip - Photoshop-like compositing with Core Animation
Blending Modes.zip