What function could describe this GIF animation?
Here's a pretty direct translation to Mathematica of the processing code pointed out by horchler. It's littered with spherical coordinates and I've placed the path on a sphere so that we can clearly see its 3D origin.
pics = Table[
tw = 0.5 (1 - Cos[2 Pi*t]);
tw = 3 Pi (0.5*tw + 1.5*tw*tw - tw*tw*tw);
n = 720;
r = 220;
pts = Table[
th = 2 Pi*i/n;
ph = tw*Cos[th];
x = r*Cos[th];
y = r*Sin[th] Cos[ph];
z = r*Sin[th]*Sin[ph];
xx = x*Cos[Pi*t] - z*Sin[Pi*t];
zz = -x*Sin[Pi*t] - z*Cos[Pi*t];
{xx, y, zz},
{i, 0, n - 1}];
Rasterize[
Graphics3D[{{Opacity[0.2], Sphere[{0, 0, 0}, r]}, Tube[pts]},
ViewPoint -> {1, 0, 10},
ViewVertical -> {0, 1, 0}, Boxed -> False], RasterSize -> 800,
ImageSize -> 400],
{t, 0, 1, 0.02}];
ListAnimate[pics]
Here's my original answer that I obtained by just looking at the image.
We can get something like the middle phase as follows. First, define $r_1$ and $r_2$ by $$ \begin{align} r_1(t) &= \sqrt[3]{|\cos(t/m)|} \\ r_2(t) &= \sqrt{|\cos((t-m\pi)/n)}, \end{align} $$ where $m=3$ and $n=9$. Then, $$ p(t) = \left\{ \begin{array}{cc} r_1(t) \, \langle \cos(t), \text{sgn}(r_1(t)) \sin(t) \rangle & 0 \leq t \leq m\pi \\ r_2(t) \, \langle \cos((t-(m-1)\pi)), -\text{sgn}(r_2(t)) \sin((t-(m-1)\pi)) \rangle & m\pi < t \leq (m+n)\pi. \end{array} \right. $$ We can plot it in Mathematica:
{m, n} = {3, 9};
p[t_] := Piecewise[{
{CubeRoot[Abs[Cos[t/m]]] {Cos[t], Sign[Cos[t/m]] Sin[t]}, 0<=t<=m*Pi},
{Sqrt[Abs[Cos[(t - m*Pi)/n]]]*
{Cos[(t-(m-1)*Pi)], -Sign[Cos[(t-m*Pi)/n]]*Sin[(t-(m-1)*Pi)]},
m*Pi <= t <= (m + n) Pi}
}];
ParametricPlot[p[t], {t, 0, (m + n)*Pi},
ColorFunction -> (Darker[ColorData["GrayYellowTones"][Sin[Pi #3]]] &),
PlotStyle -> Directive[Opacity[0.8], Thickness[0.015]],
Exclusions -> None, Axes -> None]
I can't quite seem to get the animation, though.
The source code shows it: in spherical coordinates, $\phi=t_w\cos(\theta)$ where $t_w$ changes periodically over time between $0$ and $1$ (as a third degree polynomial of the cosine). The "sphere" also rotates uniformly and is displayed with perspective.