Chasing trefoil: varying a space-curve over time​
​by Sander Huisman

Basic function

Let’s make a function that renders a space-curve sc, for time t, while a fraction of ϕ is visible, and for the PlotRange pr.
$HistoryLength=2;​​ClearAll[MakeScene]​​MakeScene[sc_,t_,ϕ_,pr_]:=Module[{pts,tt,r,nn,gr},​​r=0.5;(*radiusoftube*)​​nn=150;(*numberofpoints*)​​pts=Table[sc[-2Pitt],{tt,Subdivide[t,t+ϕ,nn]}];​​gr=Graphics3D[​​{​​Directive[{MaterialShading["Iron"]}],​​CapForm["Square"],​​Tube[BSplineCurve[pts,SplineDegree2],r]​​},​​Lighting{SpotLight[White,{14{Sin[2Pit],-Cos[2Pit],1.4+1Cos[3×2Pit]},{0,0,0}},Pi/2],AmbientLight[GrayLevel[0.2]]},(*movethelightsaroundinxyz*)​​BackgroundBlack,​​ViewVector{{0,0,30},{0,0,0}},​​ViewVertical{Sin[2Pit],Cos[2Pit],0},(*rotatetheview*)​​ViewVertical{0,1,0},​​PlotRangepr,​​Method->{"TubePoints"->30,"SpherePoints"->3},​​BoxedFalse,​​ImageSize800{1,1}​​];​​ImageResize[Rasterize[gr,RasterSize800{1,1}],Scaled[0.5]]​​]

Trefoil chaser

Get the space curve, modify it a bit, find the plot range, and do a test-scene:
In[]:=
sc=KnotData["Trefoil","SpaceCurve"];​​sc[[1,;;2,2]]*=1.5;(*makeitabitless'tight'*)​​sc[[1,3]]*=3;(*andmore'tall'*)​​pr=CoordinateBounds[Table[sc[t],{t,0,2Pi,Pi/100.0}],0.6];(*gettheplotrangeandfixit*)​​MakeScene[sc,0,0.9,pr]
Out[]=
Let’s vary the fraction ϕ over time, so it is chasing, getting closer and further away and so on:
In[]:=
Plot[0.875+0.075Cos[2Pi(#-0.05Cos[2Pi#])]&[t],{t,0,1},PlotRange{0.7,1}]
Out[]=
0.0
0.2
0.4
0.6
0.8
1.0
0.75
0.80
0.85
0.90
0.95
1.00
make the images:
In[]:=
imgs=Parallelize[MakeScene[sc,#,0.875+0.075Cos[2Pi(#-0.05Cos[2Pi#])],pr]&/@Most[Subdivide[0,1,60]]];
Let’s export the images:
In[]:=
SetDirectory[NotebookDirectory[]];​​Export["chasingtrefoil.gif",imgs,"DisplayDurations"->1/30]
Out[]=
chasingtrefoil.gif