Window Animation?

Hi,
Is it possible to make a window have an animation upon opening / closing etc. ?

I have noticed that some popover windows seem to grow in size, and then bounce slightly at the end.
Hard to explain, but rather than have a window instantly appear / disappear - I would like a very slight animation.

Alternatively, a fade in / fade out animation would suffice.

Thanks.

NSPopOver has those animations built in.

You could try to do something neat with AnimationKit, but you need to be careful if there are any TextAreas on the window as those like to crash horribly when animated to 0. AnimationKit only handles move/resize animations, to do a fade you’d have to get fancy with the declares you’re already using for your transparent window.

If you’re talking about a real (native) NSPopover, then yes, it’s just a boolean property.
https://developer.apple.com/library/mac/documentation/AppKit/Reference/NSPopover_Class/Reference/Reference.html#//apple_ref/occ/instp/NSPopover/animates

I just checked and MacOSLib and dtPlugins (25 euros) both expose the ‘animates’ property. Set it to true and the animation is handled for you.

Wow - just looked at the macoslib fade in splash screen - I have no idea what components I need to import into my own project???
I will forget that idea - it was only a bit of eye candy anyway :slight_smile:

Thanks anyway guys :slight_smile:

You can just add this code to your window (or window class) to get the same bounce animation as the NSPopovers have…

#if TargetCocoa const kNSWindowAnimationBehaviorAlertPanel = 5 Declare Sub setAnimationBehavior lib "AppKit" selector "setAnimationBehavior:" (windowRef As WindowPtr, newAnimationBehavior As Integer) setAnimationBehavior self, kNSWindowAnimationBehaviorAlertPanel #endif

Thanks Shao - That worked perfectly!
:slight_smile: