Easy Animation


Animation ToolboxInterface and eye candy seem to be taking a prominent role in recent Mac developer’s minds. Just ask Dustin MacDonald. But whatever your view, there comes a time when you need something to fly across the screen, bounce up and down or just move. In other words, animate. And animate you shall, with Simon Haertel’s excellent Animation Toolbox 3. Also used extensively in his Mac version of Tetris, Quinn, the toolbox makes things like bouncing and sliding look natural and sleek - with hardly any code.

If it’s animating views you’re after, Matt Gemmell has got you covered. Initially having trouble with NSViewAnimation, someone neglected to tell him that it needs to be subclassed. However, Matt has recovered from his lapse in, uh, frustration and created a little sample animating views subclass. From his blog:

It’s a partial rework of Todd’s NSAnimation Demo code, which subclasses NSAnimation directly and updates all the animated views’ frames itself in the same thread for better perceived performance. For basic “animate a bunch of views at once” uses, you should be able to just change NSViewAnimation to MGViewAnimation and go with it… But please read these caveats:
  • This thing is barely tested at all
  • It will probably only work for views (not views and windows, as NSViewAnimation does)
  • It doesn’t attempt to do the fade-effects that NSViewAnimation does (though that should be trivial to implement if you need it)
At the very least it’s a good starting point for folk having issues with NSViewAnimation, and just as a general example. I hope someone finds it useful, and a big thanks again to Todd for his original code.
Matt Gemmell

You can download his MGViewAnimation project from Gemmell’s Source Code page.


Back to Top ↑

4 Comments so far

Leave a comment
  1. 1

    I knew Simon’s Animation Toolbox. It’s really cool! I’m gonna go digg in Matt’s code now, thanks for the link!

  2. 2

    Can I exchange link with you? My blog is about computer, blog and others tips and tricks and it needs more links.

  3. 3

    Hi there,
    Just a note that I’ve significantly updated MGViewAnimation since my original post; I’ve updated the post with the new information, and updated the download.

  4. 4

    Thanks, Matt. Very nice work.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Comments may be edited for formatting.