Tree of Life

April 2nd, 2007 by Chris

IronCoder V came to a close last Sunday. The theme for the 48 hour hacking marathon was Life and the required API was the ScreenSaver.framework. Congratulations to Ben Gottlieb for winning with his clever screen saver, WikiPath. Hope to see you at C4 this year!

Oddly, I found it difficult to come up with anything terribly interesting around the theme this time. I’m a bit afraid to contemplate what it means when ‘Life’ isn’t inspiring! When inspiration finally did hit the requirements called for some 3-D graphics, which left me with two obvious choices : Quartz Composer or OpenGL. Having had some previous Quartz Composer experience I opted for this route, rather than a crash-course in OpenGL.

Interestingly, I quickly ran up against some of the more difficult sorts of tasks to accomplish in Quartz Composer. In the end I had something that was close to the original idea, but no where near as dynamic as I would have liked. I’m definitely more conversant in the visual language of Quartz Composer than I was before the contest. I’m also inclined to try and find a nice little OpenGL project to tackle in the near future…perhaps for Iron Coder VI?

Tree of Life is a simple screen saver that scans your Pictures folder and uses the images in it as leaves on a tree. The leaves, sprout and then fall to the ground as the cycle of life churns.

I cleaned up the code and fixed a few problems that I just didn’t have time to address before the contest deadline. I also added the ability to point it to a folder of your own choosing. There are a lot of features that didn’t make it in that might make it more compelling including :

  • Choose iPhoto albums as source
  • Cycle through all images in folder
  • Accent the images with a frame or border ( think green )
  • Maintain aspect of original image
  • More variety in leaf growth and movement
  • Control # of leaves with preference
  • Fix falling animation to have proper start position
  • Hook up sudden-motion-sensor to ‘shake’ the leaves off the tree!

Perhaps someone else will feel like adding features? If so the source code and screen saver are available here.

Comments are closed.