Screen Savers

Here's what I've written so far. Hopefully there will be more soon. Periodically I'll update these as I make changes and improvements. At some point I'll post the source code.

There are some caveats:
  • I'm writing these in my spare time to teach myself Cocoa. I make no assertion they're bug-free, although they've not crashed my Mac yet.
  • I wrote these under OS 10.6, using my Mac Mini. I haven't the resources to test them on other machines. They should work on other Macs running OS 10.6, but I can make no guarantees about it. I don't know if my software will run on your machine, and I don't know what will happen.
  • Bottom line: software is presented as-is. You use at your own risk. I offer no warranty or guarantee.


This is the first module I wrote. It draws a bunch of expanding circles, much like the ripples rain would make when falling into a puddle. I had a similar screen saver years ago on my Macintosh SE/30, and I really liked it. I decided to recreate it as best I could.

Implementation is fairly straightforward. The position of each raindrop is chosen randomly. Once every frame the diameter of the circle is increased and the circle redrawn. When the ripple reaches a maximum value a new location is chosen and the process repeats. It's very simple, but surprisingly pleasant to watch.

The current implementation, while functional, is extremely inefficient: it takes up 25% CPU on my machine. I think it's because I'm doing too much drawing, or at least not doing it as efficiently as I could be. So a future change will be to improve the drawing.

Raindrops 1.2.1, MacOS 10.9, 32-bit Intel.


This is the second module I wrote. As the name implies, it draws a star field with stars of varying magnitude and color. The stars then "twinkle" randomly. After a user-specified number of minutes, the field is redrawn. The stars look more real if you set the twinkle interval to something low (stars at night shimmer more than twinkle).

It looks rather nice, in my opinion. Unfortunately, you can't see it really well unless you have the lights off or are within a few feet of your monitor!


Nocturnal Cityscape

My reimplementation of the "city at night" type of screensaver. The screen is divided into two regions. The first is the lower quarter, which is the "city" lights. The upper three-quarters contains the buildings and stars. The stars and city lights are essentially the stars from my "Stars" screensaver.

Each building is divided into windows. At a predetermined interval, a location is selected in a window and colored. The effect is that over time the buildings seem to "fade in". The buildings are drawn using layers. That is, each building is drawn offscreen and then blitted to the screen in its position, after the stars are drawn. It probably wasn't necessary, but I wanted the practice with layers.

At this point there are still some things that need to be worked out. In particular I'm not happy at all with the city lights (beneath the buildings). I'm working on making it look more like city lights, as opposed to a random assortment of lights.

Subpages (1): ScreenSaver_Cabinet