"MathBox is a library for rendering presentation-quality math diagrams in a browser using WebGL. Built on top of Three.js and ShaderGraph, it provides a clean API to visualize mathematical relationships and animate them declaratively."
MathBox was created by Steven Wittens. Check out its code and read through the documentation.
You can access code of all examples here.
MathBox and ShaderGraph (c) Steven Wittens 2013-2015. MIT License. Libraries and 3rd party shaders (c) their respective authors.