Local Links

External Links

Contact

Search this site

Animating windows and controls in Xojo Cocoa apps


When building OS X apps with Xojo for Cocoa, we can make use of the Cocoa NSAnimation API.

I have written a self-contained class (TTsCocoaAnimation) for fading, moving and resizing windows and controls in Xojo Cocoa applications.

Using it is fairly easy. To fade out a window in half a second (0.5s), all you need are these lines:

dim animator as new TTsCocoaAnimation
animator.FadeOut Window1
animator.StartAnimation 0.5, TTsCocoaAnimation.Curve.EaseInOut, false

Resizing a window isn't much different:

dim animator as new TTsCocoaAnimation
animator.Resize Window1, newWidth, newHeight
animator.StartAnimation 0.5, TTsCocoaAnimation.Curve.EaseInOut, false

The code is open source and includes sample code:

Tested with Real Studio 2012r2.1 and Xojo 2013r3.3.

Download: TTsCocoaAnimation.zip


Page last modified on 2014-05-18, 08:25 EDT
Powered by PmWiki