The projection logic has an orientation parameter (which you'd probably always want, so that you can pick initial rotation), so the rotation animation itself is just updating the param on a timer.
Basically line 182 plus the calls to redraw:
gamma -= 0.003;
To do it with CSS, at a minimum it would require adding support for rendering to two different canvas elements.