How to make a genie effect when a window is created/closed ?

I have a toolbar where, when some buttons are clicked, a window is opened. I would like to do this with an animation like the genie effect of the Finder: is it possible ?
NSWindow documentation: setFrame:display:animate and (NSTimeInterval)animationResizeTime:(NSRect)newFrame are exactly what you are looking for.
There is also from 10.3 and above:
void NSShowAnimationEffect(NSAnimationEffect animationEffect, NSPoint centerLocation, NSSize size, id animationDelegate, SEL didEndSelector, void *contextInfo); where animationEffect may be NSAnimationEffectDisappearingItemDefault or NSAnimationEffectPoof.
Look at