Parmanoir

Threaded Core Animation : sample code

Another Core Animation sample, serving as sample code for Threaded Core Animation.

Image:CoreAnimationUpdateOnMainThread.jpg

This will be a bit clearer than just text and shows how Core Animation can update itself even when you're busy on the main thread, using [CATransaction commit].

The transitions happen thanks to [CATransaction setValue:[NSNumber numberWithFloat:0.0] forKey:kCATransactionAnimationDuration] which changes the default speed of interpolation to a new value. When you set a new value of a layer attribute, CA will interpolate from its current value to the new one with a set delay. If you want to make a transition, you can't go around setting your start value and then your end value : CA will start interpolating from current to start, but then you'll be setting a new value, the end one, right when CA has just started interpolating !

kCATransactionAnimationDuration lets us get rid of that delay while setting our start value, CA can then interpolate from our transition start value to the end value.

Image:iconZip.png CoreAnimationUpdateOnMainThread.zip

Core Animation

Jonathan Wight
2008 05 24

Hey there, your blog is awesome. I love the CoreAnimation postings especially. However, for some reason NNW keeps thinking your site is constantly updating the old blog posts and they keep appearing in my feed. I'm wondering if the problem is your end and if you'd take to look at fixing it?

Cheers.

Patrick Geiller
2008 05 24

That's because they are updated :) I use a template at the bottom of the Core Animation posts, when I add a new post I'll update the template with it and the old posts will get the new version of the template as well. I didn't realize this would mark the old posts as new. I'll look into it.


Follow me on Twitter
Planet Cocoa
Cocoa.fr

2011 02 22Distance field
2010 07 202Binding through NSApp
2010 05 122Forwarding invocations
2010 02 272Core Image black fringes
2010 02 21Quickest Way to Shell
2010 02 08Who's calling ?
2009 09 2138 ways to use Blocks in Snow Leopard
2009 08 182Bracket Mess
2009 08 124Taming JavascriptCore within and without WebView
2009 04 15Debugging with Activity Monitor
2009 03 25How Core Image Color Tracking works
2009 03 1510Custom NSThemeFrame
2009 03 10Which framework is running ?
2009 03 074CoreUI can paint pretty big
2009 02 18Localization with functions
2009 01 30Did you forget to nest alloc and init?
2009 01 16JSCocoa on the iPhone
2009 01 11Mixing WebView and JavascriptCore
2009 01 09Badge overflow
2009 01 09Find your Garbage Collection leaks with Instruments

Powered by MediaWiki