<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>I like to play with colors and write code that draws stuff. I eat a lot of cookies. Sometimes I am funny.</description><title>tumbljack</title><generator>Tumblr (3.0; @tumbljack)</generator><link>http://tumbljack.com/</link><item><title>Cloth Simulation</title><description>&lt;a href="http:// http//www.andrew-hoyer.com/experiments/cloth"&gt;Cloth Simulation&lt;/a&gt;</description><link>http://tumbljack.com/post/425749766</link><guid>http://tumbljack.com/post/425749766</guid><pubDate>Wed, 03 Mar 2010 22:15:02 -0800</pubDate></item><item><title>My Top 5 Artists (Week Ending 2010-2-28)</title><description>&lt;a href="http://www.last.fm/user/joericioppo/charts?charttype=weekly&amp;date_to=1267358400"&gt;My Top 5 Artists (Week Ending 2010-2-28)&lt;/a&gt;: &lt;ol&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Keller+Williams"&gt;Keller Williams (67)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/+noredirect/David%2BGrisman%2B%2526%2BJerry%2BGarcia"&gt;David Grisman &amp; Jerry Garcia (13)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Grateful+Dead"&gt;Grateful Dead (12)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Alex+de+Grassi"&gt;Alex de Grassi (4)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Michael+Hedges"&gt;Michael Hedges (4)&lt;/a&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Imported from &lt;a rel="nofollow" target="_blank" href="http://joelaz.com/post/23488847/last-fm-tumblr-weekly-top-artists"&gt;Last.fm Tumblr&lt;/a&gt; by &lt;a rel="nofollow" target="_blank" href="http://joelaz.com"&gt;JoeLaz&lt;/a&gt;&lt;/p&gt;</description><link>http://tumbljack.com/post/420699692</link><guid>http://tumbljack.com/post/420699692</guid><pubDate>Mon, 01 Mar 2010 15:24:38 -0800</pubDate></item><item><title>My Top 5 Artists (Week Ending 2010-2-21)</title><description>&lt;a href="http://www.last.fm/user/joericioppo/charts?charttype=weekly&amp;date_to=1266753600"&gt;My Top 5 Artists (Week Ending 2010-2-21)&lt;/a&gt;: &lt;ol&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/+noredirect/David%2BGrisman%2B%2526%2BJerry%2BGarcia"&gt;David Grisman &amp; Jerry Garcia (11)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Old%2B%2526%2BIn%2Bthe%2BWay"&gt;Old &amp; In the Way (10)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Grateful+Dead"&gt;Grateful Dead (3)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Elliott+Smith"&gt;Elliott Smith (2)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Fionn+Regan"&gt;Fionn Regan (2)&lt;/a&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Imported from &lt;a rel="nofollow" target="_blank" href="http://joelaz.com/post/23488847/last-fm-tumblr-weekly-top-artists"&gt;Last.fm Tumblr&lt;/a&gt; by &lt;a rel="nofollow" target="_blank" href="http://joelaz.com"&gt;JoeLaz&lt;/a&gt;&lt;/p&gt;</description><link>http://tumbljack.com/post/409486285</link><guid>http://tumbljack.com/post/409486285</guid><pubDate>Wed, 24 Feb 2010 11:22:49 -0800</pubDate></item><item><title>My Top 5 Artists (Week Ending 2010-2-7)</title><description>&lt;a href="http://www.last.fm/user/joericioppo/charts?charttype=weekly&amp;date_to=1265544000"&gt;My Top 5 Artists (Week Ending 2010-2-7)&lt;/a&gt;: &lt;ol&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Keller+Williams"&gt;Keller Williams (60)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Grateful+Dead"&gt;Grateful Dead (37)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/+noredirect/David%2BGrisman%2B%2526%2BJerry%2BGarcia"&gt;David Grisman &amp; Jerry Garcia (13)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Johnny+Cash"&gt;Johnny Cash (7)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a rel="nofollow" target="_blank" href="http://www.last.fm/music/Sound+Tribe+Sector+9"&gt;Sound Tribe Sector 9 (6)&lt;/a&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Imported from &lt;a rel="nofollow" target="_blank" href="http://joelaz.com/post/23488847/last-fm-tumblr-weekly-top-artists"&gt;Last.fm Tumblr&lt;/a&gt; by &lt;a rel="nofollow" target="_blank" href="http://joelaz.com"&gt;JoeLaz&lt;/a&gt;&lt;/p&gt;</description><link>http://tumbljack.com/post/383412238</link><guid>http://tumbljack.com/post/383412238</guid><pubDate>Thu, 11 Feb 2010 00:06:19 -0800</pubDate></item><item><title>Git Branching Model</title><description>&lt;a href="http://nvie.com/archives/323?utm_source=Twitter&amp;utm_medium=Tweet&amp;utm_campaign=branching-model"&gt;Git Branching Model&lt;/a&gt;: &lt;p&gt;by &lt;a href="https://twitter.com/nvie"&gt;@nvie&lt;/a&gt;&lt;/p&gt;</description><link>http://tumbljack.com/post/337908107</link><guid>http://tumbljack.com/post/337908107</guid><pubDate>Sat, 16 Jan 2010 12:49:35 -0800</pubDate></item><item><title>-</title><description>&lt;p&gt;One of my favorite aspects of software is that it often pushes those who don’t believe in themselves as artists to become just that.&lt;/p&gt;</description><link>http://tumbljack.com/post/333616307</link><guid>http://tumbljack.com/post/333616307</guid><pubDate>Wed, 13 Jan 2010 21:20:33 -0800</pubDate></item><item><title>TDBadgeCell</title><description>&lt;a href="http://github.com/tmdvs/TDBadgedCell"&gt;TDBadgeCell&lt;/a&gt;: &lt;p&gt;from &lt;a href="http://twitter.com/tmdvs"&gt;@tmdvs&lt;/a&gt;&lt;/p&gt;</description><link>http://tumbljack.com/post/324835765</link><guid>http://tumbljack.com/post/324835765</guid><pubDate>Sat, 09 Jan 2010 01:03:19 -0800</pubDate></item><item><title>-</title><description>&lt;p&gt;Well designed abstractions are always good. Poorly designed anything always sucks.&lt;/p&gt;</description><link>http://tumbljack.com/post/324805810</link><guid>http://tumbljack.com/post/324805810</guid><pubDate>Sat, 09 Jan 2010 00:35:11 -0800</pubDate></item><item><title>The West</title><description>&lt;p&gt;This PBS series about the expansion of America into the West is the most powerful, immersive and emotive storytelling that I have ever experienced, and has changed forever my perception of the world, history and most of all humanity. Highly recommended.&lt;/p&gt;
&lt;p&gt;&lt;a target="_self" href="http://www.netflix.com/WiMovie/Ken_Burns_The_West/60035407?strackid=5fd4b43c4fc77dca_8_srl&amp;strkid=1995798261_8_0&amp;trkid=438381"&gt;Netflix&lt;/a&gt; | &lt;a target="_self" href="http://www.amazon.com/Ken-Burns-Presents-Peter-Coyote/dp/B000BITUFC/ref=sr_1_1?ie=UTF8&amp;s=dvd&amp;qid=1261712407&amp;sr=8-1"&gt;Amazon&lt;/a&gt;&lt;/p&gt;</description><link>http://tumbljack.com/post/299409432</link><guid>http://tumbljack.com/post/299409432</guid><pubDate>Thu, 24 Dec 2009 19:47:52 -0800</pubDate></item><item><title>Steve Kimock  2000-07-15  (15min)</title><description>&lt;embed type="application/x-shockwave-flash" src="http://tumbljack.com/swf/audio_player.swf?audio_file=http://www.tumblr.com/audio_file/287186012/tumblr_kusaod2W3T1qzzqhd&amp;color=FFFFFF" height="27" width="207" quality="best"&gt;&lt;/embed&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a target="_self" href="http://www.archive.org/details/skb2000-07-15-c61dae.shnf"&gt;Steve Kimock  2000-07-15  (15min)&lt;/a&gt;&lt;/p&gt;</description><link>http://tumbljack.com/post/287186012</link><guid>http://tumbljack.com/post/287186012</guid><pubDate>Wed, 16 Dec 2009 22:43:25 -0800</pubDate></item><item><title>Oh snap..

bradandthebrain:

I like the look of this.
Shows for...</title><description>&lt;img src="http://26.media.tumblr.com/tumblr_kunz11a0As1qz4jowo1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Oh snap..&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.halfapixelshort.com/post/283705210/i-like-the-look-of-this-shows-for-iphone-keep"&gt;bradandthebrain&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I like the look of this.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://shows-app.com/"&gt;Shows for iPhone ~ Keep tabs on your favorite touring artists&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://tumbljack.com/post/284172593</link><guid>http://tumbljack.com/post/284172593</guid><pubDate>Mon, 14 Dec 2009 20:29:05 -0800</pubDate></item><item><title>Keller Williams 2001-11-09</title><description>&lt;embed type="application/x-shockwave-flash" src="http://tumbljack.com/swf/audio_player.swf?audio_file=http://www.tumblr.com/audio_file/281346829/tumblr_kukwoiRGya1qzzqhd&amp;color=FFFFFF" height="27" width="207" quality="best"&gt;&lt;/embed&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a target="_self" href="http://www.archive.org/details/kw2001-11-09.sbd.shnf"&gt;Keller Williams 2001-11-09&lt;/a&gt;&lt;/p&gt;</description><link>http://tumbljack.com/post/281346829</link><guid>http://tumbljack.com/post/281346829</guid><pubDate>Sat, 12 Dec 2009 22:57:53 -0800</pubDate></item><item><title>Metaphorically Speaking</title><description>&lt;p&gt;I remember reading somewhere that a graphics context is liken to the pen and the paper, both the tool that you use to express and destination of that expression. I have always thought of it more as a credit card that you just pull out whenever you need anything. But, I have realized that it is in fact a magic wand that you hold in your hand while carefully reciting ancient incantations.&lt;/p&gt;</description><link>http://tumbljack.com/post/281314125</link><guid>http://tumbljack.com/post/281314125</guid><pubDate>Sat, 12 Dec 2009 22:28:28 -0800</pubDate></item><item><title>Chatrbox</title><description>&lt;p&gt;My buddy &lt;a target="_self" href="http://twitter.com/elliottkember"&gt;@elliottkember&lt;/a&gt; had a ton of hits today on his awesome post about getting started. &lt;a target="_self" href="http://j.mp/youllnevergetwhatyouwant"&gt;&lt;a href="http://j.mp/youllnevergetwhatyouwant"&gt;http://j.mp/youllnevergetwhatyouwant&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you thought it was cool, check out the UI on Chatrbox, a chat application he did recently. I particularly like the way the textfield footer and minimal custom scroller make the content a comfortable part of the application, as apposed to fighting the constraints of the window, which is how most websites feel.&lt;/p&gt;
&lt;p&gt;You have to login with twitter to check it out, but I personally feel that it’s worth it.&lt;/p&gt;
&lt;p&gt;&lt;a target="_self" href="http://chatrboxapp.com"&gt;&lt;a href="http://chatrboxapp.com"&gt;http://chatrboxapp.com&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://tumbljack.com/post/263241994</link><guid>http://tumbljack.com/post/263241994</guid><pubDate>Mon, 30 Nov 2009 00:08:00 -0800</pubDate></item><item><title>To 1e100f And Beyond with CAReplicatorLayer</title><description>&lt;p&gt;&lt;a target="_blank" href="http://developer.apple.com/Mac/library/documentation/GraphicsImaging/Reference/CAReplicatorLayer_class/Reference/Reference.html"&gt;CAReplicatorLayer&lt;/a&gt; is a powerful new class available in the Core Animation rendering and compositing framework. It’s a special hosting layer that can generate a potentially infinite number of copies, or instances, of its sublayer. Well, almost infinite.&lt;/p&gt;
&lt;p&gt;A common feature of modern 3D rendering applications is the ability to replicate an object or artifact over a plane or given surface, resulting in complex scalable patterns that can resemble anything from textiles and woodgrain to skin and even hair.&lt;/p&gt;
&lt;p&gt;CAReplicatorLayer packs a lot of this functionality into just a few lines of code. Setting one up would look something like this..&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;CAReplicatorLayer *replicatorLayer = [CAReplicatorLayer layer];&lt;/p&gt;
&lt;p&gt;replicatorLayer.instanceCount = 42;&lt;/p&gt;
&lt;p&gt;replicatorLayer.instanceTransform = awesomeTransform;     //This was in the oven&lt;/p&gt;
&lt;p&gt;replicatorLayer.instanceDelay = 0.6;&lt;/p&gt;
&lt;p&gt;[replicatorLayer addSublayer:sublayer];   //This too&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;The transform is used to spread the layer instances across space, with transforms being multiplied for each new instance. A simple translation quickly creates a row of layers.&lt;/p&gt;
&lt;p&gt;One replicator layer can be added as a sublayer of another, in effect creating a two dimensional array of layers, potentially a grid. And a single preservesDepth property bundles all of the functionality of &lt;a target="_blank" href="http://developer.apple.com/Mac/library/documentation/GraphicsImaging/Reference/CATransformLayer_class/Reference/Reference.html"&gt;CATransformLayer&lt;/a&gt;, allowing you to create three dimensional scenes out of a single blueprint layer.&lt;/p&gt;
&lt;p&gt;When an animation is added to the original sublayer, it’s applied to each instance with a timing delay set with the instanceDelay property. Animating a collection of layers in sequence can get pretty fun.&lt;/p&gt;
&lt;p&gt;Replicator layers also support color offsets with a built-in set of properties for incrementing or decrementing color values for each new instance. This stuff is really cool.&lt;/p&gt;
&lt;p&gt;Apple has a phenomenal demo put together using this new class, which is one of the more beautiful things I’ve seen in a while, so &lt;a target="_blank" href="http://developer.apple.com/mac/library/samplecode/ReplicatorDemo/index.html"&gt;check it out&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I played with this stuff for a little as well and put together another animation sequence. There’s an HD video of it &lt;a target="_blank" href="http://www.vimeo.com/7258490"&gt;here&lt;/a&gt;.  But if you’ve got a Mac, you might as well &lt;a target="_blank" href="http://github.com/joericioppo/CAReplicatorLayer_Animation/fast_forward"&gt;build and run&lt;/a&gt;.&lt;/p&gt;</description><link>http://tumbljack.com/post/223478784</link><guid>http://tumbljack.com/post/223478784</guid><pubDate>Sun, 25 Oct 2009 21:10:00 -0700</pubDate><category>code</category><category>Core-Animation</category></item><item><title>made this to impress mad scientists from outer-space who...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_krwot9MsVQ1qzzqhdo1_r1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;made this to impress mad scientists from outer-space who apparently like graphics.&lt;/p&gt;</description><link>http://tumbljack.com/post/219816390</link><guid>http://tumbljack.com/post/219816390</guid><pubDate>Thu, 22 Oct 2009 00:58:00 -0700</pubDate></item><item><title>GPU Accelerated Awesomeness with CAGradientLayer</title><description>&lt;p&gt;Interface&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://developer.apple.com/IPhone/library/documentation/GraphicsImaging/Reference/CAGradientLayer_class/Reference/Reference.html"&gt;CAGradientLayer&lt;/a&gt; is my favorite new addition to the Core Animation framework. It’s a straightforward, hardware accelerated linear-gradient rendering API that’s easy to use, super powerful and blazing fast. Setting one up is just a few lines of code..&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;CAGradientLayer *layer = [CAGradientLayer layer];&lt;/p&gt;
&lt;p&gt;layer.colors = [NSArray arrayWithObjects:(id)[UIColor colorWithWhite:0.90 alpha:1.0].CGColor, [UIColor colorWithWhite:0.75 alpha:1.0].CGColor, nil];&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;This renders a straight gradient, top to bottom, with the first color on top. The angle of the gradient can be adjusted by specifying two points to define an axis. CAGradientLayer carries down all the standard properties of CALayer so you get a border and corner radius for free, as well as background color. This is really convenient, because similar to working in Photoshop you can create a rendered effect using transparent whites, then adjust only the background color to change the composition you’re working with.&lt;/p&gt;
&lt;p&gt;Tricking one out takes a little more setup, but is just a matter of adding more colors and creating a matching array of color-stop locations..&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;CAGradientLayer *layer = [CAGradientLayer layer];&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;UIColor *colorOne     = [UIColor colorWithHue:0.625 saturation:0.1 brightness:0.8 alpha:0.7];&lt;/p&gt;
&lt;p&gt;UIColor *colorTwo     = [UIColor colorWithHue:0.625 saturation:0.1 brightness:0.8 alpha:0.7];&lt;/p&gt;
&lt;p&gt;UIColor *colorThree  = [UIColor colorWithHue:0.625 saturation:0.1 brightness:0.8 alpha:0.5];&lt;/p&gt;
&lt;p&gt;UIColor *colorFour    = [UIColor colorWithHue:0.625 saturation:0.1 brightness:0.8 alpha:0.2];&lt;/p&gt;
&lt;p&gt;UIColor *colorFive     = [UIColor colorWithHue:0.625 saturation:0.1 brightness:0.8 alpha:0.0];&lt;/p&gt;
&lt;p&gt;UIColor *colorSix       = [UIColor colorWithHue:0.625 saturation:0.1 brightness:0.8 alpha:0.0];&lt;/p&gt;
&lt;p&gt;UIColor *colorSeven  = [UIColor colorWithHue:0.625 saturation:0.1 brightness:0.8 alpha:0.3];&lt;/p&gt;
&lt;p&gt;NSArray *colors =  [NSArray arrayWithObjects:(id)colorOne.CGColor, colorTwo.CGColor, colorThree.CGColor, colorFour.CGColor, colorFive.CGColor, colorSix.CGColor, colorSeven.CGColor, nil];&lt;/p&gt;
&lt;p&gt;layer.colors = colors;&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;NSNumber *stopOne     = [NSNumber numberWithFloat:0.00];&lt;/p&gt;
&lt;p&gt;NSNumber *stopTwo     = [NSNumber numberWithFloat:0.02];&lt;/p&gt;
&lt;p&gt;NSNumber *stopThree  = [NSNumber numberWithFloat:0.02];&lt;/p&gt;
&lt;p&gt;NSNumber *stopFour    = [NSNumber numberWithFloat:0.50];&lt;/p&gt;
&lt;p&gt;NSNumber *stopFive     = [NSNumber numberWithFloat:0.50];&lt;/p&gt;
&lt;p&gt;NSNumber *stopSix       = [NSNumber numberWithFloat:0.95];&lt;/p&gt;
&lt;p&gt;NSNumber *stopSeven  = [NSNumber numberWithFloat:1.00];&lt;/p&gt;
&lt;p&gt;NSArray *locations = [NSArray arrayWithObjects:stopOne, stopTwo, stopThree, stopFour, stopFive, stopSix, stopSeven, nil];&lt;/p&gt;
&lt;p&gt;layer.locations = locations;&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;The result is a scaleable, reusable, freely editable piece of hardware accelerated artwork. Entire interfaces can be created with gradient layers, using very little code, all rendered on the GPU. If fact ColorDev is drawn all in code using gradient layers, including the spectrum hue slider, the gloss effects and even the top bar. Of course you get one of those for free in the kit, but what can I say, I was geeking out.&lt;/p&gt;
&lt;p&gt;The trick is to subclass CAGradientLayer, and set up the gradient inside of -init, then whenever you need one just instantiate it with CALayer’s constructor method +layer, set its geometry and it’s ready to go.&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;Animation&lt;/p&gt;
&lt;p&gt;CAGradientLayer only has a few properties: an array of colors, an array of color-stop locations, and two points to adjust the axis on which it’s rendered, but everything is animatable. You can set up a gradient animation using the key path of the property you want to animate. So animating from one color-set to another would look something like this..&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@”colors”];&lt;/p&gt;
&lt;p&gt;animation.fromValue = initialColors;&lt;/p&gt;
&lt;p&gt;animation.toValue = newColors;&lt;/p&gt;
&lt;p&gt;animation.duration	= 1.0;&lt;/p&gt;
&lt;p&gt;animation.removedOnCompletion = NO;&lt;/p&gt;
&lt;p&gt;animation.fillMode = kCAFillModeForwards;&lt;/p&gt;
&lt;p&gt;animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];&lt;/p&gt;
&lt;p&gt;[gradientLayer addAnimation:animation forKey:@”animateGradient”];&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;Gradient animations are interesting, to say the least. It’s a little tricky getting a result that makes visual sense, but on the nerdy side, it seems like the rendering engine maps out the two gradients, then interpolates a cross-fade for each color on an per-pixel basis. It’s pretty cool. I set up a few quick examples to demonstrate the concept.&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;Application&lt;/p&gt;
&lt;p&gt;A few weeks ago Matt Gallapher wrote &lt;a target="_blank" href="http://cocoawithlove.com/2009/08/adding-shadow-effects-to-uitableview.html"&gt;a great post&lt;/a&gt; on using CAGradientLayer to implement shadow effects on a table view, as well as rendering a gradient in each table view cell. He does a neat trick by implementing UIView’s +layerClass method. This method is used to specify a custom class as the default backing layer of a UIView. Often it’s used to return a CAEAGLLayer as the views built-in layer so you can jump right into OpenGL. Matt overrides it in his UITableViewCell subclass to return a CAGradientLayer as the built-in backing layer of each table view cell. Slick.&lt;/p&gt;
&lt;p&gt;Inspired by this I put together my own quick example implementing +layerClass all over the place to return customized versions of standard kit objects like the navigation bar, toolbar, table view cell, etc. The beauty of this is that you don’t implement -drawRect, or even touch a CGContextRef, and of course there are no images.&lt;/p&gt;
&lt;p&gt;Not that I’m dissing Core Graphics. It’s just that it’s like this..&lt;/p&gt;
&lt;p&gt;Core Graphics == WALL-E&lt;/p&gt;
&lt;p&gt;CAGradientLayer == EVE&lt;/p&gt;
&lt;p&gt;You can check out the slightly bizarre gradient animations &lt;a target="_blank" href="http://tumbljack.com/post/188057500"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;And I’m releasing my interface sample freely under the &lt;a target="_blank" href="http://sam.zoy.org/wtfpl/"&gt;WTFPL license&lt;/a&gt;. So check out the code on &lt;a target="_blank" href="http://github.com/joericioppo/CAGradientLayer_UI"&gt;GitHub&lt;/a&gt;. And there’s a &lt;a target="_blank" href="http://tumbljack.com/post/188057792"&gt;demo video&lt;/a&gt; too.&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;&lt;img src="http://www.freeyourtelevision.com/files/img/cagradient-ui.png" width="497" height="320"/&gt;&lt;/p&gt;</description><link>http://tumbljack.com/post/188089679</link><guid>http://tumbljack.com/post/188089679</guid><pubDate>Mon, 14 Sep 2009 17:17:00 -0700</pubDate><category>UI</category><category>code</category><category>Core-Animation</category></item><item><title>Video</title><description>&lt;object type="application/x-shockwave-flash" width="400" height="300" data="http://vimeo.com/moogaloop.swf?clip_id=6582021&amp;server=vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF"&gt;&lt;param name="quality" value="best" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="scale" value="showAll" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=6582021&amp;server=vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF" /&gt;&lt;embed src="http://www.vimeo.com/moogaloop.swf?clip_id=6582021&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://tumbljack.com/post/188057792</link><guid>http://tumbljack.com/post/188057792</guid><pubDate>Mon, 14 Sep 2009 16:36:46 -0700</pubDate></item><item><title>Video</title><description>&lt;object type="application/x-shockwave-flash" width="400" height="300" data="http://vimeo.com/moogaloop.swf?clip_id=6581910&amp;server=vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF"&gt;&lt;param name="quality" value="best" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="scale" value="showAll" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=6581910&amp;server=vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF" /&gt;&lt;embed src="http://www.vimeo.com/moogaloop.swf?clip_id=6581910&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://tumbljack.com/post/188057500</link><guid>http://tumbljack.com/post/188057500</guid><pubDate>Mon, 14 Sep 2009 16:36:19 -0700</pubDate></item><item><title>Complex Interpolation with CAShapeLayer (Free)</title><description>&lt;p&gt;CAShapeLayer is an interesting new subclass of CALayer available in 3.0 and now 10.6, and it’s got some pretty cool features.&lt;/p&gt;
&lt;p&gt;A shapelayer represents an arbitrary shape that gets rendered onscreen. The shape is defined by its path property which takes a CGPathRef. The path can be anything. So in a sense it’s a freeform drawing API brought up to the Core Animation framework level and available to you in your layering and compositing hierarchy.&lt;/p&gt;
&lt;p&gt;Interestingly, the shape isn’t rendered into the layer’s contents. In fact, the layer’s contents aren’t rendered at all, only the shape is. The documentation states that “the shape is composited between the layer’s contents and its first sublayer”. So the layer is in a sense just a container for the shape. You can set all of its standard CALayer properties, like contents and backgroundColor, but they get zeroed out at render time.&lt;/p&gt;
&lt;p&gt;Solidifying this distinction, CAShapeLayer has its own set of properties for describing visual attributes following the nomenclature of working with a graphics context. So if you want to create a shapelayer, you’re looking for fillColor and strokeColor. Setting up a shapelayer is pretty easy and would look something like this.&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;CAShapeLayer  *shapeLayer = [CAShapeLayer layer];&lt;/p&gt;
&lt;p&gt;shapeLayer.path = crazyAwesomePath;&lt;/p&gt;
&lt;p&gt;UIColor *fillColor = [UIColor colorWithHue:0.625 saturation:0.4 brightness:0.5 alpha:1.0];&lt;/p&gt;
&lt;p&gt;shapeLayer.fillColor = fillColor.CGColor;&lt;/p&gt;
&lt;p&gt;UIColor *strokeColor = [UIColor colorWithHue:0.625 saturation:0.4 brightness:0.9 alpha:1.0];&lt;/p&gt;
&lt;p&gt;shapeLayer.strokeColor = strokeColor.CGColor;&lt;/p&gt;
&lt;p&gt;shapeLayer.lineWidth = 2.0;&lt;/p&gt;
&lt;p&gt;shapeLayer.fillRule = kCAFillRuleNonZero;&lt;/p&gt;
&lt;p&gt;[rootLayer addSublayer:shapeLayer];&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;The fillRule tells the rendering engine how to deal with intersecting paths and NonZero just means fill everything inside the path. CAShapeLayer also comes with a set of properties for describing intricate line dash patterns as well as properties for how lines end and corners meet.&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;The Crazy Part&lt;/p&gt;
&lt;p&gt;Since it’s a layer, everything is animatable. Literally everything, even the path property. I couldn’t imagine what this meant at first, and decided it must cross-fade from one shape to another or something. But no, indeed the Core Animation engine interpolates values from the current path to the new path and morphs the shape from one to the other. It’s pretty mind-blowing.&lt;/p&gt;
&lt;p&gt;To get a smooth animation from one path to another you want the same number of subpaths and specifically the same number of points, because even though Core Animation doesn’t speak in vertices, that’s really what it’s working with. If you have a discrepancy from one path to another the interpolation engine drops to the lowest common denominator of points and creates its own subpaths to complete the shape, which gives some unexpected results.&lt;/p&gt;
&lt;p&gt;Setting up a continuous path animation would look something like this..&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@”path”];&lt;/p&gt;
&lt;p&gt;animation.duration = 2.0;&lt;/p&gt;
&lt;p&gt;animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];&lt;/p&gt;
&lt;p&gt;animation.repeatCount = 1e100f;&lt;/p&gt;
&lt;p&gt;animation.autoreverses = YES;&lt;/p&gt;
&lt;p&gt;animation.fromValue = (id)initialPath;&lt;/p&gt;
&lt;p&gt;animation.toValue = (id)newPath;&lt;/p&gt;
&lt;p&gt;[shapeLayer addAnimation:animation forKey:@”animatePath”];&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;I put together a couple examples. The first one uses basic shapes that you actually get for free with layers, and just demonstrates CAShapeLayer’s ability to interpolate between them. The second is a little more interesting, using complex polygons sharing only the same number of points and subpaths.&lt;/p&gt;
&lt;p&gt;You can check out a video of it in action &lt;a target="_blank" href="http://tumbljack.com/post/179966754"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;And the code is available on GitHub &lt;a target="_blank" href="http://github.com/joericioppo/Shape_04/tree/master"&gt;here&lt;/a&gt; and &lt;a target="_blank" href="http://github.com/joericioppo/Shape_05/tree/master"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><link>http://tumbljack.com/post/179975074</link><guid>http://tumbljack.com/post/179975074</guid><pubDate>Fri, 04 Sep 2009 17:05:00 -0700</pubDate><category>code</category><category>iphone</category><category>Core-Animation</category></item></channel></rss>
