Record a Core Animation animation

Posted: February 12, 2009 in IT/Dev
Tags: , , ,

The famous CIMG site provides a solution to Core Animation animations recording into a QuickTime movie, from te code that launches the animation (then faster than using an external tool). The trick is to trigger a timer at animation start, and at each timer invocation we make the CA layer draw into an in-memory Core Graphics context, then we convert it into an NSBitmapImageRep, and finally the image representation (TIFF here) is added to the previously instanciated QuickTime movie object. The CA layer used to draw into the context has to be the rootLayer’s presentationLayer (bounding layer), not the animated layer.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s