Example from html5 canvas book - david geary