Improved performance for 3D demo.

Added caching of canvas .width and .height return values.  These
calls were taking up about 10 % of overall execution time on my
machine and caching them dropped the time to render a frame from
110ms to 60ms on my machine.

requestAnimation() replaces setInterval.  This lets the browser
decide when to draw the frame, resulting in a smoother frame rate.