I found two animated GIFs from a designer's website, which looks very impressive:

My questions are:
what is the mathematics behind them? How to obtain the mathematical formulas and equations of the curve/surface?
The mesh in the left is different from normal rectangular ones; The curve in the right should be ones on a spherical surface. And both the two were said to be created via Processing 2 software.