Interface 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:Matt GemmellAt 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.
- 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)
You can download his MGViewAnimation project from Gemmell’s Source Code page.
4 Comments so far
Leave a commentI knew Simon’s Animation Toolbox. It’s really cool! I’m gonna go digg in Matt’s code now, thanks for the link!
proclaimed by SeoxyS on November 15, 2006 12:18 am | Permalink
Can I exchange link with you? My blog is about computer, blog and others tips and tricks and it needs more links.
revealed by angelchen on November 16, 2006 5:11 pm | Permalink
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.
revealed by Matt Gemmell on November 17, 2006 7:04 am | Permalink
Thanks, Matt. Very nice work.
proclaimed by Ankur on November 17, 2006 2:57 pm | Permalink
Leave a comment