How to animate my dock icon ?

I want my app be able to dynamically change its dock's icon…
Two classes are mainly involved in this problem's solution: NSImage to read, manipulate and|or to compose the image you want to be your application icon in the dock and NSApplication to actually define the image to be used in the dock.
[NSApp setApplicationIconImage:myAppImage]; is the code that will set your icon in the dock.
Useful methods of the NSImage class:
compositeToPoint, dissolveToPoint, etc. To avoid user's confusion, don't change the application icon to a completely different one: the best practice is to compose another image on top of the standard application icon like the Print Center or Mail are doing, solution changing the color chroma of the original image could also be imagined. If you decide to completely change the icon, it should be for an image the user will immediately identify as being a particular state of your application: the look should be familiar enough to identify the icon to your app.