Search code examples
objective-ccocoacore-animation

Creating an animation with the “genie” effect in Cocoa


How would I go about creating a similar kind of animation as the “genie minimizing effect” in Mac OS X? That is, I want the animation to start at some given point (or a small rectangle), and then “swoop” into its bigger rectangle form with the “genie” effect.

How could such an animation be achieved? Does Core Animation provide anything to do this?

If I have to do this manually, i.e. frame by frame, I believe I could do the mathematical calculations needed to determine the curves at each frame. However, the question is, how would I actually draw the rectangular NSImage (or CGImage) within the specified curves?


Solution

  • It can be done with Core Image and a bit of work. Please see my blog post here (sadly, the Quartz Composer sample project no longer works out of the box, it needs a bit of updating. The source is still there though):

    The Genie Effect