-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|151|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Blogs Home -> Blogs


 
Cower
Created : 13 February 2010
Edited : 13 February 2010
System : Mac

Core Animation fiddling

Fiddling with the Core Animation API in Mac OS.

This stuff is pretty cool. I don't know what Windows offers lately for animating things, but using Core Animation is actually pretty nice. The only real issue I encountered was the way CGImages have to be loaded, but I found a convenient work-around whereby you load the image you want as an NSImage and then call CGImageForProposedRect:content:hints: and get a CGImageRef out of that. Less typing is required and the end result is the same.

Anyhow, picture/video.



Random note: There are 5 layers in total here, the root layer (which does nothing other than provide a tree structure), the right, center, and left images, and the text. Each of these are kept attached to each other using CAConstraints (the center region gets its width from the text layer and its min X from the max X of the left region, the right region gets its min X from the center's max X, and the min Y for them all is taken from the left region's min Y).

Look, another picture (also a video):

 

Comments