The following WebGL animation is designed using a similar approach used by its desktop OpenGL counterpart.

Credits

The initial skeleton of the code was generated by YeoMan ThreeJS Generator